diff --git a/types/ascii2mathml/ascii2mathml-tests.ts b/types/ascii2mathml/ascii2mathml-tests.ts index 7280900922..cbd63e649f 100644 --- a/types/ascii2mathml/ascii2mathml-tests.ts +++ b/types/ascii2mathml/ascii2mathml-tests.ts @@ -1,6 +1,6 @@ import * as ascii2mathml from 'ascii2mathml'; -const fn = ascii2mathml({}); // $ExpectType any +const fn = ascii2mathml({}); // $ExpectType ascii2mathml fn(''); // $ExpectType string ascii2mathml('', {}); // $ExpectType string diff --git a/types/http-context/http-context-tests.ts b/types/http-context/http-context-tests.ts index 1542f50e1e..629f09ece3 100644 --- a/types/http-context/http-context-tests.ts +++ b/types/http-context/http-context-tests.ts @@ -9,7 +9,7 @@ let header: http.IncomingHttpHeaders = context.header; header = context.headers; header = request.header; header = request.headers; -const headerString: string | string[] = header['Content-Type']; +const headerString: string | string[] | undefined = header['Content-Type']; let url: string = context.url; url = request.url; diff --git a/types/klaw/v1/index.d.ts b/types/klaw/v1/index.d.ts index cbe78af067..74939f30c2 100644 --- a/types/klaw/v1/index.d.ts +++ b/types/klaw/v1/index.d.ts @@ -1,44 +1,39 @@ -// Type definitions for klaw v1.3.0 +// Type definitions for klaw 1.3 // Project: https://github.com/jprichardson/node-klaw // Definitions by: Matthew McEachen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -declare module "klaw" { +import * as fs from "fs"; +import { Readable, ReadableOptions } from 'stream'; - import * as fs from "fs" - import { Readable, ReadableOptions } from 'stream' +declare function K(root: string, options?: K.Options): K.Walker; - function K(root: string, options?: K.Options): K.Walker - - namespace K { - interface Item { - path: string - stats: fs.Stats - } - - type QueueMethod = "shift" | "pop" - - interface Options extends ReadableOptions { - queueMethod?: QueueMethod - pathSorter?: (pathA: string, pathB: string) => number - fs?: any // fs or mock-fs - filter?: (path: string) => boolean - } - - type Event = "close" | "data" | "end" | "readable" | "error" - - interface Walker { - on(event: Event, listener: Function): this - on(event: "close", listener: () => void): this - on(event: "data", listener: (item: Item) => void): this - on(event: "end", listener: () => void): this - on(event: "readable", listener: () => void): this - on(event: "error", listener: (err: Error) => void): this - read(): Item - } +declare namespace K { + interface Item { + path: string; + stats: fs.Stats; } - export = K + type QueueMethod = "shift" | "pop"; + + interface Options extends ReadableOptions { + queueMethod?: QueueMethod; + pathSorter?: (pathA: string, pathB: string) => number; + fs?: any; // fs or mock-fs + filter?: (path: string) => boolean; + } + + type Event = "close" | "data" | "end" | "readable" | "error"; + + interface Walker { + on(event: Event, listener: Function): this; + on(event: "close" | "end" | "readable", listener: () => void): this; + on(event: "data", listener: (item: Item) => void): this; + on(event: "error", listener: (err: Error) => void): this; + read(): Item; + } } + +export = K; diff --git a/types/klaw/v1/klaw-tests.ts b/types/klaw/v1/klaw-tests.ts index 2487aafd85..5e425a714a 100644 --- a/types/klaw/v1/klaw-tests.ts +++ b/types/klaw/v1/klaw-tests.ts @@ -1,43 +1,44 @@ import * as klaw from "klaw"; -const path = require('path'); +import * as path from "path"; // README.md: Streams 1 (push) example: -let items: klaw.Item[] = [] // files, directories, symlinks, etc +const items: klaw.Item[] = []; // files, directories, symlinks, etc klaw('/some/dir') - .on('data', function(item: klaw.Item) { - items.push(item) - }) - .on('end', function() { - console.dir(items) // => [ ... array of files] + .on('data', (item: klaw.Item) => { + items.push(item); }) + .on('end', () => { + console.dir(items); // => [ ... array of files] + }); // README.md: Streams 2 & 3 (pull) with error handling klaw('/some/dir') - .on('readable', function() { - let item: klaw.Item; - while (item = this.read()) { - items.push(item) + .on('readable', () => { + while (true) { + const item = this.read(); + if (!item) break; + items.push(item); } }) - .on('error', function(err: Error, item: klaw.Item) { - console.log(err.message) - console.log(item.path) // the file the error occurred on - }) - .on('end', function() { - console.log(items) // => [ ... array of files] + .on('error', (err: Error, item: klaw.Item) => { + console.log(err.message); + console.log(item.path); // the file the error occurred on }) + .on('end', () => { + console.log(items); // => [ ... array of files] + }); // README.md: Example (ignore hidden directories): -var filterFunc = function(item: string): boolean { - var basename = path.basename(item); - return basename === '.' || basename[0] !== '.' +function filterFunc(item: string): boolean { + const basename = path.basename(item); + return basename === '.' || basename[0] !== '.'; } klaw('/some/dir', { filter: filterFunc }) - .on('data', function(item: klaw.Item) { + .on('data', (item: klaw.Item) => { // only items of none hidden folders will reach here - }) + }); diff --git a/types/klaw/v1/tslint.json b/types/klaw/v1/tslint.json new file mode 100644 index 0000000000..d4a3f680ce --- /dev/null +++ b/types/klaw/v1/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + // TODOs + "ban-types": false + } +} diff --git a/types/moment-business-time/package.json b/types/moment-business-time/package.json new file mode 100644 index 0000000000..19e5fb0d14 --- /dev/null +++ b/types/moment-business-time/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": ">=2.14.0" + } +} diff --git a/types/react-responsive/v1/index.d.ts b/types/react-responsive/v1/index.d.ts index 2b9a37839f..ea0b07aa30 100644 --- a/types/react-responsive/v1/index.d.ts +++ b/types/react-responsive/v1/index.d.ts @@ -1,65 +1,62 @@ -// Type definitions for react-responsive 1.1.3 +// Type definitions for react-responsive 1.1 // Project: https://github.com/contra/react-responsive // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare module "react-responsive" { - import * as React from "react"; +import * as React from "react"; - namespace MediaQuery { - export interface MediaQueryProps { - query?: string; - // matchers - orientation?: "portrait" | "landscape"; - scan?: "progressive" | "interlace"; - aspectRatio?: string; - deviceAspectRatio?: string; - height?: number | string; - deviceHeight?: number | string; - width?: number | string; - deviceWidth?: number | string; - color?: boolean; - colorIndex?: boolean; - monochrome?: boolean; - resolution?: number | string; - // types - minAspectRatio?: string; - maxAspectRatio?: string; - minDeviceAspectRatio?: string; - maxDeviceAspectRatio?: string; - minHeight?: number | string; - maxHeight?: number | string; - minDeviceHeight?: number | string; - maxDeviceHeight?: number | string; - minDeviceWidth?: number | string; - maxDeviceWidth?: number | string; - minWidth?: number | string; - maxWidth?: number | string; - minColor?: number; - maxColor?: number; - minColorIndex?: number; - maxColorIndex?: number; - minMonochrome?: number; - maxMonochrome?: number; - minResolution?: number | string; - maxResolution?: number | string; - // types - all?: boolean; - grid?: boolean; - aural?: boolean; - braille?: boolean; - handheld?: boolean; - print?: boolean; - projection?: boolean; - screen?: boolean; - tty?: boolean; - tv?: boolean; - embossed?: boolean; - } +declare namespace MediaQuery { + interface MediaQueryProps { + query?: string; + // matchers + orientation?: "portrait" | "landscape"; + scan?: "progressive" | "interlace"; + aspectRatio?: string; + deviceAspectRatio?: string; + height?: number | string; + deviceHeight?: number | string; + width?: number | string; + deviceWidth?: number | string; + color?: boolean; + colorIndex?: boolean; + monochrome?: boolean; + resolution?: number | string; + // types + minAspectRatio?: string; + maxAspectRatio?: string; + minDeviceAspectRatio?: string; + maxDeviceAspectRatio?: string; + minHeight?: number | string; + maxHeight?: number | string; + minDeviceHeight?: number | string; + maxDeviceHeight?: number | string; + minDeviceWidth?: number | string; + maxDeviceWidth?: number | string; + minWidth?: number | string; + maxWidth?: number | string; + minColor?: number; + maxColor?: number; + minColorIndex?: number; + maxColorIndex?: number; + minMonochrome?: number; + maxMonochrome?: number; + minResolution?: number | string; + maxResolution?: number | string; + // types + all?: boolean; + grid?: boolean; + aural?: boolean; + braille?: boolean; + handheld?: boolean; + print?: boolean; + projection?: boolean; + screen?: boolean; + tty?: boolean; + tv?: boolean; + embossed?: boolean; } - - class MediaQuery extends React.Component { } - export = MediaQuery; - } + +declare class MediaQuery extends React.Component { } +export = MediaQuery; diff --git a/types/react-responsive/v1/react-responsive-tests.tsx b/types/react-responsive/v1/react-responsive-tests.tsx index 28f8f39c30..e3644771c4 100644 --- a/types/react-responsive/v1/react-responsive-tests.tsx +++ b/types/react-responsive/v1/react-responsive-tests.tsx @@ -37,6 +37,6 @@ class Test extends React.Component { - ) + ); } } diff --git a/types/react-responsive/v1/tslint.json b/types/react-responsive/v1/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-responsive/v1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 04465c845c..b4ea31a0ac 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -15,7 +15,6 @@ import { WrappedFieldProps, Fields, GenericFields, - BaseFieldProps, WrappedFieldsProps, FieldArray, GenericFieldArray,