Merge pull request #22133 from DefinitelyTyped/misc-fix

Miscellaneous test fixes
This commit is contained in:
Mine Starks
2017-12-13 10:11:03 -08:00
committed by GitHub
10 changed files with 122 additions and 116 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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;
+28 -33
View File
@@ -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 <https://github.com/mceachen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
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;
+23 -22
View File
@@ -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
})
});
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
// TODOs
"ban-types": false
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"moment": ">=2.14.0"
}
}
+54 -57
View File
@@ -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 <https://github.com/asvetliakov>
// 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<MediaQuery.MediaQueryProps, any> { }
export = MediaQuery;
}
declare class MediaQuery extends React.Component<MediaQuery.MediaQueryProps, any> { }
export = MediaQuery;
@@ -37,6 +37,6 @@ class Test extends React.Component {
</MediaQuery>
</MediaQuery>
</div>
)
);
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
-1
View File
@@ -15,7 +15,6 @@ import {
WrappedFieldProps,
Fields,
GenericFields,
BaseFieldProps,
WrappedFieldsProps,
FieldArray,
GenericFieldArray,