Merge remote-tracking branch 'upstream/master' into relay-modern

This commit is contained in:
voxmatt
2017-09-09 17:25:16 -10:00
343 changed files with 38175 additions and 17250 deletions
-147
View File
@@ -1,147 +0,0 @@
const {get} = require('https')
const {readdir, readFile, writeFile} = require('fs')
const {join, extname, basename, dirname, relative} = require('path')
const token = process.env.GITHUB_ACCESS_TOKEN || ''
const toMixedCase = (name) => {
let dist = name[0].toUpperCase()
for (let i = 1; i < name.length; i++) {
const c = name[i]
if (c !== '-') {
dist += c
continue
}
i++
dist += name[i].toUpperCase()
}
return dist
}
const github = (path) => new Promise((resolve, reject) => {
get({
headers: {'user-agent': 'DefinitelyTyped/material-ui/generate'},
host: 'api.github.com',
path,
}, (res) => {
if ((res.statusCode / 100 >> 0) != 2) {
reject(`GitHub response: ${res.statusCode} ${res.statusMessage}`)
return
}
let data = '';
res
.on('data', (chunk) => data += chunk)
.on('end', () => resolve(JSON.parse(data)))
}).on('error', reject)
})
const categories = () => github(`/repos/callemall/material-ui/contents/src/svg-icons?ref=master&access_token=${token}`)
const contents = (path) => github(`/repos/callemall/material-ui/contents/${path}?ref=master&access_token=${token}`)
const collator = new Intl.Collator()
const resolvePath = (filename) => join(__dirname, '../../types/material-ui', filename)
const readText = (filename) => new Promise((resolve, reject) => {
readFile(resolvePath(filename), 'utf8', (err, data) => {
if (err != null) {
reject(err)
return
}
resolve(data)
})
})
const writeText = (filename, text) => new Promise((resolve, reject) => {
writeFile(resolvePath(filename), text, 'utf8', (err) => {
if (err != null) {
reject(err)
return
}
resolve()
})
})
const inject = (content) => {
content.category = this.name
return content
}
const rMark = /(\/{2} \{{3})[\s\S]*?(\/{2} \}{3})/g
categories()
.then((cats) => Promise.all(Array.prototype.map.call(cats, (cat) => contents(cat.path)
.then((cons) => Array.prototype.map.call(cons, (con) => {
con.category = cat.name
return con
}))
)))
.then((contentsList) => Array.prototype.concat.apply([], contentsList)
.map((content) => {
const {path} = content
const name = basename(path, extname(path))
content.id = join(relative('src', dirname(path)), name)
content.className = toMixedCase(content.category) + toMixedCase(name)
return content
})
.sort((a, b) => collator.compare(a.id, b.id))
.reduce((prev, content) => {
const {dts, test} = prev
dts.individuals.push(`declare module 'material-ui/${content.id}' {
export import ${content.className} = __MaterialUI.SvgIcon;
export default ${content.className};
}`)
dts.summarizeds.push(` export import ${content.className} = __MaterialUI.SvgIcon; // require('material-ui/${content.id}');`)
test.individuals.push(`import _${content.className} from 'material-ui/${content.id}';`)
test.summarizeds.push(` ${content.className},`)
return prev
}, {
dts: {individuals: [], summarizeds: []},
test: {individuals: [], summarizeds: []},
})
)
.then(({dts, test}) => {
return Promise.all([
(() => {
const {individuals, summarizeds} = dts
const file = 'index.d.ts'
let index = 0
return readText(file)
.then((script) => writeText(file, script.replace(rMark, (_, p1, p2) => {
let text = ''
switch (index) {
case 0:
text = individuals.join('\n\n')
break
case 1:
text = summarizeds.join('\n')
break
}
index++
return p1 + '\n' + text + '\n' + p2
})))
})(),
(() => {
const {individuals, summarizeds} = test
const file = join('material-ui-tests.tsx')
let index = 0
return readText(file)
.then((script) => writeText(file, script.replace(rMark, (_, p1, p2) => {
let text = ''
switch (index) {
case 0:
text = individuals.join('\n')
break
case 1:
text = summarizeds.join('\n')
break
}
index++
return p1 + '\n' + text + '\n' + p2
})))
})(),
])
})
.catch((err) => console.error(err))
+4 -1
View File
@@ -50,7 +50,10 @@ interface Acl {
allowedPermissions: (userId: Value, resources: strings, cb?: AnyCallback) => Promise<void>;
isAllowed: (userId: Value, resources: strings, permissions: strings, cb?: AllowedCallback) => Promise<boolean>;
areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise<any>;
whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise<any>;
whatResources: {
(roles: strings, cb?: AnyCallback): Promise<any>;
(roles: strings, permissions: strings, cb?: AnyCallback): Promise<any>;
}
permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise<void>;
middleware: (numPathComponents?: number, userId?: Value | GetUserId, actions?: strings) => express.RequestHandler;
}
+12
View File
@@ -66,6 +66,18 @@ acl.isAllowed('joed', 'blogs', 'view', (err, res) => {
}
});
acl.whatResources('foo', (err, res) => {
if (res) {
console.log(res);
}
});
acl.whatResources('foo', 'view', (err, res) => {
if (res) {
console.log(res);
}
});
acl.isAllowed('jsmith', 'blogs', ['edit','view','delete'])
.then((result) => {
console.dir('jsmith is allowed blogs ' + result);
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+6 -4
View File
@@ -3,16 +3,16 @@ import * as Agenda from "agenda";
var mongoConnectionString = "mongodb://127.0.0.1/agenda";
var agenda = new Agenda({ db: { address: mongoConnectionString } });
agenda.define('delete old users', (job, done) => {
});
agenda.on('ready', () => {
agenda.every('3 minutes', 'delete old users');
// Alternatively, you could also do:
// Alternatively, you could also do:
agenda.every('*/3 * * * *', 'delete old users');
agenda.start();
@@ -81,6 +81,8 @@ agenda.stop(function() {
process.exit(0);
});
job.agenda.now('do the hokey pokey');
job.repeatEvery('10 minutes');
job.repeatAt('3:30pm');
+6 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Agenda v0.8.9
// Type definitions for Agenda v1.0.0
// Project: https://github.com/rschmukler/agenda
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -337,6 +337,11 @@ declare namespace Agenda {
*/
attrs: JobAttributes;
/**
* The agenda that created the job.
*/
agenda: Agenda;
/**
* Specifies an interval on which the job should repeat.
* @param interval A human-readable format String, a cron format String, or a Number.
+24
View File
@@ -98,10 +98,34 @@ export interface Request {
locale?: string;
}
export interface ResolutionStatus {
code: string;
}
export interface ResolutionValue {
name: string;
id: string;
}
export interface ResolutionValueContainer {
value: ResolutionValue;
}
export interface Resolution {
authority: string;
status: ResolutionStatus;
values: ResolutionValueContainer[];
}
export interface Resolutions {
resolutionsPerAuthority: Resolution[];
}
export interface SlotValue {
confirmationStatus?: ConfirmationStatuses;
name: string;
value?: any;
resolutions?: Resolutions;
}
export interface Intent {
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+124 -158
View File
@@ -1,25 +1,24 @@
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse';
var args: any;
let args: any;
var simpleExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse example',
const simpleExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse example',
});
simpleExample.addArgument(
['-f', '--foo'],
{
help: 'foo bar',
}
['-f', '--foo'],
{
help: 'foo bar',
}
);
simpleExample.addArgument(
['-b', '--bar'],
{
help: 'bar foo',
}
['-b', '--bar'],
{
help: 'bar foo',
}
);
simpleExample.printHelp();
@@ -35,13 +34,10 @@ args = simpleExample.parseArgs('--foo 5 --bar 6'.split(' '));
console.dir(args);
console.log('-----------');
var choicesExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: choice'
const choicesExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: choice'
});
choicesExample.addArgument(['foo'], { choices: 'abc' });
@@ -55,56 +51,53 @@ console.log('-----------');
// choicesExample.parseArgs(['X']);
// console.dir(args);
var constantExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: constant'
const constantExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: constant'
});
constantExample.addArgument(
['-a'],
{
action: 'storeConst',
dest: 'answer',
help: 'store constant',
constant: 42
}
['-a'],
{
action: 'storeConst',
dest: 'answer',
help: 'store constant',
constant: 42
}
);
constantExample.addArgument(
['--str'],
{
action: 'appendConst',
dest: 'types',
help: 'append constant "str" to types',
constant: 'str'
}
['--str'],
{
action: 'appendConst',
dest: 'types',
help: 'append constant "str" to types',
constant: 'str'
}
);
constantExample.addArgument(
['--int'],
{
action: 'appendConst',
dest: 'types',
help: 'append constant "int" to types',
constant: 'int'
}
['--int'],
{
action: 'appendConst',
dest: 'types',
help: 'append constant "int" to types',
constant: 'int'
}
);
constantExample.addArgument(
['--true'],
{
action: 'storeTrue',
help: 'store true constant'
}
['--true'],
{
action: 'storeTrue',
help: 'store true constant'
}
);
constantExample.addArgument(
['--false'],
{
action: 'storeFalse',
help: 'store false constant'
}
['--false'],
{
action: 'storeFalse',
help: 'store false constant'
}
);
constantExample.printHelp();
@@ -113,27 +106,24 @@ console.log('-----------');
args = constantExample.parseArgs('-a --str --int --true'.split(' '));
console.dir(args);
var nargsExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: nargs'
const nargsExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: nargs'
});
nargsExample.addArgument(
['-f', '--foo'],
{
help: 'foo bar',
nargs: 1
}
['-f', '--foo'],
{
help: 'foo bar',
nargs: 1
}
);
nargsExample.addArgument(
['-b', '--bar'],
{
help: 'bar foo',
nargs: '*'
}
['-b', '--bar'],
{
help: 'bar foo',
nargs: '*'
}
);
nargsExample.printHelp();
@@ -145,40 +135,34 @@ console.log('-----------');
args = nargsExample.parseArgs('--bar b c f --foo a'.split(' '));
console.dir(args);
var parent_parser = new ArgumentParser({ addHelp: false });
const parent_parser = new ArgumentParser({ addHelp: false });
// note addHelp:false to prevent duplication of the -h option
parent_parser.addArgument(
['--parent'],
{ type: 'int', help: 'parent' }
['--parent'],
{ type: 'int', help: 'parent' }
);
var foo_parser = new ArgumentParser({
parents: [parent_parser],
description: 'child1'
const foo_parser = new ArgumentParser({
parents: [parent_parser],
description: 'child1'
});
foo_parser.addArgument(['foo']);
args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
console.log(args);
var bar_parser = new ArgumentParser({
parents: [parent_parser],
description: 'child2'
const bar_parser = new ArgumentParser({
parents: [parent_parser],
description: 'child2'
});
bar_parser.addArgument(['--bar']);
args = bar_parser.parseArgs(['--bar', 'YYY']);
console.log(args);
var prefixCharsExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: prefix_chars',
prefixChars: '-+'
const prefixCharsExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: prefix_chars',
prefixChars: '-+'
});
prefixCharsExample.addArgument(['+f', '++foo']);
prefixCharsExample.addArgument(['++bar'], { action: 'storeTrue' });
@@ -193,39 +177,36 @@ console.dir(args);
args = prefixCharsExample.parseArgs(['++foo', '2', '++bar']);
console.dir(args);
var subparserExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: sub-commands'
const subparserExample = new ArgumentParser({
version: '0.0.1',
addHelp: true,
description: 'Argparse examples: sub-commands'
});
var subparsers = subparserExample.addSubparsers({
title: 'subcommands',
dest: "subcommand_name"
const subparsers = subparserExample.addSubparsers({
title: 'subcommands',
dest: "subcommand_name"
});
var bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' });
let bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' });
bar.addArgument(
['-f', '--foo'],
{
action: 'store',
help: 'foo3 bar3'
}
['-f', '--foo'],
{
action: 'store',
help: 'foo3 bar3'
}
);
var bar = subparsers.addParser(
'c2',
{ aliases: ['co'], addHelp: true, help: 'c2 help' }
bar = subparsers.addParser(
'c2',
{ aliases: ['co'], addHelp: true, help: 'c2 help' }
);
bar.addArgument(
['-b', '--bar'],
{
action: 'store',
type: 'int',
help: 'foo3 bar3'
}
['-b', '--bar'],
{
action: 'store',
type: 'int',
help: 'foo3 bar3'
}
);
subparserExample.printHelp();
console.log('-----------');
@@ -241,66 +222,51 @@ console.dir(args);
console.log('-----------');
subparserExample.parseArgs(['c1', '-h']);
var functionExample = new ArgumentParser({ description: 'Process some integers.' });
const functionExample = new ArgumentParser({ description: 'Process some integers.' });
function sum(arr: number[]) {
return arr.reduce(function(a, b) {
return a + b;
}, 0);
return arr.reduce((a, b) => a + b, 0);
}
function max(arr: number[]) {
return Math.max.apply(Math, arr);
return Math.max.apply(Math, arr);
}
functionExample.addArgument(['integers'], {
metavar: 'N',
type: 'int',
nargs: '+',
help: 'an integer for the accumulator'
metavar: 'N',
type: 'int',
nargs: '+',
help: 'an integer for the accumulator'
});
functionExample.addArgument(['--sum'], {
dest: 'accumulate',
action: 'storeConst',
constant: sum,
defaultValue: max,
help: 'sum the integers (default: find the max)'
dest: 'accumulate',
action: 'storeConst',
constant: sum,
defaultValue: max,
help: 'sum the integers (default: find the max)'
});
args = functionExample.parseArgs('--sum 1 2 -1'.split(' '));
console.log(args.accumulate(args.integers));
var formatterExample = new ArgumentParser({
prog: 'PROG',
formatterClass: RawDescriptionHelpFormatter,
description: 'Keep the formatting\n' +
' exactly as it is written\n' +
'\n' +
'here\n'
const formatterExample = new ArgumentParser({
prog: 'PROG',
formatterClass: RawDescriptionHelpFormatter,
description: `Keep the formatting\nexactly as it is written\n\nhere\n`,
});
formatterExample.addArgument(['--foo'], {
help: ' foo help should not\n' +
' retain this odd formatting'
help: `foo help should not\nretain this odd formatting`,
});
formatterExample.addArgument(['spam'], {
'help': 'spam help'
help: 'spam help',
});
var group = formatterExample.addArgumentGroup({
title: 'title',
description: ' This text\n' +
' should be indented\n' +
' exactly like it is here\n'
const group = formatterExample.addArgumentGroup({
title: 'title',
description: `This text\nshould be indented\nexactly like it is here\n`,
});
group.addArgument(['--bar'], {
help: 'bar help'
help: 'bar help'
});
formatterExample.printHelp();
+28 -19
View File
@@ -1,31 +1,39 @@
// Type definitions for argparse v1.0.3
// Type definitions for argparse 1.0
// Project: https://github.com/nodeca/argparse
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
// Tomasz Łaziuk <https://github.com/tlaziuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export declare class ArgumentParser extends ArgumentGroup {
export class ArgumentParser extends ArgumentGroup {
constructor(options?: ArgumentParserOptions);
addSubparsers(options?: SubparserOptions): SubParser;
parseArgs(args?: string[], ns?: Namespace | Object): any;
parseArgs(args?: string[], ns?: Namespace | object): any;
printUsage(): void;
printHelp(): void;
formatUsage(): string;
formatHelp(): string;
parseKnownArgs(args?: string[], ns?: Namespace | Object): any[];
parseKnownArgs(args?: string[], ns?: Namespace | object): any[];
convertArgLineToArg(argLine: string): string[];
exit(status: number, message: string): void;
error(err: string | Error): void;
}
interface Namespace { }
export class Namespace {
constructor(options: object);
get<K extends keyof this, D extends any>(key: K, defaultValue?: D): this[K] | D;
isset<K extends keyof this>(key: K): boolean;
set<K extends keyof this, V extends this[K]>(key: K, value: V): this;
set<K extends string, V extends any>(key: K, value: V): this & Record<K, V>;
set<K extends object>(obj: K): this & K;
unset<K extends keyof this, D extends any>(key: K, defaultValue?: D): this[K] | D;
}
declare class SubParser {
export class SubParser {
addParser(name: string, options?: SubArgumentParserOptions): ArgumentParser;
}
declare class ArgumentGroup {
export class ArgumentGroup {
addArgument(args: string[], options?: ArgumentOptions): void;
addArgumentGroup(options?: ArgumentGroupOptions): ArgumentGroup;
addMutuallyExclusiveGroup(options?: { required: boolean }): ArgumentGroup;
@@ -33,7 +41,7 @@ declare class ArgumentGroup {
getDefault(dest: string): any;
}
interface SubparserOptions {
export interface SubparserOptions {
title?: string;
description?: string;
prog?: string;
@@ -44,12 +52,12 @@ interface SubparserOptions {
metavar?: string;
}
interface SubArgumentParserOptions extends ArgumentParserOptions {
export interface SubArgumentParserOptions extends ArgumentParserOptions {
aliases?: string[];
help?: string;
}
interface ArgumentParserOptions {
export interface ArgumentParserOptions {
description?: string;
epilog?: string;
addHelp?: boolean;
@@ -62,26 +70,27 @@ interface ArgumentParserOptions {
version?: string;
}
interface ArgumentGroupOptions {
export interface ArgumentGroupOptions {
prefixChars?: string;
argumentDefault?: any;
title?: string;
description?: string;
}
export declare class HelpFormatter { }
export declare class ArgumentDefaultsHelpFormatter { }
export declare class RawDescriptionHelpFormatter { }
export declare class RawTextHelpFormatter { }
export class HelpFormatter { }
export class ArgumentDefaultsHelpFormatter { }
export class RawDescriptionHelpFormatter { }
export class RawTextHelpFormatter { }
interface ArgumentOptions {
export interface ArgumentOptions {
action?: string;
optionStrings?: string[];
dest?: string;
nargs?: string | number;
constant?: any;
defaultValue?: any;
type?: string | Function;
// type may be a string (primitive) or a Function (constructor)
type?: string | Function; // tslint:disable-line:ban-types
choices?: string | string[];
required?: boolean;
help?: string;
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1 -1
View File
@@ -205,7 +205,7 @@ declare namespace autobahn {
type DeferFactory = () => When.Promise<any>;
type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise<string>;
type OnChallengeHandler = (session: Session, method: string, extra: any) => string;
interface IConnectionOptions {
use_es6_promises?: boolean;
+79 -55
View File
@@ -10,8 +10,12 @@ export { t as types };
export type Node = t.Node;
export import template = require('babel-template');
export const version: string;
import traverse, { Visitor } from "babel-traverse";
import traverse, { Visitor, NodePath } from "babel-traverse";
export { traverse, Visitor };
import { BabylonOptions } from "babylon";
export { BabylonOptions };
import { GeneratorOptions } from "babel-generator";
export { GeneratorOptions };
// A babel plugin is a simple function which must return an object matching
// the following interface. Babel will throw if it finds unknown properties.
@@ -38,14 +42,29 @@ export function transformFileSync(filename: string, opts?: TransformOptions): Ba
export function transformFromAst(ast: Node, code?: string, opts?: TransformOptions): BabelFileResult;
export interface TransformOptions {
/** Filename to use when reading from stdin - this will be used in source-maps, errors etc. Default: "unknown". */
filename?: string;
/** Include the AST in the returned object. Default: `true`. */
ast?: boolean;
/** Filename relative to `sourceRoot`. */
filenameRelative?: string;
/** Attach a comment after all non-user injected code. */
auxiliaryCommentAfter?: string;
/** A source map object that the output source map will be based on. */
inputSourceMap?: object;
/** Attach a comment before all non-user injected code. */
auxiliaryCommentBefore?: string;
/** Specify whether or not to use `.babelrc` and `.babelignore` files. Default: `true`. */
babelrc?: boolean;
/** Enable code generation. Default: `true`. */
code?: boolean;
/** write comments to generated output. Default: `true`. */
comments?: boolean;
/**
* Do not include superfluous whitespace characters and line terminators. When set to `"auto"`, `compact` is set to
* `true` on input sizes of >100KB.
*/
compact?: boolean | "auto";
/**
* This is an object of keys that represent different environments. For example, you may have:
@@ -55,38 +74,68 @@ export interface TransformOptions {
*/
env?: object;
/** Retain line numbers - will result in really ugly code. Default: `false` */
retainLines?: boolean;
/** A path to an .babelrc file to extend. */
extends?: string;
/** Filename to use when reading from stdin - this will be used in source-maps, errors etc. Default: "unknown". */
filename?: string;
/** Filename relative to `sourceRoot`. */
filenameRelative?: string;
/** An object containing the options to be passed down to the babel code generator, babel-generator. Default: `{}` */
generatorOpts?: GeneratorOptions;
/**
* Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`.
* If falsy value is returned then the generated module id is used.
*/
getModuleId?(moduleName: string): string;
/** Enable/disable ANSI syntax highlighting of code frames. Default: `true`. */
highlightCode?: boolean;
/** List of presets (a set of plugins) to load and use. */
presets?: any[];
/** List of plugins to load and use. */
plugins?: any[];
/** list of glob paths to **not** compile. Opposite to the `only` option. */
ignore?: string[];
/** A source map object that the output source map will be based on. */
inputSourceMap?: object;
/** Should the output be minified. Default: `false` */
minified?: boolean;
/** Specify a custom name for module ids. */
moduleId?: string;
/**
* If truthy, insert an explicit id for modules. By default, all modules are anonymous.
* (Not available for `common` modules).
*/
moduleIds?: boolean;
/** Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. */
moduleRoot?: string;
/**
* A glob, regex, or mixed array of both, matching paths to only compile. Can also be an array of arrays containing
* paths to explicitly match. When attempting to compile a non-matching file it's returned verbatim.
*/
only?: string | RegExp | Array<string | RegExp>;
/** Enable code generation. Default: `true`. */
code?: boolean;
/** Babylon parser options. */
parserOpts?: BabylonOptions;
/** Include the AST in the returned object. Default: `true`. */
ast?: boolean;
/** List of plugins to load and use. */
plugins?: any[];
/** A path to an .babelrc file to extend. */
extends?: string;
/** List of presets (a set of plugins) to load and use. */
presets?: any[];
/** write comments to generated output. Default: `true`. */
comments?: boolean;
/** Retain line numbers - will result in really ugly code. Default: `false` */
retainLines?: boolean;
/** Resolve a module source ie. import "SOURCE"; to a custom value. */
resolveModuleSource?(source: string, filename: string): string;
/**
* An optional callback that controls whether a comment should be output or not. Called as
@@ -94,11 +143,8 @@ export interface TransformOptions {
*/
shouldPrintComment?(comment: string): boolean;
/**
* Do not include superfluous whitespace characters and line terminators. When set to `"auto"`, `compact` is set to
* `true` on input sizes of >100KB.
*/
compact?: boolean | "auto";
/** Set `sources[0]` on returned source map. */
sourceFileName?: string;
/**
* If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a `sourceMappingURL`
@@ -110,38 +156,16 @@ export interface TransformOptions {
/** Set `file` on returned source map. */
sourceMapTarget?: string;
/** Set `sources[0]` on returned source map. */
sourceFileName?: string;
/** The root from which all sources are relative. */
sourceRoot?: string;
/** Specify whether or not to use `.babelrc` and `.babelignore` files. Default: `true`. */
babelrc?: boolean;
/** Indicate the mode the code should be parsed in. Can be either “script” or “module. Default: "module" */
sourceType?: "script" | "module";
/** Attach a comment before all non-user injected code. */
auxiliaryCommentBefore?: string;
/** Attach a comment after all non-user injected code. */
auxiliaryCommentAfter?: string;
/**
* Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`.
* If falsy value is returned then the generated module id is used.
/** An optional callback that can be used to wrap visitor methods.
* NOTE: This is useful for things like introspection, and not really needed for implementing anything.
*/
getModuleId?(moduleName: string): string;
/** Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. */
moduleRoot?: string;
/**
* If truthy, insert an explicit id for modules. By default, all modules are anonymous.
* (Not available for `common` modules).
*/
moduleIds?: boolean;
/** Specify a custom name for module ids. */
moduleId?: string;
wrapPluginVisitorMethod?(pluginAlias: string, visitorType: 'enter' | 'exit', callback: (path: NodePath, state: any) => void): (path: NodePath, state: any) => void ;
}
export interface BabelFileResult {
@@ -0,0 +1,4 @@
// $ExpectType any
pug`
p Hello pug!
`;
+6
View File
@@ -0,0 +1,6 @@
// Type definitions for babel-plugin-react-pug 0.5
// Project: https://github.com/ljbc1994/babel-plugin-react-pug
// Definitions by: John Papandriopoulos <https://github.com/jpap>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var pug: any;
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"babel-plugin-react-pug-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -6,12 +6,12 @@ class DestroyWarn extends Marionette.Behavior {
// just like you can in your Backbone Models
// they will be overriden if you pass in an option with the same key
defaults = {
"message": "you are destroying!"
message: 'you are destroying!'
};
// behaviors have events that are bound to the views DOM
events = {
"click @ui.destroy": "warnBeforeDestroy"
'click @ui.destroy': 'warnBeforeDestroy'
};
warnBeforeDestroy() {
@@ -22,34 +22,32 @@ class DestroyWarn extends Marionette.Behavior {
}
}
Marionette.Behaviors.getBehaviorClass = (options, key) => {
if (key === "DestroyWarn")
if (key === 'DestroyWarn')
return DestroyWarn;
return undefined;
};
class MyRouter extends Marionette.AppRouter {
// "someMethod" must exist at controller.someMethod
// 'someMethod' must exist at controller.someMethod
appRoutes = {
"some/route": "someMethod"
'some/route': 'someMethod'
};
/* standard routes can be mixed with appRoutes/Controllers above */
routes = {
"some/otherRoute": "someOtherMethod"
'some/otherRoute': 'someOtherMethod'
};
someOtherMethod() {
// do something here.
}
}
class MyApplication extends Marionette.Application {
initialize(options?: any) {
console.log("initializing application");
console.log('initializing application');
this.layoutView = new AppLayoutView();
}
@@ -60,12 +58,16 @@ class MyApplication extends Marionette.Application {
this.mainRegion = new Marionette.Region({ el: '#main' });
this.layoutView.addRegion('main', this.mainRegion);
this.layoutView.render();
this.layoutView.showChildView('main', new MyView(new MyModel));
this.layoutView.showChildView('main', new MyView(new MyModel()));
let view: Backbone.View<Backbone.Model> = this.layoutView.getChildView('main');
let regions: {[key: string]: Marionette.Region} = this.layoutView.getRegions();
let prefix: string = this.layoutView.childViewEventPrefix;
let region: Marionette.Region = this.layoutView.removeRegion('main');
let layout: Marionette.View<Backbone.Model> = this.layoutView.destroy();
let prefix: string;
if (typeof this.layoutView.childViewEventPrefix === 'string') {
this.layoutView.childViewEventPrefix;
}
}
}
@@ -75,16 +77,15 @@ class AppLayoutView extends Marionette.View<Backbone.Model> {
}
template() {
return "<div id='main'></div>";
return '<div id="main"></div>';
}
initialize(options?: any) {
console.log("initializing layoutview");
console.log('initializing layoutview');
}
}
class MyModel extends Backbone.Model {
constructor(options?: any) {
super(options);
}
@@ -99,22 +100,20 @@ class MyModel extends Backbone.Model {
}
class MyBaseView extends Marionette.View<MyModel> {
constructor() {
super();
this.getOption<string>('foo');
this.triggers = {
'click .foo': 'bar'
};
super();
this.getOption('foo');
this.triggers = {
'click .foo': 'bar'
};
}
}
class MyView extends Marionette.View<MyModel> {
behaviors: any;
constructor(model: MyModel) {
super({ model: model });
super({ model });
this.ui = {
destroy: '.destroy'
@@ -130,8 +129,7 @@ class MyView extends Marionette.View<MyModel> {
template() {
return '<h1>' + this.model.getName() + '</h1> <button class="destroy">Destroy Me</button>';
}
};
}
class MainRegion extends Marionette.Region {
constructor() {
@@ -140,7 +138,6 @@ class MainRegion extends Marionette.Region {
}
}
class MyObject extends Marionette.Object {
name: string;
options: any;
@@ -153,13 +150,13 @@ class MyObject extends Marionette.Object {
name: 'Foo'
};
this.on("before:destroy", () => {
console.log("before:destroy");
this.on('before:destroy', () => {
console.log('before:destroy');
});
}
onBeforeDestroy(arg: any) {
console.log("in onBeforeDestroy with arg " + arg);
console.log('in onBeforeDestroy with arg ' + arg);
}
}
@@ -180,7 +177,7 @@ class MyJQueryRegion extends Marionette.Region {
class MyHtmlElRegion extends Marionette.Region {
constructor() {
super();
this.el = document.querySelector("body");
this.el = document.querySelector('body');
}
}
@@ -189,77 +186,48 @@ class MyCollectionView extends Marionette.CollectionView<MyModel, MyView> {
super();
this.childView = MyView;
this.childViewEvents = {
render: function () {
console.log("a childView has been rendered");
render() {
console.log('a childView has been rendered');
}
};
this.childViewOptions = function (model: any, index: any): any {
this.childViewOptions = (model: any, index: any): any => {
// do some calculations based on the model
return {
foo: "bar",
childIndex: index
}
id: 'bar'
};
};
this.childViewOptions = {
foo: "bar"
id: 'bar'
};
this.childViewEventPrefix = "some:prefix";
this.on('some:prefix:render', function () {
this.childViewEventPrefix = 'some:prefix';
this.on('some:prefix:render', () => {
});
}
}
var app: MyApplication;
let app: MyApplication;
function ApplicationTests() {
app = new MyApplication();
app.start();
var view = new MyView(new MyModel());
let view = new MyView(new MyModel());
app.mainRegion.show(view);
}
function ObjectTests() {
var obj = new MyObject();
let obj = new MyObject();
console.log(obj.getOption('name'));
obj.destroy("goodbye");
}
function RegionManagerTests() {
var rm = new Marionette.RegionManager();
rm.addRegions({
contentRegion: {
el: '#content',
regionClass: MainRegion
},
navigationRegion: {
el: '#navigation',
regionClass: MainRegion,
// Options passed to instance of `MyOtherRegion` for
// the `navigationRegion` on `App`
navigationOption: 42,
anotherNavigationOption: 'foo'
},
footerRegion: {
regionClass: MainRegion,
someOption: 42,
someValue: 'value'
}
});
obj.destroy('goodbye');
}
function RegionTests() {
var myView: Marionette.View<MyModel> = new MyView(new MyModel());
let myView: Marionette.View<MyModel> = new MyView(new MyModel());
// render and display the view
app.mainRegion.show(myView);
@@ -268,28 +236,27 @@ function RegionTests() {
app.mainRegion.empty();
myView = new MyView(new MyModel());
app.mainRegion.show(myView, { preventDestroy: true, forceShow: true, triggerAttach: true, triggerBeforeAttach: false });
app.mainRegion.show(myView, { preventDestroy: true });
var hasView: boolean = app.mainRegion.hasView();
let hasView: boolean = app.mainRegion.hasView();
app.mainRegion.reset();
Marionette.Region.prototype.attachHtml = function (view: any): void {
Marionette.Region.prototype.attachHtml = (view: any): void => {
this.$el.empty().append(view.el);
}
};
myView = new Marionette.View<MyModel>({
el: $("#existing-view-stuff")
el: $('#existing-view-stuff')
});
app.mainRegion.attachView(myView);
app.mainRegion.show(myView);
app.mainRegion.on("empty", function (view: any, region: any, options: any) {
app.mainRegion.on('empty', (view: any, region: any, options: any) => {
// manipulate the `view` or do something extra
// with the `region`
// you also have access to the `options` that were passed to the Region.show call
});
}
function ViewTests() {
@@ -301,29 +268,27 @@ function ViewTests() {
}
function CollectionViewTests() {
var cv = new MyCollectionView();
let cv = new MyCollectionView();
cv.collection.add(new MyModel());
app.mainRegion.attachView(cv);
cv.addEmptyView(new MyModel, MyView);
cv.proxyChildEvents(new MyView(new MyModel));
let children: Backbone.ChildViewContainer<Marionette.View<Backbone.Model>> = cv.destroyChildren();
let view: Marionette.CollectionView<Backbone.Model, Marionette.View<Backbone.Model>> = cv.destroy();
app.mainRegion.show(cv);
cv.emptyView = MyView;
let view: Marionette.CollectionView<MyModel, MyView> = cv.destroy();
}
class MyController extends Marionette.Controller {
class MyController {
doFoo() { }
doBar() { }
}
function AppRouterTests() {
var myController = new MyController();
var router = new MyRouter();
let myController = new MyController();
let router = new MyRouter();
router.appRoute("/foo", "fooThat");
router.appRoute('/foo', 'fooThat');
router.processAppRoutes(myController, {
"foo": "doFoo",
"bar/:id": "doBar"
foo: 'doFoo',
'bar/:id': 'doBar'
});
}
+1196 -958
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+4 -2
View File
@@ -589,8 +589,10 @@ Promise.props({ num: 1, str: Promise.resolve('a') }).then(val => { propsValue =
Promise.props(Promise.props({ num: 1, str: Promise.resolve('a') })).then(val => { propsValue = val });
var propsMapValue: Map<number, string>;
Promise.resolve(new Map<number, Promise<string>>()).props().then(val => { propsMapValue = val });
Promise.props(new Map<number, Promise<string>>()).then(val => { propsMapValue = val });
Promise.resolve(new Map<number, string>()).props().then(val => { propsMapValue = val });
Promise.resolve(new Map<number, PromiseLike<string>>()).props().then(val => { propsMapValue = val });
Promise.props(new Map<number, string>()).then(val => { propsMapValue = val });
Promise.props(new Map<number, PromiseLike<string>>()).then(val => { propsMapValue = val });
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+8 -8
View File
@@ -46,7 +46,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
* Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
*/
// Based on PromiseLike.then, but returns a Bluebird instance.
then<U>(onFulfill?: (value: R) => U | Bluebird.Thenable<U>, onReject?: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U>; // For simpler signature help.
then<U>(onFulfill?: (value: R) => U | PromiseLike<U>, onReject?: (error: any) => U | PromiseLike<U>): Bluebird<U>; // For simpler signature help.
then<TResult1 = R, TResult2 = never>(onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Bluebird<TResult1 | TResult2>;
/**
@@ -620,7 +620,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
/**
* Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
*/
props<K, V>(this: PromiseLike<Map<K, Bluebird.Thenable<V> | V>>): Bluebird<Map<K, V>>;
props<K, V>(this: PromiseLike<Map<K, PromiseLike<V> | V>>): Bluebird<Map<K, V>>;
props<T>(this: PromiseLike<Bluebird.ResolvableProps<T>>): Bluebird<T>;
/**
@@ -749,12 +749,12 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
*
* If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`.
*/
static promisify<T>(func: (callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): () => Bluebird<T>;
static promisify<T, A1>(func: (arg1: A1, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1) => Bluebird<T>;
static promisify<T, A1, A2>(func: (arg1: A1, arg2: A2, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2) => Bluebird<T>;
static promisify<T, A1, A2, A3>(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<T>;
static promisify<T, A1, A2, A3, A4>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<T>;
static promisify<T, A1, A2, A3, A4, A5>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<T>;
static promisify<T>(func: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): () => Bluebird<T>;
static promisify<T, A1>(func: (arg1: A1, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1) => Bluebird<T>;
static promisify<T, A1, A2>(func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2) => Bluebird<T>;
static promisify<T, A1, A2, A3>(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3) => Bluebird<T>;
static promisify<T, A1, A2, A3, A4>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird<T>;
static promisify<T, A1, A2, A3, A4, A5>(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird<T>;
static promisify(nodeFunction: Function, options?: Bluebird.PromisifyOptions): Function;
/**
+2 -2
View File
@@ -1,13 +1,13 @@
// Type definitions for bootstrap.timepicker
// Project: https://github.com/jdewit/bootstrap-timepicker
// Definitions by: derikwhittaker <https://github.com/derikwhittaker>
// Definitions by: derikwhittaker <https://github.com/derikwhittaker>, Heather Booker <https://github.com/heatherbooker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery"/>
interface TimepickerOptions {
defaultTime?: string|boolean;
defaultTime?: string|boolean|Date;
disableFocus?: boolean;
disableMousewheel?: boolean;
explicitMode?: boolean;
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
@@ -26,6 +26,7 @@ thenableNum = chai.expect(thenableNum).to.notify(() => console.log('done'));
// BDD API (should)
thenableNum = thenableNum.should.be.fulfilled;
thenableNum = thenableNum.should.eventually.deep.equal(3);
thenableNum = thenableNum.should.eventually.become(3);
thenableNum = thenableNum.should.become(3);
thenableNum = thenableNum.should.be.rejected;
thenableNum = thenableNum.should.be.rejectedWith(Error);
+132 -11
View File
@@ -1,6 +1,10 @@
// Type definitions for chai-as-promised
// Type definitions for chai-as-promised 7.1.0
// Project: https://github.com/domenic/chai-as-promised/
// Definitions by: jt000 <https://github.com/jt000>, Yuki Kokubun <https://github.com/Kuniwak>, Leonard Thieu <https://github.com/leonard-thieu>
// Definitions by: jt000 <https://github.com/jt000>,
// Yuki Kokubun <https://github.com/Kuniwak>,
// Leonard Thieu <https://github.com/leonard-thieu>,
// Mike Lazer-Walker <https://github.com/lazerwalker>,
// Matt Bishop <https://github.com/mattbishop>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
@@ -25,22 +29,25 @@ declare namespace Chai {
become(expected: any): PromisedAssertion;
fulfilled: PromisedAssertion;
rejected: PromisedAssertion;
rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion;
rejectedWith: PromisedThrow;
notify(fn: Function): PromisedAssertion;
}
// Eventually does not have .then(), but PromisedAssertion have.
interface Eventually extends PromisedLanguageChains, PromisedNumericComparison, PromisedTypeComparison {
// From chai-as-promised
become(expected: PromiseLike<any>): PromisedAssertion;
become(expected: any): PromisedAssertion;
fulfilled: PromisedAssertion;
rejected: PromisedAssertion;
rejectedWith(expected: any, message?: string | RegExp): PromisedAssertion;
rejectedWith: PromisedThrow;
notify(fn: Function): PromisedAssertion;
// From chai
not: PromisedAssertion;
deep: PromisedDeep;
ordered: PromisedOrdered;
nested: PromisedNested;
any: PromisedKeyFilter;
all: PromisedKeyFilter;
a: PromisedTypeComparison;
an: PromisedTypeComparison;
@@ -51,6 +58,7 @@ declare namespace Chai {
false: PromisedAssertion;
null: PromisedAssertion;
undefined: PromisedAssertion;
NaN: PromisedAssertion;
exist: PromisedAssertion;
empty: PromisedAssertion;
arguments: PromisedAssertion;
@@ -63,20 +71,36 @@ declare namespace Chai {
property: PromisedProperty;
ownProperty: PromisedOwnProperty;
haveOwnProperty: PromisedOwnProperty;
ownPropertyDescriptor: PromisedOwnPropertyDescriptor;
haveOwnPropertyDescriptor: PromisedOwnPropertyDescriptor;
length: PromisedLength;
lengthOf: PromisedLength;
match(regexp: RegExp | string, message?: string): PromisedAssertion;
match: PromisedMatch;
matches: PromisedMatch;
string(string: string, message?: string): PromisedAssertion;
keys: PromisedKeys;
key(string: string): PromisedAssertion;
throw: PromisedThrow;
throws: PromisedThrow;
Throw: PromisedThrow;
respondTo(method: string, message?: string): PromisedAssertion;
respondTo: PromisedRespondTo;
respondsTo: PromisedRespondTo;
itself: PromisedAssertion;
satisfy(matcher: Function, message?: string): PromisedAssertion;
closeTo(expected: number, delta: number, message?: string): PromisedAssertion;
satisfy: PromisedSatisfy;
satisfies: PromisedSatisfy;
closeTo: PromisedCloseTo;
approximately: PromisedCloseTo;
members: PromisedMembers;
increase: PromisedPropertyChange;
increases: PromisedPropertyChange;
decrease: PromisedPropertyChange;
decreases: PromisedPropertyChange;
change: PromisedPropertyChange;
changes: PromisedPropertyChange;
extensible: PromisedAssertion;
sealed: PromisedAssertion;
frozen: PromisedAssertion;
oneOf(list: any[], message?: string): PromisedAssertion;
}
interface PromisedAssertion extends Eventually, PromiseLike<any> {
@@ -99,6 +123,8 @@ declare namespace Chai {
at: PromisedAssertion;
of: PromisedAssertion;
same: PromisedAssertion;
but: PromisedAssertion;
does: PromisedAssertion;
}
interface PromisedNumericComparison {
@@ -129,10 +155,28 @@ declare namespace Chai {
(constructor: Object, message?: string): PromisedAssertion;
}
interface PromisedDeep {
equal: PromisedEqual;
interface PromisedCloseTo {
(expected: number, delta: number, message?: string): PromisedAssertion;
}
interface PromisedNested {
include: PromisedInclude;
property: PromisedProperty;
members: PromisedMembers;
}
interface PromisedDeep {
equal: PromisedEqual;
equals: PromisedEqual;
eq: PromisedEqual;
include: PromisedInclude;
property: PromisedProperty;
members: PromisedMembers;
ordered: PromisedOrdered
}
interface PromisedOrdered {
members: PromisedMembers;
}
interface PromisedKeyFilter {
@@ -151,6 +195,11 @@ declare namespace Chai {
(name: string, message?: string): PromisedAssertion;
}
interface PromisedOwnPropertyDescriptor {
(name: string, descriptor: PropertyDescriptor, message?: string): PromisedAssertion;
(name: string, message?: string): PromisedAssertion;
}
interface PromisedLength extends PromisedLanguageChains, PromisedNumericComparison {
(length: number, message?: string): PromisedAssertion;
}
@@ -160,13 +209,21 @@ declare namespace Chai {
(value: string, message?: string): PromisedAssertion;
(value: number, message?: string): PromisedAssertion;
keys: PromisedKeys;
deep: PromisedDeep;
ordered: PromisedOrdered;
members: PromisedMembers;
any: PromisedKeyFilter;
all: PromisedKeyFilter;
}
interface PromisedMatch {
(regexp: RegExp | string, message?: string): PromisedAssertion;
}
interface PromisedKeys {
(...keys: string[]): PromisedAssertion;
(keys: any[]): PromisedAssertion;
(keys: Object): PromisedAssertion;
}
interface PromisedThrow {
@@ -179,10 +236,22 @@ declare namespace Chai {
(constructor: Function, expected?: RegExp, message?: string): PromisedAssertion;
}
interface PromisedRespondTo {
(method: string, message?: string): PromisedAssertion;
}
interface PromisedSatisfy {
(matcher: Function, message?: string): PromisedAssertion;
}
interface PromisedMembers {
(set: any[], message?: string): PromisedAssertion;
}
interface PromisedPropertyChange {
(object: Object, property: string, message?: string): PromisedAssertion;
}
// For Assert API
interface Assert {
eventually: PromisedAssert;
@@ -198,7 +267,9 @@ declare namespace Chai {
export interface PromisedAssert {
fail(actual?: any, expected?: any, msg?: string, operator?: string): PromiseLike<void>;
isOk(val: any, msg?: string): PromiseLike<void>;
ok(val: any, msg?: string): PromiseLike<void>;
isNotOk(val: any, msg?: string): PromiseLike<void>;
notOk(val: any, msg?: string): PromiseLike<void>;
equal(act: any, exp: any, msg?: string): PromiseLike<void>;
@@ -210,12 +281,26 @@ declare namespace Chai {
deepEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
notDeepEqual(act: any, exp: any, msg?: string): PromiseLike<void>;
isAbove(val: number, above: number, msg?: string): PromiseLike<void>;
isAtLeast(val: number, atLeast: number, msg?: string): PromiseLike<void>;
isAtBelow(val: number, below: number, msg?: string): PromiseLike<void>;
isAtMost(val: number, atMost: number, msg?: string): PromiseLike<void>;
isTrue(val: any, msg?: string): PromiseLike<void>;
isFalse(val: any, msg?: string): PromiseLike<void>;
isNotTrue(val: any, msg?: string): PromiseLike<void>;
isNotFalse(val: any, msg?: string): PromiseLike<void>;
isNull(val: any, msg?: string): PromiseLike<void>;
isNotNull(val: any, msg?: string): PromiseLike<void>;
isNaN(val: any, msg?: string): PromiseLike<void>;
isNotNaN(val: any, msg?: string): PromiseLike<void>;
exists(val: any, msg?: string): PromiseLike<void>;
notExists(val: any, msg?: string): PromiseLike<void>;
isUndefined(val: any, msg?: string): PromiseLike<void>;
isDefined(val: any, msg?: string): PromiseLike<void>;
@@ -287,10 +372,46 @@ declare namespace Chai {
operator(val: any, operator: string, val2: any, msg?: string): PromiseLike<void>;
closeTo(act: number, exp: number, delta: number, msg?: string): PromiseLike<void>;
approximately(act: number, exp: number, delta: number, msg?: string): PromiseLike<void>;
sameMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
sameDeepMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
sameOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
notSameOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
sameDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
notSameDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
includeOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
notIncludeOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
includeDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
notIncludeDeepOrderedMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
includeMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
includeDeepMembers(set1: any[], set2: any[], msg?: string): PromiseLike<void>;
oneOf(val: any, list: any[], msg?: string): PromiseLike<void>;
changes(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike<void>;
doesNotChange(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike<void>;
increases(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike<void>;
doesNotIncrease(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike<void>;
decreases(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike<void>;
doesNotDecrease(modifier: Function, obj: Object, property: string, msg?: string): PromiseLike<void>;
ifError(val: any, msg?: string): PromiseLike<void>;
isExtensible(obj: Object, msg?: string): PromiseLike<void>;
isNotExtensible(obj: Object, msg?: string): PromiseLike<void>;
isSealed(obj: Object, msg?: string): PromiseLike<void>;
sealed(obj: Object, msg?: string): PromiseLike<void>;
isNotSealed(obj: Object, msg?: string): PromiseLike<void>;
notSealed(obj: Object, msg?: string): PromiseLike<void>;
isFrozen(obj: Object, msg?: string): PromiseLike<void>;
frozen(obj: Object, msg?: string): PromiseLike<void>;
isNotFrozen(obj: Object, msg?: string): PromiseLike<void>;
notFrozen(obj: Object, msg?: string): PromiseLike<void>;
isEmpty(val: any, msg?: string): PromiseLike<void>;
isNotEmpty(val: any, msg?: string): PromiseLike<void>;
}
}
+1
View File
@@ -30,6 +30,7 @@ expect(wrapper).to.have.ref("test");
expect(wrapper).to.be.selected();
expect(wrapper).to.have.tagName("div");
expect(wrapper).to.have.text("");
expect(wrapper).to.contain.text("");
expect(wrapper).to.have.type(Test);
expect(wrapper).to.have.value("test");
expect(wrapper).to.have.attr("test", "test");
+6
View File
@@ -26,6 +26,12 @@ declare namespace Chai {
* @param code
*/
(selector: EnzymeSelector): Assertion;
/**
* Assert that the given wrapper has the supplied text:
* @param str
*/
text(str?: string): Assertion;
}
interface Assertion {
/**
+10
View File
@@ -41,6 +41,16 @@ chai.request(app)
.get('/search')
.query({ name: 'foo', limit: 10 });
chai.request(app)
.get('/download')
.buffer()
.parse((res, cb) => {
let data = '';
res.setEncoding('binary');
res.on('data', (chunk: any) => { data += chunk; });
res.on('end', () => { cb(undefined, new Buffer(data, 'binary')); });
});
chai.request(app)
.put('/user/me')
.send({ passsword: '123', confirmPassword: '123' })
+3
View File
@@ -49,6 +49,8 @@ declare global {
type: string;
status: number;
text: string;
setEncoding(encoding: string): void;
on(event: string, fn: (...args: any[]) => void): void;
}
interface Request extends FinishedRequest {
@@ -59,6 +61,7 @@ declare global {
auth(user: string, name: string): Request;
field(name: string, val: string): Request;
buffer(): Request;
parse(fn: (res: Response, cb: (e?: Error, r?: any) => void) => void): Request;
end(callback?: (err: any, res: Response) => void): FinishedRequest;
}
+21 -11
View File
@@ -4,15 +4,14 @@
// Fabien Lavocat <https://github.com/FabienLavocat>
// KentarouTakeda <https://github.com/KentarouTakeda>
// Larry Bahr <https://github.com/larrybahr>
// Daniel Luz <https://github.com/mernen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
declare class Chart {
static readonly Chart: typeof Chart;
constructor(
context: string | JQuery | CanvasRenderingContext2D | HTMLCanvasElement | string[] | CanvasRenderingContext2D[] | HTMLCanvasElement[],
context: string | CanvasRenderingContext2D | HTMLCanvasElement | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement>,
options: Chart.ChartConfiguration
);
config: Chart.ChartConfiguration;
@@ -83,6 +82,8 @@ declare namespace Chart {
type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear';
type PointStyle = 'circle' | 'cross' | 'crossRot' | 'dash' | 'line' | 'rect' | 'rectRounded' | 'rectRot' | 'star' | 'triangle';
type PositionType = 'left' | 'right' | 'top' | 'bottom';
interface ChartArea {
@@ -175,7 +176,7 @@ declare namespace Chart {
interface ChartTitleOptions {
display?: boolean;
position?: string;
position?: PositionType;
fullWdith?: boolean;
fontSize?: number;
fontFamily?: string;
@@ -187,10 +188,12 @@ declare namespace Chart {
interface ChartLegendOptions {
display?: boolean;
position?: string;
position?: PositionType;
fullWidth?: boolean;
onClick?(event: any, legendItem: any): void;
onClick?(event: MouseEvent, legendItem: ChartLegendItem): void;
onHover?(event: MouseEvent, legendItem: ChartLegendItem): void;
labels?: ChartLegendLabelOptions;
reverse?: boolean;
}
interface ChartLegendLabelOptions {
@@ -293,7 +296,7 @@ declare namespace Chart {
interface ChartPointOptions {
radius?: number;
pointStyle?: string;
pointStyle?: PointStyle;
backgroundColor?: ChartColor;
borderWidth?: number;
borderColor?: ChartColor;
@@ -332,6 +335,7 @@ declare namespace Chart {
interface TickOptions {
autoSkip?: boolean;
autoSkipPadding?: boolean;
callback?(value: any, index: any, values: any): string|number;
display?: boolean;
fontColor?: ChartColor;
@@ -386,7 +390,7 @@ declare namespace Chart {
type ChartColor = string | CanvasGradient | CanvasPattern | string[];
interface ChartDataSets {
cubicInterpolationMode?: string;
cubicInterpolationMode?: 'default' | 'monotone';
backgroundColor?: ChartColor | ChartColor[];
borderWidth?: number;
borderColor?: ChartColor;
@@ -394,10 +398,15 @@ declare namespace Chart {
borderDash?: number[];
borderDashOffset?: number;
borderJoinStyle?: string;
borderSkipped?: PositionType;
data?: number[] | ChartPoint[];
fill?: boolean;
fill?: boolean | number | string;
hoverBackgroundColor?: string | string[];
hoverBorderColor?: string | string[];
hoverBorderWidth?: number | number[];
label?: string;
lineTension?: number;
steppedLine?: 'before' | 'after' | boolean;
pointBorderColor?: ChartColor | ChartColor[];
pointBackgroundColor?: ChartColor | ChartColor[];
pointBorderWidth?: number | number[];
@@ -407,14 +416,15 @@ declare namespace Chart {
pointHoverBackgroundColor?: ChartColor | ChartColor[];
pointHoverBorderColor?: ChartColor | ChartColor[];
pointHoverBorderWidth?: number | number[];
pointStyle?: string | string[] | HTMLImageElement | HTMLImageElement[];
pointStyle?: PointStyle | HTMLImageElement | Array<PointStyle | HTMLImageElement>;
xAxisID?: string;
yAxisID?: string;
type?: string;
hidden?: boolean;
hideInLegendAndTooltip?: boolean;
showLine?: boolean;
stack?: string;
spanGaps?: string;
spanGaps?: boolean;
}
interface ChartScales {
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+29
View File
@@ -0,0 +1,29 @@
import * as counterpart from 'counterpart';
counterpart('translation.to.be.used');
counterpart(['translation', 'to', 'be', 'used']);
counterpart.setSeparator('*');
counterpart.onTranslationNotFound((locale: string, key: string, fallback: string, scope: string) => {});
counterpart.offTranslationNotFound((locale: string, key: string, fallback: string, scope: string) => {});
counterpart.setMissingEntryGenerator((value: string) => {});
counterpart.setLocale('es');
counterpart.getLocale();
counterpart.onLocaleChange((newLocale: string, oldLocale: string) => {});
counterpart.offLocaleChange((newLocale: string, oldLocale: string) => {});
counterpart.setFallbackLocale('es');
counterpart.registerTranslations('es', { hello: 'Hola' });
counterpart.registerInterpolations({ library: 'Counterpart' });
counterpart.setKeyTransformer((value: string, options: object) => {
return value.toUpperCase();
});
counterpart.localize(new Date(), { format: 'short' });
+32
View File
@@ -0,0 +1,32 @@
// Type definitions for counterpart 0.18
// Project: https://github.com/martinandert/counterpart
// Definitions by: santiagodoldan <https://github.com/santiagodoldan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
type NotFoundHandler = (locale: string, key: string, fallback: string, scope: string) => void;
type LocaleChangeHandler = (newLocale: string, oldLocale: string) => void;
interface Counterpart {
(key: string|string[], options?: object): string;
setSeparator(value: string): string;
onTranslationNotFound(callback: NotFoundHandler): void;
offTranslationNotFound(callback: NotFoundHandler): void;
setMissingEntryGenerator(callback: (value: string) => void): void;
getLocale(): string;
setLocale(value: string): string;
onLocaleChange(callback: LocaleChangeHandler): void;
offLocaleChange(callback: LocaleChangeHandler): void;
setFallbackLocale(value: string|string[]): void;
registerTranslations(locale: string, data: object): void;
registerInterpolations(data: object): void;
setKeyTransformer(callback: (value: string, options: object) => string): string;
localize(date: Date, options: object): string;
Instance: Counterpart;
Translator: Counterpart;
}
declare var counterpart: Counterpart;
export = counterpart;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"counterpart-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+5 -1
View File
@@ -1,4 +1,8 @@
{
"extends": "dtslint/dt.json",
"no-any-union": false
"no-any-union": false,
"rules": {
"no-any-union": false,
"no-unnecessary-generics": false
}
}
+7 -1
View File
@@ -1 +1,7 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-any-union": false,
"no-unnecessary-generics": false
}
}
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
@@ -33,6 +33,16 @@ const RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
const RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
const Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66)
const schemeBrBG: string = d3ScaleChromatic.schemeBrBG[3][0]; // #d8b365
const schemePRGn: string = d3ScaleChromatic.schemePRGn[3][0]; // #af8dc3
const schemePiYG: string = d3ScaleChromatic.schemePiYG[3][0]; // #e9a3c9
const schemePuOr: string = d3ScaleChromatic.schemePuOr[3][0]; // #998ec3
const schemeRdBu: string = d3ScaleChromatic.schemeRdBu[3][0]; // #ef8a62
const schemeRdGy: string = d3ScaleChromatic.schemeRdGy[3][0]; // #ef8a62
const schemeRdYlBu: string = d3ScaleChromatic.schemeRdYlBu[3][0]; // #fc8d59
const schemeRdYlGn: string = d3ScaleChromatic.schemeRdYlGn[3][0]; // #fc8d59
const schemeSpectral: string = d3ScaleChromatic.schemeSpectral[3][0]; // #fc8d59
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
@@ -43,6 +53,13 @@ const Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4
const Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125)
const Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13)
const schemeBlues: string = d3ScaleChromatic.schemeBlues[3][0]; // #deebf7
const schemeGreens: string = d3ScaleChromatic.schemeGreens[3][0]; // #e5f5e0
const schemeGreys: string = d3ScaleChromatic.schemeGreys[3][0]; // #f0f0f0
const schemeOranges: string = d3ScaleChromatic.schemeOranges[3][0]; // #fee6ce
const schemePurples: string = d3ScaleChromatic.schemePurples[3][0]; // #efedf5
const schemeReds: string = d3ScaleChromatic.schemeReds[3][0]; // #fee0d2
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
@@ -58,3 +75,16 @@ const YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88)
const YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41)
const YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6)
const YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38)
const schemeBuGn: string = d3ScaleChromatic.schemeBuGn[3][0]; // #e5f5f9
const schemeBuPu: string = d3ScaleChromatic.schemeBuPu[3][0]; // #e0ecf4
const schemeGnBu: string = d3ScaleChromatic.schemeGnBu[3][0]; // #e0f3db
const schemeOrRd: string = d3ScaleChromatic.schemeOrRd[3][0]; // #fee8c8
const schemePuBuGn: string = d3ScaleChromatic.schemePuBuGn[3][0]; // #ece2f0
const schemePuBu: string = d3ScaleChromatic.schemePuBu[3][0]; // #ece7f2
const schemePuRd: string = d3ScaleChromatic.schemePuRd[3][0]; // #e7e1ef
const schemeRdPu: string = d3ScaleChromatic.schemeRdPu[3][0]; // #fde0dd
const schemeYlGnBu: string = d3ScaleChromatic.schemeYlGnBu[3][0]; // #edf8b1
const schemeYlGn: string = d3ScaleChromatic.schemeYlGn[3][0]; // #f7fcb9
const schemeYlOrBr: string = d3ScaleChromatic.schemeYlOrBr[3][0]; // #fff7bc
const schemeYlOrRd: string = d3ScaleChromatic.schemeYlOrRd[3][0]; // #ffeda0
+226 -10
View File
@@ -1,6 +1,9 @@
// Type definitions for D3JS d3-scale-chromatic module 1.0
// Type definitions for D3JS d3-scale-chromatic module 1.1
// Project: https://github.com/d3/d3-scale-chromatic/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>,
// Alex Ford <https://github.com/gustavderdrache>,
// Boris Yankov <https://github.com/borisyankov>,
// Henrique Machado <https://github.com/henriquefm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.2
@@ -11,35 +14,35 @@
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemeAccent: string[];
export const schemeAccent: ReadonlyArray<string>;
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemeDark2: string[];
export const schemeDark2: ReadonlyArray<string>;
/**
* An array of twelve categorical colors represented as RGB hexadecimal strings.
*/
export const schemePaired: string[];
export const schemePaired: ReadonlyArray<string>;
/**
* An array of nine categorical colors represented as RGB hexadecimal strings.
*/
export const schemePastel1: string[];
export const schemePastel1: ReadonlyArray<string>;
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemePastel2: string[];
export const schemePastel2: ReadonlyArray<string>;
/**
* An array of nine categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet1: string[];
export const schemeSet1: ReadonlyArray<string>;
/**
* An array of eight categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet2: string[];
export const schemeSet2: ReadonlyArray<string>;
/**
* An array of twelve categorical colors represented as RGB hexadecimal strings.
*/
export const schemeSet3: string[];
export const schemeSet3: ReadonlyArray<string>;
// -----------------------------------------------------------------------
// Diverging
@@ -50,48 +53,112 @@ export const schemeSet3: string[];
* @param value Number in the range [0, 1].
*/
export function interpolateBrBG(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “BrBG” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBrBG[9] contains an array of nine strings representing the nine colors of the
* brown-blue-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeBrBG: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePRGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PRGn” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePRGn[9] contains an array of nine strings representing the nine colors of the
* purple-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemePRGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePiYG(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PiYG” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePiYG[9] contains an array of nine strings representing the nine colors of the
* pink-yellow-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemePiYG: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuOr(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuOr” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuOr[9] contains an array of nine strings representing the nine colors of the
* purple-orange diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemePuOr: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdBu” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdBu[9] contains an array of nine strings representing the nine colors of the
* red-blue diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdGy(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdGy” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdGy[9] contains an array of nine strings representing the nine colors of the
* red-grey diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdGy: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdYlBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdYlBu” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdYlBu[9] contains an array of nine strings representing the nine colors of the
* red-yellow-blue diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdYlBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdYlGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdYlGn” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdYlGn[9] contains an array of nine strings representing the nine colors of the
* red-yellow-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeRdYlGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string.
*
@@ -99,6 +166,13 @@ export function interpolateRdYlGn(value: number): string;
*/
export function interpolateSpectral(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Spectral” diverging color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeSpectral[9] contains an array of nine strings representing the nine colors of the
* spectral diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
*/
export const schemeSpectral: ReadonlyArray<ReadonlyArray<string>>;
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
@@ -108,30 +182,70 @@ export function interpolateSpectral(value: number): string;
* @param value Number in the range [0, 1].
*/
export function interpolateBlues(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Blues” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBlues[9] contains an array of nine strings representing the nine colors of the
* blue sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeBlues: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Greens” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateGreens(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Greens” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeGreens[9] contains an array of nine strings representing the nine colors of the
* green sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeGreens: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Greys” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateGreys(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Greys” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeGreys[9] contains an array of nine strings representing the nine colors of the
* grey sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeGreys: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Oranges” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateOranges(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Oranges” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeOranges[9] contains an array of nine strings representing the nine colors of the
* orange sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeOranges: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Purples” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePurples(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Purples” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePurples[9] contains an array of nine strings representing the nine colors of the
* purple sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePurples: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “Reds” sequential color scheme represented as an RGB string.
*
@@ -139,6 +253,13 @@ export function interpolatePurples(value: number): string;
*/
export function interpolateReds(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “Reds” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeReds[9] contains an array of nine strings representing the nine colors of the
* red sequential color scheme. Sequential, single-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeReds: ReadonlyArray<ReadonlyArray<string>>;
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
@@ -149,69 +270,164 @@ export function interpolateReds(value: number): string;
* @param value Number in the range [0, 1].
*/
export function interpolateBuGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “BuGn” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBuGn[9] contains an array of nine strings representing the nine colors of the
* blue-green sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeBuGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “BuPu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateBuPu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “BuPu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeBuPu[9] contains an array of nine strings representing the nine colors of the
* blue-purple sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeBuPu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “GnBu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateGnBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “GnBu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeGnBu[9] contains an array of nine strings representing the nine colors of the
* green-blue sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeGnBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “OrRd” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateOrRd(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “OrRd” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeOrRd[9] contains an array of nine strings representing the nine colors of the
* orange-red sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeOrRd: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuBuGn” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuBuGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuBuGn” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuBuGn[9] contains an array of nine strings representing the nine colors of the
* purple-blue-green sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePuBuGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuBu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuBu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuBu[9] contains an array of nine strings representing the nine colors of the
* purple-blue sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePuBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “PuRd” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolatePuRd(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “PuRd” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemePuRd[9] contains an array of nine strings representing the nine colors of the
* purple-red sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemePuRd: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “RdPu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateRdPu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “RdPu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeRdPu[9] contains an array of nine strings representing the nine colors of the
* red-purple sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeRdPu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlGnBu” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlGnBu(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlGnBu” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlGnBu[9] contains an array of nine strings representing the nine colors of the
* yellow-green-blue sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlGnBu: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlGn” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlGn(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlGn” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlGn[9] contains an array of nine strings representing the nine colors of the
* yellow-green sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlGn: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlOrBr” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlOrBr(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlOrBr” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlOrBr[9] contains an array of nine strings representing the nine colors of the
* yellow-orange-brown sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlOrBr: ReadonlyArray<ReadonlyArray<string>>;
/**
* Given a number t in the range [0,1], returns the corresponding color from the “YlOrRd” sequential color scheme represented as an RGB string.
*
* @param value Number in the range [0, 1].
*/
export function interpolateYlOrRd(value: number): string;
/**
* An array of arrays of hexadecimal color strings from the “YlOrRd” sequential color scheme. The kth element of this array contains
* the color scheme of size k; for example, d3.schemeYlOrRd[9] contains an array of nine strings representing the nine colors of the
* yellow-orange-red sequential color scheme. Sequential, multi-hue color schemes support a size k ranging from 3 to 9.
*/
export const schemeYlOrRd: ReadonlyArray<ReadonlyArray<string>>;
@@ -8,10 +8,20 @@ $(document).ready(function () {
extend: 'excel',
text: 'Excel',
className: 'class',
filename: "exported_file.csv",
exportOptions: {
columns: ':visible'
}
},
{
extend: 'excel',
text: 'Excel',
className: 'class',
filename: "exported_file.csv",
exportOptions: {
columns: [1, 6, 2, 3, 4]
}
},
{
action: function (e, dt, node, config) { },
available: function (dt, config) { return true; },
+6 -1
View File
@@ -86,6 +86,11 @@ declare namespace DataTables {
*/
title?: string;
/**
* Define what the exported filename should be
*/
filename?: string;
exportOptions?: ButtonExportOptions;
autoPrint?: boolean;
customize?: FunctionButtonCustomize;
@@ -95,7 +100,7 @@ declare namespace DataTables {
(dt: DataTables.Api, config: any): boolean
}
export interface ButtonExportOptions {
columns?: string;
columns?: string | number | string[] | number[];
}
export interface ButtonKey {
+19 -9
View File
@@ -1,19 +1,29 @@
import * as deepmerge from "deepmerge";
const x = {
foo: { bar: 3 },
array: [{ does: 'work', too: [1, 2, 3] }]
foo: { bar: 3 },
array: [{ does: 'work', too: [1, 2, 3] }]
};
const y = {
foo: { baz: 4 },
quux: 5,
array: [{ does: 'work', too: [4, 5, 6] }, { really: 'yes' }]
foo: { baz: 4 },
quux: 5,
array: [{ does: 'work', too: [4, 5, 6] }, { really: 'yes' }]
};
const expected = {
foo: { bar: 3, baz: 4 },
array: [{ does: 'work', too: [1, 2, 3, 4, 5, 6] }, { really: 'yes' }],
quux: 5
foo: { bar: 3, baz: 4 },
array: [{ does: 'work', too: [1, 2, 3, 4, 5, 6] }, { really: 'yes' }],
quux: 5
};
const result = deepmerge<any>(x, y);
const result = deepmerge(x, y);
const anyResult = deepmerge<any>(x, y);
function reverseConcat(dest: number[], src: number[]) {
return src.concat(dest);
}
const withOptions = deepmerge(x, y, {
clone: false,
arrayMerge: reverseConcat
});
+7 -4
View File
@@ -1,17 +1,20 @@
// Type definitions for deepmerge 1.3
// Project: https://github.com/KyleAMathews/deepmerge
// Definitions by: marvinscharle <https://github.com/marvinscharle>
// syy1125 <https://github.com/syy1125>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export = deepmerge;
declare function deepmerge<T>(x: T, y: T, options?: deepmerge.Options<T>): T;
declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, options?: deepmerge.Options): T;
declare function deepmerge<T1, T2>(x: T1, y: T2, options?: deepmerge.Options): T1 & T2;
declare namespace deepmerge {
interface Options<T> {
interface Options {
clone?: boolean;
arrayMerge?(destination: T, source: T, options?: Options<T>): T;
arrayMerge?(destination: any[], source: any[], options?: Options): any[];
}
function all<T>(objects: T[], options?: Options<T>): T;
function all<T>(objects: Array<Partial<T>>, options?: Options): T;
}
+26 -37
View File
@@ -1,52 +1,41 @@
import depd = require('depd');
var deprecate = depd("depd-tests");
const deprecate = depd("depd-tests");
function assert(condition: boolean, message: string): void {
if (!condition) {
throw new Error(message);
}
}
deprecate('message');
function testDepdMessage(...args: string[]): boolean {
if (arguments.length < 1) {
deprecate('testDepdMessage argument.lenth<1');
return true;
} else {
console.log('normal logic');
return false;
}
}
assert(testDepdMessage() === true, "Deprecated code must be triggered!");
assert(testDepdMessage('a') === false, "Deprecated code must be triggered!");
interface ITestObject {
p1: string;
p2: string;
}
var obj = <ITestObject>{ p1: 'deprecated property', p2: 'normal property' };
const obj = { p1: 'deprecated property', p2: 'normal property' };
deprecate.property(obj, 'p1', 'property [p1] is deprecated!');
deprecate.property(obj, 'p3', 'property [p3] is deprecated!'); // $ExpectError
console.log(obj.p1);
interface ITestDeprecatedFunction {
func1?: Function;
func2?: Function;
interface TestDeprecatedFunction {
func1?(): void;
func2?(arg: string): boolean;
}
const obj2 = <TestDeprecatedFunction> {};
var obj2 = <ITestDeprecatedFunction>{};
// message automatically derived from function name
obj2.func1 = deprecate.function(function func1() {
obj2.func1 = deprecate.function(() => {
console.log('all calls to [func1] are deprecated ');
});
// specific message
obj2.func2 = deprecate.function(function () {
// $ExpectError
obj2.func2 = deprecate.function(() => {
console.log('all calls to [func2] are deprecated ');
}, 'func2');
obj2.func2 = deprecate.function((arg: string) => {
console.log('all calls to [func2] are deprecated ');
return true;
}, 'func2');
obj2.func1();
obj2.func2();
obj2.func2('');
process.on('deprecation', error => {
const err: depd.DeprecationError = error;
error; // $ExpectType DeprecationError
err.name; // $ExpectType "DeprecationError"
err.namespace; // $ExpectType string
err.stack; // $ExpectType string
});
+35 -10
View File
@@ -1,16 +1,41 @@
// Type definitions for depd 1.1.0
// Type definitions for depd 1.1
// Project: https://github.com/dougwilson/nodejs-depd
// Definitions by: Zhiyuan Wang <https://github.com/danny8002>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare function depd(namespace: string): Deprecate;
interface Deprecate {
(message: string): void;
function(fn: Function, message?: string): Function;
property(obj: Object, prop: string, message: string): void;
}
/// <reference types="node" />
export = depd;
declare function depd(namespace: string): depd.Deprecate;
declare namespace depd {
interface Deprecate {
(message: string): void;
// tslint:disable-next-line ban-types
function<T extends Function>(fn: T, message?: string): T;
property<T extends object>(obj: T, prop: keyof T, message: string): void;
}
interface DeprecationError extends Error {
readonly name: 'DeprecationError';
namespace: string;
stack: string;
}
}
declare global {
namespace NodeJS {
interface Process {
addListener(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
emit(event: 'deprecation', code: depd.DeprecationError): boolean;
on(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
once(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
prependListener(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
prependOnceListener(event: 'deprecation', listener: (deprecationError: depd.DeprecationError) => void): this;
listeners(event: 'deprecation'): depd.DeprecationError[];
}
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,4 +20,4 @@
"index.d.ts",
"depd-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+12 -6
View File
@@ -8,6 +8,15 @@ export = JsDiff;
export as namespace JsDiff;
declare namespace JsDiff {
interface ICaseOptions {
ignoreCase: boolean;
}
interface ILinesOptions {
ignoreWhitespace?: boolean;
newlineIsToken?: boolean;
}
interface IDiffResult {
value: string;
count?: number;
@@ -54,18 +63,15 @@ declare namespace JsDiff {
tokenize(value: string): any; // return types are string or string[]
}
function diffChars(oldStr: string, newStr: string): IDiffResult[];
function diffChars(oldStr: string, newStr: string, options?: ICaseOptions): IDiffResult[];
function diffWords(oldStr: string, newStr: string): IDiffResult[];
function diffWords(oldStr: string, newStr: string, options?: ICaseOptions): IDiffResult[];
function diffWordsWithSpace(oldStr: string, newStr: string): IDiffResult[];
function diffJson(oldObj: object, newObj: object): IDiffResult[];
function diffLines(oldStr: string, newStr: string, options?: {
ignoreWhitespace?: boolean,
newlineIsToken?: boolean,
}): IDiffResult[];
function diffLines(oldStr: string, newStr: string, options?: ILinesOptions): IDiffResult[];
function diffCss(oldStr: string, newStr: string): IDiffResult[];
+1
View File
@@ -488,6 +488,7 @@ declare namespace Dockerode {
CpusetCpus: string;
CpusetMems: string;
Devices?: any;
DiskQuota: number;
KernelMemory: number;
Memory: number;
MemoryReservation: number;
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+16 -20
View File
@@ -3,23 +3,18 @@
// Definitions by: Dave Taylor <http://davetayls.me>, Samira Bazuzi <https://github.com/bazuzi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = DOMPurify;
export as namespace DOMPurify;
declare var DOMPurify: DOMPurify;
export declare function sanitize(source: string | Node): string;
export declare function sanitize(source: string | Node, config: Config & { RETURN_DOM_FRAGMENT?: false; RETURN_DOM?: false; }): string;
export declare function sanitize(source: string | Node, config: Config & { RETURN_DOM_FRAGMENT: true; }): DocumentFragment;
export declare function sanitize(source: string | Node, config: Config & { RETURN_DOM: true; }): HTMLElement;
export declare function sanitize(source: string | Node, config: Config): string | HTMLElement | DocumentFragment;
export declare function addHook(hook: 'uponSanitizeElement', cb: (currentNode: Element, data: SanitizeElementHookEvent, config: Config) => void): void;
export declare function addHook(hook: 'uponSanitizeAttribute', cb: (currentNode: Element, data: SanitizeAttributeHookEvent, config: Config) => void): void;
export declare function addHook(hook: HookName, cb: (currentNode: Element, data: HookEvent, config: Config) => void): void;
interface DOMPurify {
sanitize(source: string | Node): string;
sanitize(source: string | Node, config: DOMPurifyConfig & { RETURN_DOM_FRAGMENT?: false; RETURN_DOM?: false; }): string;
sanitize(source: string | Node, config: DOMPurifyConfig & { RETURN_DOM_FRAGMENT: true; }): DocumentFragment;
sanitize(source: string | Node, config: DOMPurifyConfig & { RETURN_DOM: true; }): HTMLElement;
sanitize(source: string | Node, config: DOMPurifyConfig): string | HTMLElement | DocumentFragment;
addHook(hook: 'uponSanitizeElement', cb: (currentNode: Element, data: DOMPurifySanitizeElementHookEvent, config: DOMPurifyConfig) => void): void;
addHook(hook: 'uponSanitizeAttribute', cb: (currentNode: Element, data: DOMPurifySanitizeAttributeHookEvent, config: DOMPurifyConfig) => void): void;
addHook(hook: DOMPurifyHookName, cb: (currentNode: Element, data: DOMPurifyHookEvent, config: DOMPurifyConfig) => void): void;
}
interface DOMPurifyConfig {
interface Config {
ADD_ATTR?: string[];
ADD_TAGS?: string[];
ALLOW_DATA_ATTR?: boolean;
@@ -27,6 +22,7 @@ interface DOMPurifyConfig {
ALLOWED_TAGS?: string[];
FORBID_ATTR?: string[];
FORBID_TAGS?: string[];
FORCE_BODY?: boolean;
KEEP_CONTENT?: boolean;
RETURN_DOM?: boolean;
RETURN_DOM_FRAGMENT?: boolean;
@@ -36,7 +32,7 @@ interface DOMPurifyConfig {
WHOLE_DOCUMENT?: boolean;
}
type DOMPurifyHookName
type HookName
= 'beforeSanitizeElements'
| 'uponSanitizeElement'
| 'afterSanitizeElements'
@@ -47,17 +43,17 @@ type DOMPurifyHookName
| 'uponSanitizeShadowNode'
| 'afterSanitizeShadowDOM';
type DOMPurifyHookEvent
= DOMPurifySanitizeElementHookEvent
| DOMPurifySanitizeAttributeHookEvent
type HookEvent
= SanitizeElementHookEvent
| SanitizeAttributeHookEvent
| null;
interface DOMPurifySanitizeElementHookEvent {
interface SanitizeElementHookEvent {
tagName: string;
allowedTags: string[];
}
interface DOMPurifySanitizeAttributeHookEvent {
interface SanitizeAttributeHookEvent {
attrName: string;
attrValue: string;
keepAttr: boolean;
+175 -82
View File
@@ -1,6 +1,6 @@
// Type definitions for ej.web.all 15.3
// Project: http://help.syncfusion.com/js/typescript
// Definitions by: Syncfusion <https://github.com/syncfusion/>
// Definitions by: Syncfusion <https://github.com/syncfusion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -8,7 +8,7 @@
/*!
* filename: ej.web.all.d.ts
* version : 15.3.0.26
* version : 15.3.0.29
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
@@ -7791,7 +7791,7 @@ declare namespace ej {
*/
target?: string;
/** The title text to be displayed in the dialog header. In order to set title, you need to set showHeader as true since the title will be displayed in the dialog header.
/** The title text to be displayed in the dialog header. In order to set title, you need to set "showHeader" as true since the title will be displayed in the dialog header.
*/
title?: string;
@@ -16048,7 +16048,7 @@ declare namespace ej {
*/
autoHeight?: boolean;
/** This API holds configuration setting for paste clenaup behavior.
/** This API holds configuration setting for paste cleanup behavior.
* @Default {{ listConversion: false, cleanCSS: false, removeStyles: false, cleanElements: false }}
*/
pasteCleanupSettings?: PasteCleanupSettings;
@@ -27283,7 +27283,7 @@ declare namespace ej {
*/
format?: string;
/** Sets the opacity of the dispalyed tooltip
/** Sets the opacity of the displayed tooltip
* @Default {0.95}
*/
opacity?: number;
@@ -27949,6 +27949,11 @@ declare namespace ej {
*/
refreshControl(): void;
/** This function Destroy the PivotGrid widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.
* @returns {void}
*/
destroy(): void;
/** This function returns the height of all rows and width each and every column.
* @returns {any}
*/
@@ -27957,7 +27962,7 @@ declare namespace ej {
/** This function creates the conditional formatting dialog to apply conditional formatting for PivotGrid control.
* @returns {void}
*/
createConditionalDialog(): void;
openConditionalFormattingDialog(): void;
/** This function saves the current report to the database/local storage.
* @returns {void}
@@ -28163,11 +28168,16 @@ declare namespace ej {
*/
enableColumnResizing?: boolean;
/** Allows the user to fit the width of the columns based on its content. This is only applicable for enableColumnResizing option.
/** Allows the user to fit the width of the column based on its maximum text width.
* @Default {false}
*/
resizeColumnsToFit?: boolean;
/** Allows the user to enable/disable the context menu of Pivot buttons in the PivotGrid.
* @Default {false}
*/
enableContextMenu?: boolean;
/** Allows the user to view large amount of data through virtual scrolling.
* @Default {false}
*/
@@ -28616,14 +28626,6 @@ declare namespace ej {
values?: any[];
}
export interface DataSourceColumnsGroupByDate {
/** Contains the collection of formatString to group item from the field.
* @Default {[]}
*/
interval?: any[];
}
export interface DataSourceColumn {
/** Allows the user to bind the item by using its unique name as field name.
@@ -28679,11 +28681,6 @@ declare namespace ej {
* @Default {null}
*/
filterItems?: DataSourceColumnsFilterItems;
/** Allows the user to group the field by date. This is applicable only when the format is set as &quot;date&quot;.
* @Default {{}}
*/
groupByDate?: DataSourceColumnsGroupByDate;
}
export interface DataSourceRowsAdvancedFilter {
@@ -28728,14 +28725,6 @@ declare namespace ej {
values?: any[];
}
export interface DataSourceRowsGroupByDate {
/** Contains the collection of formatString to group item from the field.
* @Default {[]}
*/
interval?: any[];
}
export interface DataSourceRow {
/** Allows the user to bind the item by using its unique name as field name.
@@ -28791,11 +28780,6 @@ declare namespace ej {
* @Default {null}
*/
filterItems?: DataSourceRowsFilterItems;
/** Allows the user to group the field by date. This is applicable only when the format is set as &quot;date&quot;.
* @Default {{}}
*/
groupByDate?: DataSourceRowsGroupByDate;
}
export interface DataSourceValuesMeasure {
@@ -29128,6 +29112,16 @@ declare namespace ej {
*/
drillThroughDataTable?: string;
/** Allows the user to set the custom name for the service method responsible for performing value sorting operation in PivotGrid.
* @Default {ValueSorting}
*/
valueSorting?: string;
/** Allows the user to set the custom name for the service method responsible for removing pivot button from GroupingBar/Field List.
* @Default {RemoveButton}
*/
removeButton?: string;
/** Allows the user to set the custom name for the service method responsible for write-back operation in OLAP Cube. This is only applicable in server-side component.
* @Default {WriteBack}
*/
@@ -29215,6 +29209,11 @@ declare namespace ej {
* @returns {void}
*/
refreshControl(): void;
/** This function Destroy the PivotSchemaDesigner widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.
* @returns {void}
*/
destroy(): void;
}
export namespace PivotSchemaDesigner {
@@ -29269,7 +29268,7 @@ declare namespace ej {
/** Allows the user to set custom name for the methods at service-end, communicated during AJAX post.
* @Default {{}}
*/
serviceMethod?: ServiceMethod;
serviceMethods?: any;
/** Connects the service using the specified URL for any server updates.
* @Default {âœâ}
@@ -29372,39 +29371,6 @@ declare namespace ej {
showNamedSets?: boolean;
}
export interface ServiceMethod {
/** Allows the user to set the custom name for the service method responsible for getting the values for the tree-view inside filter dialog.
* @Default {FetchMembers}
*/
fetchMembers?: string;
/** Allows the user to set the custom name for the service method responsible for filtering operation in Field List.
* @Default {Filtering}
*/
filtering?: string;
/** Allows the user to set the custom name for the service method responsible for the server-side action, on expanding members in Field List.
* @Default {MemberExpanded}
*/
memberExpand?: string;
/** Allows the user to set the custom name for the service method responsible for the server-side action, on dropping a node into Field List.
* @Default {NodeDropped}
*/
nodeDropped?: string;
/** Allows the user to set the custom name for the service method responsible for the server-side action on changing the checked state of a node in Field List.
* @Default {NodeStateModified}
*/
nodeStateModified?: string;
/** Allows the user to set the custom name for the service method responsible for button removing operation in Field List.
* @Default {RemoveButton}
*/
removeButton?: string;
}
enum Layouts {
///To set the layout as same in the Excel.
@@ -29552,6 +29518,11 @@ declare namespace ej {
*/
refreshControl(): void;
/** This function Destroy the PivotChart widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.
* @returns {void}
*/
destroy(): void;
/** Renders the control with the pivot engine obtained from olap cube.
* @returns {void}
*/
@@ -29648,6 +29619,11 @@ declare namespace ej {
*/
rotation?: number;
/** Allows the user to enable/disable the context menu options in the PivotChart.
* @Default {false}
*/
enableContextMenu?: boolean;
/** Allows the user to set custom name for the methods at service-end, communicated on AJAX post.
* @Default {{}}
*/
@@ -29675,6 +29651,10 @@ declare namespace ej {
*/
beforeServiceInvoke?(e: BeforeServiceInvokeEventArgs): void;
/** Triggers before Pivot Engine starts to populate.
*/
beforePivotEnginePopulate?(e: BeforePivotEnginePopulateEventArgs): void;
/** Triggers on performing drill up/down in PivotChart control.
*/
drillSuccess?(e: DrillSuccessEventArgs): void;
@@ -29741,6 +29721,13 @@ declare namespace ej {
element?: any;
}
export interface BeforePivotEnginePopulateEventArgs {
/** returns the current instance of PivotChart.
*/
chartObj?: any;
}
export interface DrillSuccessEventArgs {
/** returns the current instance of PivotChart.
@@ -30132,6 +30119,16 @@ declare namespace ej {
*/
refreshControl(): void;
/** Returns the control tab string that displays currently in PivotClient.
* @returns {void}
*/
getActiveTab(): void;
/** This function Destroy the PivotClient widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.
* @returns {void}
*/
destroy(): void;
/** Returns the OlapReport string maintained along with the axis elements information.
* @returns {string}
*/
@@ -30186,6 +30183,11 @@ declare namespace ej {
*/
dataSource?: DataSource;
/** Enables the Drill-Through feature which retrieves the raw items that are used to create the specific cell in PivotGrid.
* @Default {false}
*/
enableDrillThrough?: boolean;
/** Allows the user to customize the widget's layout and appearance.
* @Default {{}}
*/
@@ -30196,7 +30198,7 @@ declare namespace ej {
*/
toolbarIconSettings?: ToolbarIconSettings;
/** Allows user to show unique name on pivotbutton.
/** Allows user to show unique name on pivot button.
* @Default {false}
*/
showUniqueNameOnPivotButton?: boolean;
@@ -30276,6 +30278,11 @@ declare namespace ej {
*/
isResponsive?: boolean;
/** Options to customize the size of the PivotClient control.
* @Default {Example:}
*/
size?: any;
/** Allows the user to set the localized language for the widget.
* @Default {en-US}
*/
@@ -30335,6 +30342,10 @@ declare namespace ej {
*/
treeMapLoad?(e: TreeMapLoadEventArgs): void;
/** Triggers while clicking value cells in PivotGrid.
*/
drillThrough?(e: DrillThroughEventArgs): void;
/** Triggers while we initiate loading of the widget.
*/
load?(e: LoadEventArgs): void;
@@ -30463,6 +30474,17 @@ declare namespace ej {
element?: any;
}
export interface DrillThroughEventArgs {
/** return the JSON records of the generated cells on drill-through operation.
*/
data?: any;
/** returns the HTML element of PivotClient.
*/
element?: any;
}
export interface LoadEventArgs {
/** returns the HTML element of PivotClient component.
@@ -31013,6 +31035,16 @@ declare namespace ej {
*/
loadReport?: string;
/** Allows the user to set the custom name for the service method responsible for remove a report collection from the database.
* @Default {RemoveReportFromDB}
*/
removeDBReport?: string;
/** Allows the user to set the custom name for the service method responsible for rename the report collection in the database.
* @Default {RenameReportInDB}
*/
renameDBReport?: string;
/** Allows the user to set the custom name for the service method responsible for retrieving the MDX query for the current report.
* @Default {GetMDXQuery}
*/
@@ -31067,6 +31099,16 @@ declare namespace ej {
* @Default {CalculatedMember}
*/
calculatedMember?: string;
/** Allows the user to set the custom name for the service method responsible for performing drill through operation.
* @Default {DrillThroughHierarchies}
*/
drillThroughHierarchies?: string;
/** Allows the user to set the custom name for the service method responsible for performing drill through operation in data table.
* @Default {DrillThroughDataTable}
*/
drillThroughDataTable?: string;
}
enum ClientExportMode {
@@ -31143,6 +31185,11 @@ declare namespace ej {
*/
renderControlFromJSON(): void;
/** This function Destroy the PivotGauge widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.
* @returns {void}
*/
destroy(): void;
/** Returns the OlapReport string maintained along with the axis elements information.
* @returns {string}
*/
@@ -31598,6 +31645,11 @@ declare namespace ej {
*/
doAjaxPost(): void;
/** Performs an asynchronous HTTP (FullPost) submit.
* @returns {void}
*/
doPostBack(): void;
/** Returns the OlapReport string maintained along with the axis elements information.
* @returns {string}
*/
@@ -31632,6 +31684,11 @@ declare namespace ej {
* @returns {void}
*/
renderControlSuccess(): void;
/** This function Destroy the PivotTreemap widget all events bound using this._on will be unbind automatically and bring the control to pre-init state.
* @returns {void}
*/
destroy(): void;
}
export namespace PivotTreeMap {
@@ -40686,6 +40743,8 @@ declare namespace ej {
XLRibbon: Spreadsheet.XLRibbon;
XLScroll: Spreadsheet.XLScroll;
XLSearch: Spreadsheet.XLSearch;
XLSelection: Spreadsheet.XLSelection;
@@ -41339,6 +41398,15 @@ declare namespace ej {
updateRibbonIcons(): void;
}
export interface XLScroll {
/** This method is used to scroll the sheet content to the specified cell address in the Spreadsheet.
* @param {string} Pass the cell address that you want to scroll to it.
* @returns {void}
*/
scrollToCell(range: string): void;
}
export interface XLSearch {
/** This method is used to find and replace all data by workbook in the Spreadsheet.
@@ -44481,7 +44549,7 @@ declare namespace ej {
/** Returns the previous color of the signature.
*/
perviousColor?: string;
previousColor?: string;
/** Returns the current color of the signature.
*/
@@ -44841,6 +44909,12 @@ declare namespace ej {
* @returns {any}
*/
addToDictionary(customWord: string): any;
/** Retrieves the possible suggestion words for the error word passed as an argument.
* @param {string} Error word to get the suggestions
* @returns {any}
*/
getSuggestionWords(errorWord: string): any;
}
export namespace SpellCheck {
@@ -44893,6 +44967,11 @@ declare namespace ej {
*/
controlsToValidate?: string;
/** When set to true, allows sending Asynchronous ajax request for checking the spelling errors.
* @Default {true}
*/
enableAsync?: boolean;
/** Triggers on the success of AJAX call request.
*/
actionSuccess?(e: ActionSuccessEventArgs): void;
@@ -51357,7 +51436,7 @@ declare namespace ej.datavisualization {
*/
type?: string;
/** location - X and Y co-ordinate of the points with respect to chart area. axis - axis of the multilevellabels. multilevellabel - Multi level label details
/** location - X and Y co-ordinate of the points with respect to chart area. axis - axis of the multi level labels. multiLevelLabel - Multi level label details
*/
data?: any;
}
@@ -52537,7 +52616,7 @@ declare namespace ej.datavisualization {
/** Specifies the type of the trendline for the series.
* @Default {linear. See TrendlinesType}
*/
type?: string;
type?: ej.datavisualization.Chart.TrendlinesType|string;
/** Name for the trendlines that is to be displayed in the legend text.
* @Default {trendline}
@@ -52741,7 +52820,7 @@ declare namespace ej.datavisualization {
*/
dataSource?: any;
/** Specifies spline tension value for cardianal spline type. Value ranges from 0 to 1.
/** Specifies spline tension value for cardinal spline type. Value ranges from 0 to 1.
* @Default {0.5}
*/
cardinalSplineTension?: number;
@@ -57013,7 +57092,7 @@ declare namespace ej.datavisualization {
*/
dataSource?: any;
/** Specifies spline tension values for cardianal spline type.Value ranges from 0 to 1.
/** Specifies spline tension values for cardinal spline type.Value ranges from 0 to 1.
* @Default {0.5}
*/
cardinalSplineTension?: number;
@@ -57123,7 +57202,7 @@ declare namespace ej.datavisualization {
splitMode?: ej.datavisualization.Chart.SplitMode|string;
/** Quartile calculation has been performed in three different formulas to render the boxplot series .
* @Default {exclusive}
* @Default {exclusive.See BoxPlotMode}
*/
boxPlotMode?: ej.datavisualization.Chart.LabelPosition|string;
@@ -57944,6 +58023,20 @@ declare namespace ej.datavisualization {
Minus,
}
}
namespace Chart {
enum TrendlinesType {
//string
Linear,
//string
Exponential,
//string
Logarithmic,
//string
Power,
//string
Polynomial,
}
}
namespace Chart {
enum Mode {
//string
@@ -64669,22 +64762,22 @@ declare namespace ej.datavisualization {
*/
id?: string;
/** Sets the sourcenode of the connection data source item
/** Sets the source node of the connection data source item
* @Default {null}
*/
sourceNode?: string;
/** Sets the targetnode of the connection data source item
/** Sets the target node of the connection data source item
* @Default {null}
*/
targetNode?: string;
/** Sets the sourcepoint-x value of the connection data source item
/** Sets the sourcePointX value of the connection data source item
* @Default {null}
*/
sourcePointX?: string;
/** Sets the sourcePoint-y value of the connection data source item
/** Sets the sourcePointY value of the connection data source item
* @Default {null}
*/
sourcePointY?: string;
@@ -64704,7 +64797,7 @@ declare namespace ej.datavisualization {
*/
crudAction?: DataSourceSettingsConnectionDataSourceCrudAction;
/** Specifies the customfields to get the updated data from client side to the server side
/** Specifies the custom fields to get the updated data from client side to the server side
* @Default {[]}
*/
customFields?: any[];
@@ -64745,7 +64838,7 @@ declare namespace ej.datavisualization {
*/
crudAction?: DataSourceSettingsCrudAction;
/** Specifies the customfields to get the updated data from client side to the server side
/** Specifies the custom fields to get the updated data from client side to the server side
* @Default {[]}
*/
customFields?: any[];
@@ -69214,7 +69307,7 @@ declare namespace ej.datavisualization {
*/
format?: string;
/** Sets the opacity of the dispalyed tooltip
/** Sets the opacity of the displayed tooltip
* @Default {0.95}
*/
opacity?: number;
@@ -69885,7 +69978,7 @@ interface JQueryPromise<T> {
*/
cancel?: boolean;
}
interface JQueryDeferred<T> extends JQueryPromise<T> {
interface JQueryDeferred<T> {
/**
* Returns the cancel option value.
*/
+1
View File
@@ -6,6 +6,7 @@
"no-consecutive-blank-lines": false,
"no-mergeable-namespace": false,
"no-padding": false,
"no-any-union": false,
"no-unnecessary-qualifier": false,
"strict-export-declare-modifiers": false
}
+2 -1
View File
@@ -14,7 +14,8 @@
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true
},
"files": [
"index.d.ts",
+3 -2
View File
@@ -14,10 +14,11 @@
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true
},
"files": [
"index.d.ts",
"ember-tests.ts"
]
}
}
-1
View File
@@ -8,7 +8,6 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strict": true,
"baseUrl": "../",
"typeRoots": [
"../"
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+1 -1
View File
@@ -56,7 +56,7 @@ export interface CommonWrapper<P = {}, S = {}> {
* Returns whether or not the current wrapper has a node anywhere in it's render tree that looks like the one passed in.
* @param node
*/
contains(node: ReactElement<any>): boolean;
contains(node: ReactElement<any> | string): boolean;
/**
* Returns whether or not a given react element exists in the shallow render tree.
+18 -8
View File
@@ -1,6 +1,6 @@
import * as express from "express";
import * as express from 'express';
import 'express-session';
import * as graphqlHTTP from "express-graphql";
import * as graphqlHTTP from 'express-graphql';
const app = express();
const schema = {};
@@ -8,19 +8,29 @@ const schema = {};
const graphqlOption: graphqlHTTP.OptionsObj = {
graphiql: true,
schema: schema,
formatError: (error:Error) => ({
message: error.message,
formatError: (error: Error) => ({
message: error.message
})
};
const graphqlOptionRequest = (request: express.Request): graphqlHTTP.OptionsObj => ({
graphiql: true,
schema: schema,
context: request.session,
context: request.session
});
app.use("/graphql1", graphqlHTTP(graphqlOption));
const graphqlOptionRequestAsync = async (request: express.Request): Promise<graphqlHTTP.OptionsObj> => {
return {
graphiql: true,
schema: await Promise.resolve(schema),
context: request.session
};
};
app.use("/graphql2", graphqlHTTP(graphqlOptionRequest));
app.use('/graphql1', graphqlHTTP(graphqlOption));
app.listen(8080);
app.use('/graphql2', graphqlHTTP(graphqlOptionRequest));
app.use('/graphqlasync', graphqlHTTP(graphqlOptionRequestAsync));
app.listen(8080, () => console.log('GraphQL Server running on localhost:8080'));
+4 -2
View File
@@ -1,6 +1,8 @@
// Type definitions for express-graphql
// Project: https://www.npmjs.org/package/express-graphql
// Definitions by: Isman Usoh <https://github.com/isman-usoh>, Nitin Tutlani <https://github.com/nitintutlani>
// Definitions by: Isman Usoh <https://github.com/isman-usoh>
// Nitin Tutlani <https://github.com/nitintutlani>
// Daniel Fader <https://github.com/hubel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Request, Response } from "express";
@@ -12,7 +14,7 @@ declare namespace graphqlHTTP {
* Used to configure the graphQLHTTP middleware by providing a schema
* and other configuration options.
*/
export type Options = ((req: Request) => OptionsObj) | OptionsObj
export type Options = ((req: Request) => OptionsObj) | ((req: Request) => Promise<OptionsObj>) | OptionsObj
export type OptionsObj = {
/**
* A GraphQL schema from graphql-js.
+2 -1
View File
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"lib": [
"es6"
],
@@ -19,4 +20,4 @@
"index.d.ts",
"express-graphql-tests.ts"
]
}
}
+2
View File
@@ -197,8 +197,10 @@ interface Request extends http.IncomingMessage, Express.Request {
*
* @param name
*/
get(name: "set-cookie"): string[] | undefined;
get(name: string): string | undefined;
header(name: "set-cookie"): string[] | undefined;
header(name: string): string | undefined;
/**
+18 -6
View File
@@ -70,14 +70,26 @@ namespace express_tests {
language = req.acceptsLanguages(['en', 'ja']);
language = req.acceptsLanguages('en', 'ja');
let existingHeader1 = req.get('existingHeader') as string;
let nonExistingHeader1 = req.get('nonExistingHeader') as undefined;
// downcasting
req.get('set-cookie') as undefined;
req.get('set-cookie') as string[];
const setCookieHeader1 = req.get('set-cookie');
if (setCookieHeader1 !== undefined) {
const setCookieHeader2: string[] = setCookieHeader1;
}
req.get('header') as undefined;
req.get('header') as string;
const header1 = req.get('header');
if (header1 !== undefined) {
const header2: string = header1;
}
let existingHeader2 = req.header('existingHeader') as string;
let nonExistingHeader2 = req.header('nonExistingHeader') as undefined;
// upcasting
const setCookieHeader3: string[] | undefined = req.get('set-cookie');
const header3: string | undefined = req.header('header');
let existingHeader3 = req.headers.existingHeader as string;
let nonExistingHeader3 = req.headers.nonExistingHeader as any as undefined;
req.headers.existingHeader as string;
req.headers.nonExistingHeader as any as undefined;
res.send(req.query['token']);
});
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+7 -4
View File
@@ -1,10 +1,13 @@
import fileUrl = require("file-url");
// Copied from https://github.com/sindresorhus/file-url/blob/14c7a69ae3798f50b3a4a21823c86e10b38160fe/readme.md
// from https://raw.githubusercontent.com/sindresorhus/file-url/df60ecfe08f9844569c794e92ecc2c53d1dd298d/readme.md
fileUrl('unicorn.jpg');
//=> 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'
// => 'file:///Users/sindresorhus/dev/file-url/unicorn.jpg'
fileUrl('/Users/pony/pics/unicorn.jpg');
//=> 'file:///Users/pony/pics/unicorn.jpg'
// => 'file:///Users/pony/pics/unicorn.jpg'
// passing {resolve: false} will make it not call path.resolve() on the path
fileUrl('unicorn.jpg', {resolve: false});
// => 'file:///unicorn.jpg'
+22 -3
View File
@@ -1,12 +1,31 @@
// Type definitions for file-url v1.0.1
// Type definitions for file-url 2.0
// Project: https://github.com/sindresorhus/file-url
// Definitions by: MEDIA CHECK s.r.o. <http://www.mediacheck.cz/>
// Definitions by: coderslagoon <https://github.com/coderslagoon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*
Original typings for 1.0 were provided by
"MEDIA CHECK s.r.o. <http://www.mediacheck.cz/>",
Did not pass the tslint check, hence mentioning it here.
*/
/**
* Options for the fileUrl() API.
*/
interface FileUrlOptions {
/**
* Passing false will make it not call path.resolve() on the path.
*/
resolve?: boolean;
}
/**
* Convert a path to a file URL.
* @param path File path to convert.
* @param options Options to use.
* @return File URL.
*/
declare function fileUrl(path:string):string;
declare function fileUrl(path: string, options?: FileUrlOptions): string;
/**
* Convert a path to a file URL.
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+13 -8
View File
@@ -105,6 +105,11 @@ declare namespace Ffmpeg {
size?: string;
}
interface AudioVideoFilter {
filter: string;
options: string | string[] | {};
}
class FfmpegCommand extends events.EventEmitter {
constructor(options?: FfmpegCommandOptions);
constructor(input?: string | stream.Readable, options?: FfmpegCommandOptions);
@@ -144,10 +149,10 @@ declare namespace Ffmpeg {
audioFrequency(freq: number): FfmpegCommand;
withAudioQuality(quality: number): FfmpegCommand;
audioQuality(quality: number): FfmpegCommand;
withAudioFilter(filters: { filter: string, options: any }): FfmpegCommand;
withAudioFilters(filters: { filter: string, options: any }): FfmpegCommand;
audioFilter(filters: { filter: string, options: any }): FfmpegCommand;
audioFilters(filters: { filter: string, options: any }): FfmpegCommand;
withAudioFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
withAudioFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
audioFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
audioFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
// options/video;
withNoVideo(): FfmpegCommand;
@@ -156,10 +161,10 @@ declare namespace Ffmpeg {
videoCodec(codec: string): FfmpegCommand;
withVideoBitrate(bitrate: string | number): FfmpegCommand;
videoBitrate(bitrate: string | number): FfmpegCommand;
withVideoFilter(filters: { filter: string, options: any }): FfmpegCommand;
withVideoFilters(filters: { filter: string, options: any }): FfmpegCommand;
videoFilter(filters: { filter: string, options: any }): FfmpegCommand;
videoFilters(filters: { filter: string, options: any }): FfmpegCommand;
withVideoFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
withVideoFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
videoFilter(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
videoFilters(filters: string | string[] | AudioVideoFilter[]): FfmpegCommand;
withOutputFps(fps: number): FfmpegCommand;
withOutputFPS(fps: number): FfmpegCommand;
withFpsOutput(fps: number): FfmpegCommand;
+3 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for flux-standard-action 0.5.0
// Project: https://github.com/acdlite/flux-standard-action
// Definitions by: Qubo <https://github.com/tkqubo>
// Simon Fridlund <https://github.com/zimme>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -16,12 +17,12 @@ export interface Action<T> {
/** Usage: `var action: Action<string> & AnyMeta;` */
export interface AnyMeta {
meta: any
meta?: any;
}
/** Usage: `var action: Action<string> & TypedMeta<string>;` */
export interface TypedMeta<T> {
meta: T
meta?: T;
}
export declare function isFSA(action: any): action is Action<any>;
@@ -202,7 +202,7 @@ readStream = fs.createReadStream(path, {
writeStream = fs.createWriteStream(path);
writeStream = fs.createWriteStream(path, {
flags: str,
defaultEncoding: str
encoding: str
});
function isDirectoryCallback(err: Error, isDirectory: boolean) {}
+1 -1
View File
@@ -14,7 +14,7 @@ const fd = 0;
const modeNum = 0;
const modeStr = "";
const object = {};
const errorCallback = (err: Error) => { };
const errorCallback = (err: Error | null) => { };
const readOptions: fs.ReadOptions = {
reviver: {}
};
+74 -72
View File
@@ -14,140 +14,141 @@ import { Stats } from "fs";
export * from "fs";
export function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
export function copy(src: string, dest: string, callback: (err: Error) => void): void;
export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void;
export function copy(src: string, dest: string, callback: (err: Error | null) => void): void;
export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error | null) => void): void;
export function copySync(src: string, dest: string, options?: CopyOptions): void;
export function move(src: string, dest: string, options?: MoveOptions): Promise<void>;
export function move(src: string, dest: string, callback: (err: Error) => void): void;
export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void;
export function move(src: string, dest: string, callback: (err: Error | null) => void): void;
export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error | null) => void): void;
export function moveSync(src: string, dest: string, options?: MoveOptions): void;
export function createFile(file: string): Promise<void>;
export function createFile(file: string, callback: (err: Error) => void): void;
export function createFile(file: string, callback: (err: Error | null) => void): void;
export function createFileSync(file: string): void;
export function ensureDir(path: string): Promise<void>;
export function ensureDir(path: string, callback: (err: Error) => void): void;
export function ensureDir(path: string, callback: (err: Error | null) => void): void;
export function ensureDirSync(path: string): void;
export function mkdirs(dir: string): Promise<void>;
export function mkdirs(dir: string, callback: (err: Error) => void): void;
export function mkdirs(dir: string, callback: (err: Error | null) => void): void;
export function mkdirp(dir: string): Promise<void>;
export function mkdirp(dir: string, callback: (err: Error) => void): void;
export function mkdirp(dir: string, callback: (err: Error | null) => void): void;
export function mkdirsSync(dir: string): void;
export function mkdirpSync(dir: string): void;
export function outputFile(file: string, data: any): Promise<void>;
export function outputFile(file: string, data: any, callback: (err: Error) => void): void;
export function outputFile(file: string, data: any, callback: (err: Error | null) => void): void;
export function outputFileSync(file: string, data: any): void;
export function readJson(file: string, options?: ReadOptions): Promise<any>;
export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void;
export function readJson(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void;
export function readJson(file: string, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJson(file: string, options: ReadOptions, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJSON(file: string, options?: ReadOptions): Promise<any>;
export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void;
export function readJSON(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void;
export function readJSON(file: string, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJSON(file: string, options: ReadOptions, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJsonSync(file: string, options?: ReadOptions): any;
export function readJSONSync(file: string, options?: ReadOptions): any;
export function remove(dir: string): Promise<void>;
export function remove(dir: string, callback: (err: Error) => void): void;
export function remove(dir: string, callback: (err: Error | null) => void): void;
export function removeSync(dir: string): void;
export function outputJSON(file: string, data: any, options?: WriteOptions): Promise<void>;
export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void;
export function outputJSON(file: string, data: any, callback: (err: Error) => void): void;
export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function outputJSON(file: string, data: any, callback: (err: Error | null) => void): void;
export function outputJson(file: string, data: any, options?: WriteOptions): Promise<void>;
export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void;
export function outputJson(file: string, data: any, callback: (err: Error) => void): void;
export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function outputJson(file: string, data: any, callback: (err: Error | null) => void): void;
export function outputJsonSync(file: string, data: any, options?: WriteOptions): void;
export function outputJSONSync(file: string, data: any, options?: WriteOptions): void;
export function writeJSON(file: string, object: any, options?: WriteOptions): Promise<void>;
export function writeJSON(file: string, object: any, callback: (err: Error) => void): void;
export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void;
export function writeJSON(file: string, object: any, callback: (err: Error | null) => void): void;
export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function writeJson(file: string, object: any, options?: WriteOptions): Promise<void>;
export function writeJson(file: string, object: any, callback: (err: Error) => void): void;
export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void;
export function writeJson(file: string, object: any, callback: (err: Error | null) => void): void;
export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function writeJsonSync(file: string, object: any, options?: WriteOptions): void;
export function writeJSONSync(file: string, object: any, options?: WriteOptions): void;
export function ensureFile(path: string): Promise<void>;
export function ensureFile(path: string, callback: (err: Error) => void): void;
export function ensureFile(path: string, callback: (err: Error | null) => void): void;
export function ensureFileSync(path: string): void;
export function ensureLink(src: string, dest: string): Promise<void>;
export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void;
export function ensureLink(src: string, dest: string, callback: (err: Error | null) => void): void;
export function ensureLinkSync(src: string, dest: string): void;
export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise<void>;
export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void;
export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void;
export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error | null) => void): void;
export function ensureSymlink(src: string, dest: string, callback: (err: Error | null) => void): void;
export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void;
export function emptyDir(path: string): Promise<void>;
export function emptyDir(path: string, callback: (err: Error) => void): void;
export function emptyDir(path: string, callback: (err: Error | null) => void): void;
export function emptyDirSync(path: string): void;
export function pathExists(path: string): Promise<boolean>;
export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void;
export function pathExists(path: string, callback: (err: Error | null, exists: boolean) => void): void;
export function pathExistsSync(path: string): boolean;
// fs async methods
// copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts
/** Tests a user's permissions for the file specified by path. */
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function access(path: string | Buffer, mode?: number): Promise<void>;
export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void;
export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; },
callback: (err: NodeJS.ErrnoException | null) => void): void;
export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function appendFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise<void>;
export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function chmod(path: string | Buffer, mode: string | number): Promise<void>;
export function chown(path: string | Buffer, uid: number, gid: number): Promise<void>;
export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function close(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function close(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function close(fd: number): Promise<void>;
export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function fchmod(fd: number, mode: string | number): Promise<void>;
export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function fchown(fd: number, uid: number, gid: number): Promise<void>;
export function fdatasync(fd: number, callback: () => void): void;
export function fdatasync(fd: number): Promise<void>;
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void;
export function fstat(fd: number): Promise<Stats>;
export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function fsync(fd: number): Promise<void>;
export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function ftruncate(fd: number, len?: number): Promise<void>;
export function futimes(fd: number, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function futimes(fd: number, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException) => void): void;
export function futimes(fd: number, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function futimes(fd: number, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function futimes(fd: number, atime: number, mtime: number): Promise<void>;
export function futimes(fd: number, atime: Date, mtime: Date): Promise<void>;
export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function lchown(path: string | Buffer, uid: number, gid: number): Promise<void>;
export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void;
export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function link(srcpath: string | Buffer, dstpath: string | Buffer): Promise<void>;
export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void;
export function lstat(path: string | Buffer): Promise<Stats>;
/**
@@ -156,7 +157,7 @@ export function lstat(path: string | Buffer): Promise<Stats>;
* @param path
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void;
export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
/**
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
*
@@ -164,35 +165,36 @@ export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoExcept
* @param mode
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException) => void): void;
export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function mkdir(path: string | Buffer): Promise<void>;
export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, mode?: number): Promise<number>;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null,
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: Buffer) => void): void;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null): Promise<ReadResult>;
export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise<string>;
// tslint:disable-next-line:unified-signatures
export function readFile(file: string | Buffer | number, encoding: string): Promise<string>;
export function readFile(file: string | Buffer | number): Promise<Buffer>;
export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
export function readdir(path: string | Buffer): Promise<string[]>;
export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void;
export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, linkString: string) => any): void;
export function readlink(path: string | Buffer): Promise<string>;
export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, cache?: { [path: string]: string }): Promise<string>;
export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException) => void): void;
export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function rename(oldPath: string, newPath: string): Promise<void>;
/**
@@ -201,17 +203,17 @@ export function rename(oldPath: string, newPath: string): Promise<void>;
* @param path
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void;
export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function rmdir(path: string | Buffer): Promise<void>;
export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void;
export function stat(path: string | Buffer): Promise<Stats>;
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException) => void): void;
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): Promise<void>;
export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void;
export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function truncate(path: string | Buffer, len?: number): Promise<void>;
/**
@@ -220,25 +222,25 @@ export function truncate(path: string | Buffer, len?: number): Promise<void>;
* @param path
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException) => void): void;
export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function unlink(path: string | Buffer): Promise<void>;
export function utimes(path: string | Buffer, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException) => void): void;
export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function utimes(path: string | Buffer, atime: number, mtime: number): Promise<void>;
export function utimes(path: string | Buffer, atime: Date, mtime: Date): Promise<void>;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: Buffer) => void): void;
export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position?: number | null): Promise<WriteResult>;
export function write(fd: number, data: any, offset: number, encoding?: string): Promise<WriteResult>;
export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function writeFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): Promise<void>;
export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback: (err: NodeJS.ErrnoException) => void): void;
export function writeFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback: (err: NodeJS.ErrnoException | null) => void): void;
/**
* Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
@@ -247,7 +249,7 @@ export function writeFile(file: string | Buffer | number, data: any, options: {
* @param callback The created folder path is passed as a string to the callback's second parameter.
*/
export function mkdtemp(prefix: string): Promise<string>;
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void;
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
export interface PathEntry {
path: string;
+12 -5
View File
@@ -42,11 +42,7 @@ declare namespace gapi.auth2 {
/**
* Get permission from the user to access the specified scopes offline.
*/
grantOfflineAccess(options?: {
scope?: string;
prompt?: "select_account" | "consent";
app_package_name?: string;
}): any;
grantOfflineAccess(options?: OfflineAccessOptions): Promise<{code: string}>;
/**
* Attaches the sign-in flow to the specified container's click handler.
@@ -107,6 +103,17 @@ declare namespace gapi.auth2 {
scope?: string;
}
/**
* Definitions by: John <https://github.com/jhcao23>
* Interface that represents the different configuration parameters for the GoogleAuth.grantOfflineAccess(options) method.
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2offlineaccessoptions
*/
interface OfflineAccessOptions {
scope?: string;
prompt?: "select_account" | "consent";
app_package_name?: string;
}
/**
* Interface that represents the different configuration parameters for the gapi.auth2.init method.
* Reference: https://developers.google.com/api-client-library/javascript/reference/referencedocs#gapiauth2clientconfig
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+28 -5
View File
@@ -1,5 +1,5 @@
// common
import { vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat } from "gl-matrix";
import { glMatrix, vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat } from "gl-matrix";
var outVal: number;
var outBool: boolean;
@@ -294,8 +294,9 @@ outMat4 = mat4.fromXRotation(outMat4, Math.PI);
outMat4 = mat4.fromYRotation(outMat4, Math.PI);
outMat4 = mat4.fromZRotation(outMat4, Math.PI);
outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
outVec3 = mat4.getTranslation(outVec3, mat4A)
outQuat = mat4.getRotation(outQuat, mat4A)
outVec3 = mat4.getTranslation(outVec3, mat4A);
outVec3 = mat4.getScaling(outVec3, mat4A);
outQuat = mat4.getRotation(outQuat, mat4A);
outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
outMat4 = mat4.fromQuat(outMat4, quatB);
@@ -349,7 +350,18 @@ outQuat = quat.calculateW(outQuat, quatA);
outBool = quat.exactEquals(quatA, quatB);
outBool = quat.equals(quatA, quatB);
// glMatrix
outVal = glMatrix.RANDOM();
outVal = glMatrix.EPSILON;
outBool = glMatrix.ENABLE_SIMD;
outBool = glMatrix.SIMD_AVAILABLE;
outBool = glMatrix.USE_SIMD;
outBool = glMatrix.equals(1, 1);
outBool = glMatrix.equals(1, -1);
outVal = glMatrix.toRadian(10);
// common
import _glMatrix = require('gl-matrix/src/gl-matrix/common');
import _vec2 = require('gl-matrix/src/gl-matrix/vec2');
import _vec3 = require('gl-matrix/src/gl-matrix/vec3');
import _vec4 = require('gl-matrix/src/gl-matrix/vec4');
@@ -643,8 +655,9 @@ outMat4 = _mat4.fromXRotation(outMat4, Math.PI);
outMat4 = _mat4.fromYRotation(outMat4, Math.PI);
outMat4 = _mat4.fromZRotation(outMat4, Math.PI);
outMat4 = _mat4.fromRotationTranslation(outMat4, quatA, vec3A);
outVec3 = _mat4.getTranslation(outVec3, mat4A)
outQuat = _mat4.getRotation(outQuat, mat4A)
outVec3 = _mat4.getTranslation(outVec3, mat4A);
outVec3 = _mat4.getScaling(outVec3, mat4A);
outQuat = _mat4.getRotation(outQuat, mat4A);
outMat4 = _mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
outMat4 = _mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
outMat4 = _mat4.fromQuat(outMat4, quatB);
@@ -697,3 +710,13 @@ outQuat = _quat.fromMat3(outQuat, mat3A);
outQuat = _quat.calculateW(outQuat, quatA);
outBool = _quat.exactEquals(quatA, quatB);
outBool = _quat.equals(quatA, quatB);
// glMatrix common
outVal = _glMatrix.RANDOM();
outVal = _glMatrix.EPSILON;
outBool = _glMatrix.ENABLE_SIMD;
outBool = _glMatrix.SIMD_AVAILABLE;
outBool = _glMatrix.USE_SIMD;
outBool = _glMatrix.equals(1, 1);
outBool = _glMatrix.equals(1, -1);
outVal = _glMatrix.toRadian(10);
+57 -1
View File
@@ -1,9 +1,49 @@
// Type definitions for gl-matrix 2.2.2
// Type definitions for gl-matrix 2.3.2
// Project: https://github.com/toji/gl-matrix
// Definitions by: Mattijs Kneppers <https://github.com/mattijskneppers>, based on definitions by Tat <https://github.com/tatchx>
// Nikolay Babanov <https://github.com/nbabanov>
// Austin Martin <https://github.com/auzmartist>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'gl-matrix' {
// Global Utilities
export class glMatrix {
// Configuration constants
public static EPSILON: number;
public static ARRAY_TYPE: any;
public static RANDOM(): number;
public static ENABLE_SIMD: boolean;
// Compatibility detection
public static SIMD_AVAILABLE: boolean;
public static USE_SIMD: boolean;
/**
* Sets the type of array used when creating new vectors and matrices
*
* @param {any} type - Array type, such as Float32Array or Array
*/
public static setMatrixArrayType(type: any): void;
/**
* Convert Degree To Radian
*
* @param {number} a - Angle in Degrees
*/
public static toRadian(a: number): number;
/**
* Tests whether or not the arguments have approximately the same value, within an absolute
* or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
* than or equal to 1.0, and a relative tolerance is used for larger values)
*
* @param {number} a - The first number to test.
* @param {number} b - The second number to test.
* @returns {boolean} True if the numbers are approximately equal, false otherwise.
*/
public static equals(a: number, b: number): boolean;
}
// vec2
export class vec2 extends Float32Array {
private typeVec2: number;
@@ -2450,6 +2490,17 @@ declare module 'gl-matrix' {
*/
public static getTranslation(out: vec3, mat: mat4): vec3;
/**
* Returns the scaling factor component of a transformation matrix.
* If a matrix is built with fromRotationTranslationScale with a
* normalized Quaternion parameter, the returned vector will be
* the same as the scaling vector originally supplied.
* @param {vec3} out Vector to receive scaling factor component
* @param {mat4} mat Matrix to be decomposed (input)
* @return {vec3} out
*/
public static getScaling(out: vec3, mat: mat4): vec3;
/**
* Returns a quaternion representing the rotational component
* of a transformation matrix. If a matrix is built with
@@ -3045,6 +3096,11 @@ declare module 'gl-matrix' {
}
}
declare module 'gl-matrix/src/gl-matrix/common' {
import { glMatrix } from 'gl-matrix';
export = glMatrix;
}
declare module 'gl-matrix/src/gl-matrix/vec2' {
import { vec2 } from 'gl-matrix';
export = vec2;
+10
View File
@@ -100,6 +100,14 @@ declare namespace libphonenumber {
TOO_SHORT,
TOO_LONG
}
export enum MatchType {
EXACT_MATCH,
NO_MATCH,
NOT_A_NUMBER,
NSN_MATCH,
SHORT_NSN_MATCH
}
}
export class PhoneNumberUtil {
@@ -109,6 +117,7 @@ declare namespace libphonenumber {
getNumberType(phoneNumber: PhoneNumber): PhoneNumberType;
getRegionCodeForCountryCode(countryCallingCode: number): string;
getRegionCodeForNumber(phoneNumber: PhoneNumber): string | undefined;
getSupportedRegions():string [];
isAlphaNumber(number: string): boolean;
isLeadingZeroPossible(countryCallingCode: number): boolean;
isNANPACountry(regionCode?: string): boolean;
@@ -124,6 +133,7 @@ declare namespace libphonenumber {
parse(number?: string, region?: string): PhoneNumber;
parseAndKeepRawInput(number: string, regionCode?: string): PhoneNumber;
truncateTooLongNumber(number: PhoneNumber): boolean;
isNumberMatch(firstNumber: string | PhoneNumber, secondNumber: string | PhoneNumber): PhoneNumberUtil.MatchType;
}
export class AsYouTypeFormatter {
@@ -96,7 +96,7 @@ function test_barChart() {
role: "annotation" },
2]);
var options = {
var options: google.visualization.BarChartOptions = {
title: "Density of Precious Metals, in g/cm^3",
width: 600,
height: 400,
@@ -139,7 +139,7 @@ function test_histogram() {
['Ultrasaurus (ultra lizard)', 30.5],
['Velociraptor (swift robber)', 1.8]]);
var options = {
var options: google.visualization.HistogramOptions = {
title: 'Lengths of dinosaurs, in meters',
legend: { position: 'none' }
};
+71 -82
View File
@@ -1,6 +1,6 @@
// Type definitions for Google Visualisation Apis
// Project: https://developers.google.com/chart/
// Definitions by: Dan Ludwig <https://github.com/danludwig>, Gregory Moore <https://github.com/gmoore-sjcorg>, Dan Manastireanu <https://github.com/danmana>, Michael Cheng <https://github.com/mlcheng>, Ivan Bisultanov <https://github.com/IvanBisultanov>
// Definitions by: Dan Ludwig <https://github.com/danludwig>, Gregory Moore <https://github.com/gmoore-sjcorg>, Dan Manastireanu <https://github.com/danmana>, Michael Cheng <https://github.com/mlcheng>, Ivan Bisultanov <https://github.com/IvanBisultanov>, Gleb Mazovetskiy <https://github.com/glebm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace google {
@@ -15,7 +15,7 @@ declare namespace google {
function setOnLoadCallback(handler: Function): void;
}
//https://developers.google.com/chart/interactive/docs/reference
// https://developers.google.com/chart/interactive/docs/reference
namespace visualization {
export interface ChartSpecs {
@@ -291,7 +291,7 @@ declare namespace google {
//#endregion
//#region GeoChart
//https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart
// https://developers.google.com/chart/interactive/docs/gallery/geochart
export class GeoChart extends ChartBase {
draw(data: DataTable, options: GeoChartOptions): void;
}
@@ -306,7 +306,7 @@ declare namespace google {
enableRegionInteractivity?: boolean;
height?: number;
keepAspectRatio?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
region?: string;
magnifyingGlass?: GeoChartMagnifyingGlass;
markerOpacity?: number;
@@ -410,23 +410,26 @@ declare namespace google {
}
export interface ChartArea {
top?: any;
left?: any;
right?: any;
bottom?: any;
width?: any;
height?: any;
backgroundColor: string | { stroke: string; strokeWidth?: number };
top?: number | string;
left?: number | string;
right?: number | string;
bottom?: number | string;
width?: number | string;
height?: number | string;
}
export type ChartLegendPosition = 'bottom' | 'left' | 'in' | 'none' | 'right' | 'top';
export type ChartLegendAlignment = 'start' | 'center' | 'end';
export interface ChartLegend {
alignment?: string;
alignment?: ChartLegendAlignment;
maxLines?: number;
position?: string;
position?: ChartLegendPosition;
textStyle?: ChartTextStyle;
numberFormat?: string;
}
// https://google-developers.appspot.com/chart/interactive/docs/animation
// https://developers.google.com/chart/interactive/docs/animation
export interface TransitionAnimation {
duration?: number;
easing?: string; // linear, in, out, inAndOut
@@ -434,7 +437,7 @@ declare namespace google {
}
export interface ChartAxis {
baseline?: number; // This option is only supported for a continuous axis. https://google-developers.appspot.com/chart/interactive/docs/customizing_axes#Terminology
baseline?: number; // This option is only supported for a continuous axis. https://developers.google.com/chart/interactive/docs/customizing_axes#Terminology
baselineColor?: string; // google's documentation on this is wrong, specifies it as a number. The color of the baseline for the horizontal axis. Can be any HTML color string, for example: 'red' or '#00cc00'
direction?: number; // The direction in which the values along the horizontal axis grow. Specify -1 to reverse the order of the values.
format?: string; // icu pattern set http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
@@ -536,7 +539,7 @@ declare namespace google {
//#endregion
//#region ScatterChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/scatterchart
// https://developers.google.com/chart/interactive/docs/gallery/scatterchart
export class ScatterChart extends CoreChartBase {
draw(data: DataTable | DataView, options?: ScatterChartOptions): void;
}
@@ -559,7 +562,7 @@ declare namespace google {
forceIFrame?: boolean;
hAxis?: ChartAxis;
height?: number;
legend?: ChartLegend | "none";
legend?: ChartLegend | 'none';
lineWidth?: number;
pointSize?: number;
selectionMode?: string;
@@ -576,13 +579,12 @@ declare namespace google {
//#endregion
//#region ColumnChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart
// https://developers.google.com/chart/interactive/docs/gallery/columnchart
export class ColumnChart extends CoreChartBase {
draw(data: DataTable, options: ColumnChartOptions): void;
draw(data: DataView, options: ColumnChartOptions): void;
draw(data: DataTable | DataView, options: ColumnChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/columnchart#Configuration_Options
export interface ColumnChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -599,7 +601,7 @@ declare namespace google {
hAxis?: ChartAxis;
height?: number;
isStacked?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
reverseCategories?: boolean;
selectionMode?: string // single / multiple
series?: any;
@@ -616,13 +618,12 @@ declare namespace google {
//#endregion
//#region LineChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart
// https://developers.google.com/chart/interactive/docs/gallery/linechart
export class LineChart extends CoreChartBase {
draw(data: DataTable, options: LineChartOptions): void;
draw(data: DataView, options: LineChartOptions): void;
draw(data: DataTable | DataView, options: LineChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/linechart#Configuration_Options
export interface LineChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -642,7 +643,7 @@ declare namespace google {
hAxis?: ChartAxis;
height?: number;
interpolateNulls?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
lineWidth?: number;
orientation?: string;
pointSize?: number;
@@ -662,7 +663,7 @@ declare namespace google {
//#endregion
//#region BarChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/barchart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/barchart#Configuration_Options
export interface BarChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -681,7 +682,7 @@ declare namespace google {
hAxis?: ChartAxis;
height?: number;
isStacked?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
reverseCategories?: boolean;
series?: any;
theme?: string;
@@ -694,22 +695,20 @@ declare namespace google {
width?: number;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/barchart
// https://developers.google.com/chart/interactive/docs/gallery/barchart
export class BarChart extends CoreChartBase {
draw(data: DataTable, options: BarChartOptions): void;
draw(data: DataView, options: BarChartOptions): void;
draw(data: DataTable | DataView, options: BarChartOptions): void;
}
//#endregion
//#region Histogram
// https://google-developers.appspot.com/chart/interactive/docs/gallery/histogram
// https://developers.google.com/chart/interactive/docs/gallery/histogram
export class Histogram extends CoreChartBase {
draw(data: DataTable, options: HistogramOptions): void;
draw(data: DataView, options: HistogramOptions): void;
draw(data: DataTable | DataView, options: HistogramOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/histogram#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/histogram#Configuration_Options
export interface HistogramOptions {
animation?: TransitionAnimation;
axisTitlesPosition?: string; // in, out, none
@@ -727,7 +726,7 @@ declare namespace google {
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
orientation?: string;
reverseCategories?: boolean;
series?: any;
@@ -750,13 +749,12 @@ declare namespace google {
//#endregion
//#region AreaChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/areachart
// https://developers.google.com/chart/interactive/docs/gallery/areachart
export class AreaChart extends CoreChartBase {
draw(data: DataTable, options: AreaChartOptions): void;
draw(data: DataView, options: AreaChartOptions): void;
draw(data: DataTable | DataView, options: AreaChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/areachart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/areachart#Configuration_Options
export interface AreaChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -777,7 +775,7 @@ declare namespace google {
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
lineWidth?: number;
orientation?: string;
pointSize?: number;
@@ -800,8 +798,7 @@ declare namespace google {
// https://developers.google.com/chart/interactive/docs/gallery/annotationchart
export class AnnotationChart extends CoreChartBase
{
draw(data: DataTable, options: AnnotationChartOptions): void;
draw(data: DataView, options: AnnotationChartOptions): void;
draw(data: DataTable | DataView, options: AnnotationChartOptions): void;
setVisibleChartRange(start: Date, end: Date): void;
getVisibleChartRange(): {start: Date; end: Date };
hideDataColumns(columnIndexes: number | number[]): void;
@@ -825,7 +822,7 @@ declare namespace google {
displayRangeSelector?: boolean;
displayZoomButtons?: boolean;
fill?: number;
legendPosition?: string;
legendPosition?: 'sameRow' | 'newRow';
max?: number;
min?: number;
numberFormats?: any;
@@ -840,13 +837,12 @@ declare namespace google {
//#endregion
//#region SteppedAreaChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/areachart
// https://developers.google.com/chart/interactive/docs/gallery/areachart
export class SteppedAreaChart extends CoreChartBase {
draw(data: DataTable, options: SteppedAreaChartOptions): void;
draw(data: DataView, options: SteppedAreaChartOptions): void;
draw(data: DataTable | DataView, options: SteppedAreaChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/areachart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/areachart#Configuration_Options
export interface SteppedAreaChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -864,7 +860,7 @@ declare namespace google {
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
reverseCategories?: boolean;
selectionMode?: string // single / multiple
series?: any;
@@ -881,13 +877,12 @@ declare namespace google {
//#endregion
//#region PieChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart
// https://developers.google.com/chart/interactive/docs/gallery/piechart
export class PieChart extends CoreChartBase {
draw(data: DataTable, options: PieChartOptions): void;
draw(data: DataView, options: PieChartOptions): void;
draw(data: DataTable | DataView, options: PieChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/piechart#Configuration_Options
export interface PieChartOptions {
backgroundColor?: any;
chartArea?: ChartArea;
@@ -897,7 +892,7 @@ declare namespace google {
fontName?: string;
height?: number;
is3D?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
pieHole?: number;
pieSliceBorderColor?: string;
pieSliceText?: string;
@@ -917,10 +912,9 @@ declare namespace google {
//#endregion
//#region BubbleChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/scatterchart
// https://developers.google.com/chart/interactive/docs/gallery/scatterchart
export class BubbleChart extends CoreChartBase {
draw(data: DataTable, options?: BubbleChartOptions): void;
draw(data: DataView, options?: BubbleChartOptions): void;
draw(data: DataTable | DataView, options?: BubbleChartOptions): void;
}
export interface BubbleChartOptions {
@@ -938,7 +932,7 @@ declare namespace google {
forceIFrame?: boolean;
hAxis?: ChartAxis;
height?: number;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
selectionMode?: string;
series?: any;
sizeAxis?: ChartSizeAxis;
@@ -968,15 +962,14 @@ declare namespace google {
//#endregion
//#region TreeMap
// https://google-developers.appspot.com/chart/interactive/docs/gallery/treemap
// https://developers.google.com/chart/interactive/docs/gallery/treemap
export class TreeMap extends ChartBase {
draw(data: DataTable, options?: TreeMapOptions): void;
draw(data: DataView, options?: TreeMapOptions): void;
draw(data: DataTable | DataView, options?: TreeMapOptions): void;
goUpAndDraw(): void;
getMaxPossibleDepth(): number;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/treemap#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/treemap#Configuration_Options
export interface TreeMapOptions {
fontColor?: string;
fontFamily?: string;
@@ -1007,13 +1000,12 @@ declare namespace google {
//#endregion
//#region Table
// https://google-developers.appspot.com/chart/interactive/docs/gallery/table
// https://developers.google.com/chart/interactive/docs/gallery/table
export class Table extends ChartBase {
draw(data: DataTable, options?: TableOptions): void;
draw(data: DataView, options?: TableOptions): void;
draw(data: DataTable | DataView, options?: TableOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/table#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/table#Configuration_Options
export interface TableOptions {
allowHtml?: boolean;
alternatingRowStyle?: boolean;
@@ -1046,15 +1038,14 @@ declare namespace google {
//#endregion
//#region Timeline
// https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline
// https://developers.google.com/chart/interactive/docs/gallery/timeline
export class Timeline {
constructor(element: Element);
draw(data: DataTable, options?: TimelineOptions): void;
draw(data: DataView, options?: TimelineOptions): void;
draw(data: DataTable | DataView, options?: TimelineOptions): void;
clearChart(): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/timeline#Configuration_Options
export interface TimelineOptions {
avoidOverlappingGridLines?: boolean;
backgroundColor?: any;
@@ -1082,12 +1073,12 @@ declare namespace google {
//#endregion
//#region CandlestickChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/candlestickchart
// https://developers.google.com/chart/interactive/docs/gallery/candlestickchart
export class CandlestickChart extends CoreChartBase {
draw(data: DataTable | DataView, options: CandlestickChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/candlestickchart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/candlestickchart#Configuration_Options
export interface CandlestickChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -1103,7 +1094,7 @@ declare namespace google {
fontName?: string;
hAxis?: ChartAxis;
height?: number;
legend?: ChartLegend | "none";
legend?: ChartLegend | 'none';
orientation?: string;
reverseCategories?: boolean;
selectionMode?: string // single / multiple
@@ -1121,13 +1112,12 @@ declare namespace google {
//#endregion
//#region ComboChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart
// https://developers.google.com/chart/interactive/docs/gallery/combochart
export class ComboChart extends CoreChartBase {
draw(data: DataTable, options: ComboChartOptions): void;
draw(data: DataView, options: ComboChartOptions): void;
draw(data: DataTable | DataView, options: ComboChartOptions): void;
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/combochart#configuration-options
// https://developers.google.com/chart/interactive/docs/gallery/combochart#configuration-options
export interface ComboChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
@@ -1151,7 +1141,7 @@ declare namespace google {
height?: number;
interpolateNulls?: boolean;
isStacked?: boolean;
legend?: ChartLegend;
legend?: ChartLegend | 'none';
lineDashStyle?: number[];
lineWidth?: number;
orientation?: string;
@@ -1383,16 +1373,15 @@ declare namespace google {
//#endregion
//#region OrgChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/orgchart
// https://developers.google.com/chart/interactive/docs/gallery/orgchart
export class OrgChart extends CoreChartBase {
draw(data: DataTable, options: OrgChartOptions): void;
draw(data: DataView, options: OrgChartOptions): void;
draw(data: DataTable | DataView, options: OrgChartOptions): void;
collapse(row: number, collapsed: boolean): void;
getChildrenIndexes(row: number): number[];
getCollapsedNodes(): number[];
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/orgchart#Configuration_Options
// https://developers.google.com/chart/interactive/docs/gallery/orgchart#Configuration_Options
export interface OrgChartOptions {
allowCollapse?: boolean;
allowHtml?: boolean;
+3
View File
@@ -173,3 +173,6 @@ got('todomvc.com', {
'user-agent': `my-module/ (https://github.com/username/my-module)`
}
});
got('https://httpbin.org/404')
.catch(err => err instanceof got.HTTPError && err.statusCode === 404);
+49 -43
View File
@@ -13,10 +13,59 @@ import * as nodeStream from 'stream';
export = got;
declare class RequestError extends StdError {
name: 'RequestError';
}
declare class ReadError extends StdError {
name: 'ReadError';
}
declare class ParseError extends StdError {
name: 'ParseError';
statusCode: number;
statusMessage: string;
}
declare class HTTPError extends StdError {
name: 'HTTPError';
statusCode: number;
statusMessage: string;
headers: http.IncomingHttpHeaders;
}
declare class MaxRedirectsError extends StdError {
name: 'MaxRedirectsError';
statusCode: number;
statusMessage: string;
redirectUrls: string[];
}
declare class UnsupportedProtocolError extends StdError {
name: 'UnsupportedProtocolError';
}
declare class StdError extends Error {
code?: string;
host?: string;
hostname?: string;
method?: string;
path?: string;
protocol?: string;
url?: string;
response?: any;
}
declare const got: got.GotFn &
Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', got.GotFn> &
{
stream: got.GotStreamFn & Record<'get' | 'post' | 'put' | 'patch' | 'head' | 'delete', got.GotStreamFn>
RequestError: typeof RequestError
ReadError: typeof ReadError
ParseError: typeof ParseError
HTTPError: typeof HTTPError
MaxRedirectsError: typeof MaxRedirectsError
UnsupportedProtocolError: typeof UnsupportedProtocolError
};
declare namespace got {
@@ -111,47 +160,4 @@ declare namespace got {
}
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError;
interface RequestError extends StdError {
name: 'RequestError';
}
interface ReadError extends StdError {
name: 'ReadError';
}
interface ParseError extends StdError {
name: 'ParseError';
statusCode: number;
statusMessage: string;
}
interface HTTPError extends StdError {
name: 'HTTPError';
statusCode: number;
statusMessage: string;
headers: http.IncomingHttpHeaders;
}
interface MaxRedirectsError extends StdError {
name: 'MaxRedirectsError';
statusCode: number;
statusMessage: string;
redirectUrls: string[];
}
interface UnsupportedProtocolError extends StdError {
name: 'UnsupportedProtocolError';
}
interface StdError extends Error {
code?: string;
host?: string;
hostname?: string;
method?: string;
path?: string;
protocol?: string;
url?: string;
response?: any;
}
}
+1
View File
@@ -7,6 +7,7 @@
// Kepennar <https://github.com/kepennar>
// Mikhail Novikov <https://github.com/freiksenet>
// Ivan Goncharov <https://github.com/IvanGoncharov>
// Hagai Cohen <https://github.com/DxCx>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+2 -2
View File
@@ -14,7 +14,7 @@ export function subscribe(
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>,
subscribeFieldResolver?: GraphQLFieldResolver<any, any>
): AsyncIterator<ExecutionResult>;
): Promise<AsyncIterator<ExecutionResult> | ExecutionResult>;
export function createSourceEventStream(
schema: GraphQLSchema,
@@ -26,4 +26,4 @@ export function createSourceEventStream(
},
operationName?: string,
fieldResolver?: GraphQLFieldResolver<any, any>
): AsyncIterable<any>;
): Promise<AsyncIterable<any>>;
+1 -1
View File
@@ -51,7 +51,7 @@ export class GraphQLSchema {
getMutationType(): GraphQLObjectType|null|undefined;
getSubscriptionType(): GraphQLObjectType|null|undefined;
getTypeMap(): { [typeName: string]: GraphQLNamedType };
getType(name: string): GraphQLType;
getType(name: string): GraphQLNamedType;
getPossibleTypes(abstractType: GraphQLAbstractType): GraphQLObjectType[];
isPossibleType(
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+991
View File
@@ -0,0 +1,991 @@
import fs = require('hexo-fs');
import path = require('path');
import mocha = require('mocha');
import chai = require('chai');
import Promise = require('bluebird');
const should = chai.should();
const { join } = path;
function createDummyFolder(path: string) {
return Promise.all([
// Normal files in a hidden folder
fs.writeFile(join(path, '.hidden', 'a.txt'), 'a'),
fs.writeFile(join(path, '.hidden', 'b.js'), 'b'),
// Normal folder in a hidden folder
fs.writeFile(join(path, '.hidden', 'c', 'd'), 'd'),
// Top-class files
fs.writeFile(join(path, 'e.txt'), 'e'),
fs.writeFile(join(path, 'f.js'), 'f'),
// A hidden file
fs.writeFile(join(path, '.g'), 'g'),
// Files in a normal folder
fs.writeFile(join(path, 'folder', 'h.txt'), 'h'),
fs.writeFile(join(path, 'folder', 'i.js'), 'i'),
// A hidden files in a normal folder
fs.writeFile(join(path, 'folder', '.j'), 'j')
]);
}
const tmpDir = join(__dirname, 'fs_tmp');
before(() => fs.mkdirs(tmpDir));
after((done) => {
fs.rmdir(tmpDir);
done();
});
it('exists()', () => {
return fs.exists(tmpDir).then((exist) => {
exist.should.be.true;
});
});
it('exists() - callback', (callback) => {
fs.exists(tmpDir, (exist) => {
exist.should.be.true;
callback();
});
});
it('mkdirs()', () => {
const target = join(tmpDir, 'a', 'b', 'c');
return fs.mkdirs(target).then(() => {
return fs.exists(target);
}).then((exist) => {
exist.should.be.true;
return fs.rmdir(join(tmpDir, 'a'));
});
});
it('mkdirs() - callback', (callback) => {
const target = join(tmpDir, 'a', 'b', 'c');
fs.mkdirs(target, (err) => {
should.not.exist(err);
fs.exists(target, (exist) => {
exist.should.be.true;
fs.rmdir(join(tmpDir, 'a'), callback);
});
});
});
it('mkdirsSync()', () => {
const target = join(tmpDir, 'a', 'b', 'c');
fs.mkdirsSync(target);
return fs.exists(target).then((exist) => {
exist.should.be.true;
return fs.rmdir(join(tmpDir, 'a'));
});
});
it('writeFile()', () => {
const target = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
return fs.writeFile(target, body).then(() => {
return fs.readFile(target);
}).then((content) => {
content.should.eql(body);
return fs.rmdir(join(tmpDir, 'a'));
});
});
it('writeFile() - callback', (callback) => {
const target = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
fs.writeFile(target, body, (err) => {
should.not.exist(err);
fs.readFile(target, (_, content) => {
content!.should.eql(body);
fs.rmdir(join(tmpDir, 'a'), callback);
});
});
});
it('writeFileSync()', () => {
const target = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
fs.writeFileSync(target, body);
return fs.readFile(target).then((content) => {
content.should.eql(body);
return fs.rmdir(join(tmpDir, 'a'));
});
});
it('appendFile()', () => {
const target = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
const body2 = 'bar';
return fs.writeFile(target, body).then(() => {
return fs.appendFile(target, body2);
}).then(() => {
return fs.readFile(target);
}).then((content) => {
content.should.eql(body + body2);
return fs.rmdir(join(tmpDir, 'a'));
});
});
it('appendFile() - callback', (callback) => {
const target = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
const body2 = 'bar';
fs.writeFile(target, body, () => {
fs.appendFile(target, body2, (err) => {
should.not.exist(err);
fs.readFile(target, (_, content) => {
content!.should.eql(body + body2);
fs.rmdir(join(tmpDir, 'a'), callback);
});
});
});
});
it('appendFileSync()', () => {
const target = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
const body2 = 'bar';
return fs.writeFile(target, body).then(() => {
fs.appendFileSync(target, body2);
return fs.readFile(target);
}).then((content) => {
content.should.eql(body + body2);
return fs.rmdir(join(tmpDir, 'a'));
});
});
it('copyFile()', () => {
const src = join(tmpDir, 'test.txt');
const dest = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
return fs.writeFile(src, body).then(() => {
return fs.copyFile(src, dest);
}).then(() => {
return fs.readFile(dest);
}).then((content) => {
content.should.eql(body);
return Promise.all([
fs.unlink(src),
fs.rmdir(join(tmpDir, 'a'))
]);
});
});
it('copyFile() - callback', (callback) => {
const src = join(tmpDir, 'test.txt');
const dest = join(tmpDir, 'a', 'b', 'test.txt');
const body = 'foo';
fs.writeFile(src, body, (err) => {
if (err) return callback(err);
fs.copyFile(src, dest, (err) => {
if (err) return callback(err);
fs.readFile(dest, (err, content) => {
if (err) return callback(err);
content!.should.eql(body);
Promise.all([
fs.unlink(src),
fs.rmdir(join(tmpDir, 'a'))
]).asCallback(callback);
});
});
});
});
it('copyDir()', () => {
const src = join(tmpDir, 'a');
const dest = join(tmpDir, 'b');
return createDummyFolder(src).then(() => {
return fs.copyDir(src, dest);
}).then((files) => {
files.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
return Promise.all([
fs.readFile(join(dest, 'e.txt')),
fs.readFile(join(dest, 'f.js')),
fs.readFile(join(dest, 'folder', 'h.txt')),
fs.readFile(join(dest, 'folder', 'i.js'))
]);
}).then((result) => {
result.should.eql(['e', 'f', 'h', 'i']);
}).then(() => {
return Promise.all([
fs.rmdir(src),
fs.rmdir(dest)
]);
});
});
it('copyDir() - callback', (callback) => {
const src = join(tmpDir, 'a');
const dest = join(tmpDir, 'b');
createDummyFolder(src).then(() => {
fs.copyDir(src, dest, (err, files) => {
should.not.exist(err);
files!.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
Promise.all([
fs.readFile(join(dest, 'e.txt')),
fs.readFile(join(dest, 'f.js')),
fs.readFile(join(dest, 'folder', 'h.txt')),
fs.readFile(join(dest, 'folder', 'i.js'))
]).then((result) => {
result.should.eql(['e', 'f', 'h', 'i']);
}).then(() => {
return Promise.all([
fs.rmdir(src),
fs.rmdir(dest)
]);
}).asCallback(callback);
});
});
});
it('copyDir() - ignoreHidden off', () => {
const src = join(tmpDir, 'a');
const dest = join(tmpDir, 'b');
return createDummyFolder(src).then(() => {
return fs.copyDir(src, dest, { ignoreHidden: false });
}).then((files) => {
files.should.have.members([
join('.hidden', 'a.txt'),
join('.hidden', 'b.js'),
join('.hidden', 'c', 'd'),
'e.txt',
'f.js',
'.g',
join('folder', 'h.txt'),
join('folder', 'i.js'),
join('folder', '.j')
]);
return Promise.all([
fs.readFile(join(dest, '.hidden', 'a.txt')),
fs.readFile(join(dest, '.hidden', 'b.js')),
fs.readFile(join(dest, '.hidden', 'c', 'd')),
fs.readFile(join(dest, 'e.txt')),
fs.readFile(join(dest, 'f.js')),
fs.readFile(join(dest, '.g')),
fs.readFile(join(dest, 'folder', 'h.txt')),
fs.readFile(join(dest, 'folder', 'i.js')),
fs.readFile(join(dest, 'folder', '.j'))
]);
}).then((result) => {
result.should.eql(['a', 'b', 'd', 'e', 'f', 'g', 'h', 'i', 'j']);
}).then(() => {
return Promise.all([
fs.rmdir(src),
fs.rmdir(dest)
]);
});
});
it('copyDir() - ignorePattern', () => {
const src = join(tmpDir, 'a');
const dest = join(tmpDir, 'b');
return createDummyFolder(src).then(() => {
return fs.copyDir(src, dest, { ignorePattern: /\.js/ });
}).then((files) => {
files.should.have.members(['e.txt', join('folder', 'h.txt')]);
return Promise.all([
fs.readFile(join(dest, 'e.txt')),
fs.readFile(join(dest, 'folder', 'h.txt'))
]);
}).then((result) => {
result.should.eql(['e', 'h']);
}).then(() => {
return Promise.all([
fs.rmdir(src),
fs.rmdir(dest)
]);
});
});
it('listDir()', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.listDir(target);
}).then((files) => {
files.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
return fs.rmdir(target);
});
});
it('listDir() - callback', (callback) => {
const target = join(tmpDir, 'test');
createDummyFolder(target).then(() => {
fs.listDir(target, (err, files) => {
if (err) return callback(err);
files!.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
fs.rmdir(target, callback);
});
});
});
it('listDir() - ignoreHidden off', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.listDir(target, { ignoreHidden: false });
}).then((files) => {
files.should.have.members([
join('.hidden', 'a.txt'),
join('.hidden', 'b.js'),
join('.hidden', 'c', 'd'),
'e.txt',
'f.js',
'.g',
join('folder', 'h.txt'),
join('folder', 'i.js'),
join('folder', '.j')
]);
return fs.rmdir(target);
});
});
it('listDir() - ignorePattern', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.listDir(target, { ignorePattern: /\.js/ });
}).then((files) => {
files.should.have.members(['e.txt', join('folder', 'h.txt')]);
return fs.rmdir(target);
});
});
it('listDirSync()', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
const files = fs.listDirSync(target);
files.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
return fs.rmdir(target);
});
});
it('listDirSync() - ignoreHidden off', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
const files = fs.listDirSync(target, { ignoreHidden: false });
files.should.have.members([
join('.hidden', 'a.txt'),
join('.hidden', 'b.js'),
join('.hidden', 'c', 'd'),
'e.txt',
'f.js',
'.g',
join('folder', 'h.txt'),
join('folder', 'i.js'),
join('folder', '.j')
]);
return fs.rmdir(target);
});
});
it('listDirSync() - ignorePattern', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
const files = fs.listDirSync(target, { ignorePattern: /\.js/ });
files.should.have.members(['e.txt', join('folder', 'h.txt')]);
return fs.rmdir(target);
});
});
it('readFile()', () => {
const target = join(tmpDir, 'test.txt');
const body = 'test';
return fs.writeFile(target, body).then(() => {
return fs.readFile(target);
}).then((content) => {
content.should.eql(body);
return fs.unlink(target);
});
});
it('readFile() - callback', (callback) => {
const target = join(tmpDir, 'test.txt');
const body = 'test';
fs.writeFile(target, body, (err) => {
if (err) return callback(err);
fs.readFile(target, (err, content) => {
if (err) return callback(err);
content!.should.eql(body);
fs.unlink(target).asCallback(callback);
});
});
});
it('readFile() - escape BOM', () => {
const target = join(tmpDir, 'test.txt');
const body = '\ufefffoo';
return fs.writeFile(target, body).then(() => {
return fs.readFile(target);
}).then((content) => {
content.should.eql('foo');
return fs.unlink(target);
});
});
it('readFile() - escape Windows line ending', () => {
const target = join(tmpDir, 'test.txt');
const body = 'foo\r\nbar';
return fs.writeFile(target, body).then(() => {
return fs.readFile(target);
}).then((content) => {
content.should.eql('foo\nbar');
return fs.unlink(target);
});
});
it('readFileSync()', () => {
const target = join(tmpDir, 'test.txt');
const body = 'test';
return fs.writeFile(target, body).then(() => {
fs.readFileSync(target).should.eql(body);
return fs.unlink(target);
});
});
it('readFileSync() - escape BOM', () => {
const target = join(tmpDir, 'test.txt');
const body = '\ufefffoo';
return fs.writeFile(target, body).then(() => {
fs.readFileSync(target).should.eql('foo');
return fs.unlink(target);
});
});
it('readFileSync() - escape Windows line ending', () => {
const target = join(tmpDir, 'test.txt');
const body = 'foo\r\nbar';
return fs.writeFile(target, body).then(() => {
fs.readFileSync(target).should.eql('foo\nbar');
return fs.unlink(target);
});
});
it('unlink()', () => {
const target = join(tmpDir, 'test-unlink');
return fs.writeFile(target, '').then(() => {
return fs.exists(target);
}).then((exist) => {
exist.should.eql(true);
return fs.unlink(target);
}).then(() => {
return fs.exists(target);
}).then((exist) => {
exist.should.eql(false);
});
});
it('emptyDir()', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.emptyDir(target);
}).then<Array<[string, boolean]>>((files) => {
files.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
return [
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), false],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), false],
[join(target, 'folder', '.j'), true]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDir() - callback', (callback) => {
const target = join(tmpDir, 'test');
createDummyFolder(target).then(() => {
fs.emptyDir(target, (err, files) => {
if (err) return callback(err);
files!.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
Promise.map<[string, boolean], void>([
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), false],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), false],
[join(target, 'folder', '.j'), true]
], (data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
}).asCallback(callback);
});
});
});
it('emptyDir() - ignoreHidden off', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.emptyDir(target, { ignoreHidden: false });
}).then<Array<[string, boolean]>>((files) => {
files.should.have.members([
join('.hidden', 'a.txt'),
join('.hidden', 'b.js'),
join('.hidden', 'c', 'd'),
'e.txt',
'f.js',
'.g',
join('folder', 'h.txt'),
join('folder', 'i.js'),
join('folder', '.j')
]);
return [
[join(target, '.hidden', 'a.txt'), false],
[join(target, '.hidden', 'b.js'), false],
[join(target, '.hidden', 'c', 'd'), false],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), false],
[join(target, '.g'), false],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), false],
[join(target, 'folder', '.j'), false]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDir() - ignorePattern', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.emptyDir(target, { ignorePattern: /\.js/ });
}).then<Array<[string, boolean]>>((files) => {
files.should.have.members(['e.txt', join('folder', 'h.txt')]);
return [
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), true],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), true],
[join(target, 'folder', '.j'), true]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDir() - exclude', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.emptyDir(target, { exclude: ['e.txt', join('folder', 'i.js')] });
}).then<Array<[string, boolean]>>((files) => {
files.should.have.members(['f.js', join('folder', 'h.txt')]);
return [
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), true],
[join(target, 'f.js'), false],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), true],
[join(target, 'folder', '.j'), true]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDirSync()', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then<Array<[string, boolean]>>(() => {
const files = fs.emptyDirSync(target);
files.should.have.members([
'e.txt',
'f.js',
join('folder', 'h.txt'),
join('folder', 'i.js')
]);
return [
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), false],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), false],
[join(target, 'folder', '.j'), true]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDirSync() - ignoreHidden off', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then<Array<[string, boolean]>>(() => {
const files = fs.emptyDirSync(target, { ignoreHidden: false });
files.should.have.members([
join('.hidden', 'a.txt'),
join('.hidden', 'b.js'),
join('.hidden', 'c', 'd'),
'e.txt',
'f.js',
'.g',
join('folder', 'h.txt'),
join('folder', 'i.js'),
join('folder', '.j')
]);
return [
[join(target, '.hidden', 'a.txt'), false],
[join(target, '.hidden', 'b.js'), false],
[join(target, '.hidden', 'c', 'd'), false],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), false],
[join(target, '.g'), false],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), false],
[join(target, 'folder', '.j'), false]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDirSync() - ignorePattern', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then<Array<[string, boolean]>>(() => {
const files = fs.emptyDirSync(target, { ignorePattern: /\.js/ });
files.should.have.members(['e.txt', join('folder', 'h.txt')]);
return [
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), false],
[join(target, 'f.js'), true],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), true],
[join(target, 'folder', '.j'), true]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('emptyDirSync() - exclude', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then<Array<[string, boolean]>>(() => {
const files = fs.emptyDirSync(target, { exclude: ['e.txt', join('folder', 'i.js')] });
files.should.have.members(['f.js', join('folder', 'h.txt')]);
return [
[join(target, '.hidden', 'a.txt'), true],
[join(target, '.hidden', 'b.js'), true],
[join(target, '.hidden', 'c', 'd'), true],
[join(target, 'e.txt'), true],
[join(target, 'f.js'), false],
[join(target, '.g'), true],
[join(target, 'folder', 'h.txt'), false],
[join(target, 'folder', 'i.js'), true],
[join(target, 'folder', '.j'), true]
];
}).map((data: [string, boolean]) => {
return fs.exists(data[0]).then((exist) => {
exist.should.eql(data[1]);
});
}).then(() => {
return fs.rmdir(target);
});
});
it('rmdir()', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
return fs.rmdir(target);
}).then(() => {
return fs.exists(target);
}).then((exist) => {
exist.should.be.false;
});
});
it('rmdir() - callback', (callback) => {
const target = join(tmpDir, 'test');
createDummyFolder(target).then(() => {
fs.rmdir(target, (err) => {
should.not.exist(err);
fs.exists(target, (exist) => {
exist.should.be.false;
callback();
});
});
});
});
it('rmdirSync()', () => {
const target = join(tmpDir, 'test');
return createDummyFolder(target).then(() => {
fs.rmdirSync(target);
return fs.exists(target);
}).then((exist) => {
exist.should.be.false;
});
});
import { FSWatcher } from 'chokidar';
it('watch()', () => {
let watcher: FSWatcher;
return fs.watch(tmpDir).then((watcher_) => {
watcher = watcher_;
return new Promise((resolve, reject) => {
const path = join(tmpDir, 'test.txt');
watcher.on('add', (path_) => {
path_.should.eql(path);
resolve();
});
fs.writeFile(path, 'test').catch(reject);
});
}).finally(() => {
if (watcher) watcher.close();
});
});
it('ensurePath() - file exists', () => {
const target = join(tmpDir, 'test');
return Promise.all([
fs.writeFile(join(target, 'foo.txt'), ''),
fs.writeFile(join(target, 'foo-1.txt'), ''),
fs.writeFile(join(target, 'foo-2.md'), ''),
fs.writeFile(join(target, 'bar.txt'), '')
]).then(() => {
return fs.ensurePath(join(target, 'foo.txt'));
}).then((path) => {
path.should.eql(join(target, 'foo-2.txt'));
return fs.rmdir(target);
});
});
it('ensurePath() - file not exist', () => {
const target = join(tmpDir, 'foo.txt');
return fs.ensurePath(target).then((path) => {
path.should.eql(target);
});
});
it('ensurePath() - callback', (callback) => {
const target = join(tmpDir, 'test');
Promise.all([
fs.writeFile(join(target, 'foo.txt'), ''),
fs.writeFile(join(target, 'foo-1.txt'), ''),
fs.writeFile(join(target, 'foo-2.md'), ''),
fs.writeFile(join(target, 'bar.txt'), '')
]).then(() => {
fs.ensurePath(join(target, 'foo.txt'), (err, path) => {
should.not.exist(err);
path!.should.eql(join(target, 'foo-2.txt'));
fs.rmdir(target, callback);
});
});
});
it('ensurePathSync() - file exists', () => {
const target = join(tmpDir, 'test');
return Promise.all([
fs.writeFile(join(target, 'foo.txt'), ''),
fs.writeFile(join(target, 'foo-1.txt'), ''),
fs.writeFile(join(target, 'foo-2.md'), ''),
fs.writeFile(join(target, 'bar.txt'), '')
]).then(() => {
const path = fs.ensurePathSync(join(target, 'foo.txt'));
path.should.eql(join(target, 'foo-2.txt'));
return fs.rmdir(target);
});
});
it('ensurePathSync() - file not exist', () => {
const target = join(tmpDir, 'foo.txt');
const path = fs.ensurePathSync(target);
path.should.eql(target);
});
it('ensureWriteStream()', () => {
const target = join(tmpDir, 'foo', 'bar.txt');
return fs.ensureWriteStream(target).then((stream) => {
stream.path.should.eql(target);
stream.on('finish', () => {
return fs.unlink(target);
});
});
});
it('ensureWriteStream() - callback', (callback) => {
const target = join(tmpDir, 'foo', 'bar.txt');
fs.ensureWriteStream(target, (err, stream) => {
should.not.exist(err);
stream!.path.should.eql(target);
callback();
});
});
it('ensureWriteStreamSync()', () => {
const target = join(tmpDir, 'foo', 'bar.txt');
const stream = fs.ensureWriteStreamSync(target);
stream.path.should.eql(target);
stream.on('finish', () => {
return fs.rmdir(path.dirname(target));
});
});
+436
View File
@@ -0,0 +1,436 @@
// Type definitions for hexo-fs 0.2
// Project: http://hexo.io/
// Definitions by: segayuu <https://github.com/segayuu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Promise = require('bluebird');
import {
PathLike,
Stats,
ReadStream,
WriteStream,
// chmod,
chmodSync,
// fchmod,
fchmodSync,
// lchmod,
lchmodSync,
// chown,
chownSync,
// fchown,
fchownSync,
// lchown,
lchownSync,
// close,
closeSync,
createReadStream,
createWriteStream,
// fsync,
fsyncSync,
// link,
linkSync,
// mkdir,
mkdirSync,
// open,
openSync,
// symlink,
symlinkSync,
// read,
readSync,
// readdir,
readdirSync,
// readlink,
readlinkSync,
// realpath,
realpathSync,
// rename,
renameSync,
// stat,
statSync,
// fstat,
fstatSync,
// lstat,
lstatSync,
// truncate,
truncateSync,
// ftruncate,
ftruncateSync,
// unlink,
unlinkSync,
// utimes,
utimesSync,
// futimes,
futimesSync,
watchFile,
unwatchFile,
// write,
writeSync
} from 'graceful-fs';
export interface DirectoryOptions {
ignoreHidden?: boolean;
ignorePattern?: RegExp;
}
export interface AppendFileOptions {
encoding?: string | null;
mode?: string | number;
flag?: string;
}
// access
export let F_OK: number | undefined;
export let R_OK: number | undefined;
export let W_OK: number | undefined;
export let X_OK: number | undefined;
export let access: ((path: PathLike, mode?: number) => Promise<void>) | undefined; // promisify
export let accessSync: ((path: PathLike, mode?: number) => void) | undefined; // promisify
// appendFile
/**
* Appends data to a file.
* @param path
* @param data
* @param callback
*/
export function appendFile(path: string, data: any, callback?: (err: any) => void): Promise<void>;
/**
* Appends data to a file.
* @param path
* @param data
* @param options
* @param callback
*/
export function appendFile(path: string, data: any, options: string | AppendFileOptions, callback?: (err: any) => void): Promise<void>;
/**
* Synchronous version of fs.appendFile.
* @param path
* @param data
* @param options
*/
export function appendFileSync(path: string, data: any, options?: string | AppendFileOptions): void;
// chmod
export function chmod(path: PathLike, mode: string | number): Promise<void>; // promisify
export function fchmod(fd: number, mode: string | number): Promise<void>; // promisify
export function lchmod(path: PathLike, mode: string | number): Promise<void>; // promisify
export { chmodSync, fchmodSync, lchmodSync };
// chown
export function chown(path: PathLike, uid: number, gid: number): Promise<void>; // promisify
export function fchown(fd: number, uid: number, gid: number): Promise<void>; // promisify
export function lchown(path: PathLike, uid: number, gid: number): Promise<void>; // promisify
export { chownSync, fchownSync, lchownSync };
// close
export function close(fd: number): Promise<void>; // promisify
export { closeSync };
// copy
/**
* Copies a directory from src to dest. It returns an array of copied files.
* @param src
* @param dest
* @param callback
*/
export function copyDir(src: string, dest: string, callback?: (err: any, value?: string[]) => void): Promise<string[]>;
/**
* Copies a directory from src to dest. It returns an array of copied files.
* @param dest
* @param options
* @param callback
*/
export function copyDir(src: string, dest: string, options?: DirectoryOptions, callback?: (err: any, value?: string[]) => void): Promise<string[]>;
/**
* Copies a file from src to dest.
* @param src
* @param dest
* @param callback
*/
export function copyFile(src: PathLike, dest: string, callback?: (err: any) => void): Promise<void>;
// createStream
export { createReadStream, createWriteStream };
// emptyDir
/**
* Deletes all files in a directory. It returns an array of deleted files.
* @param path
* @param callback
*/
export function emptyDir(path: string, callback?: (err: any, value?: string | string[]) => void): Promise<string | string[]>;
export function emptyDir(
path: string,
options?: DirectoryOptions & { exclude?: string[] },
callback?: (err: any, value?: string | string[]) => void
): Promise<string | string[]>;
export function emptyDirSync(path: string, options?: DirectoryOptions & { exclude?: string[] }, parent?: string): string | string[];
// ensurePath
/**
* Ensures the given path is available to use or appends a number to the path.
* @param path
* @param callback
*/
export function ensurePath(path: string, callback?: (err: any, value?: string) => void): Promise<string>;
/**
* Synchronous version of `fs.ensurePath`.
* @param path
*/
export function ensurePathSync(path: string): string;
// ensureWriteStream
/**
* Creates the parent directories if they does not exist and returns a writable stream.
* @param path
* @param callback
*/
export function ensureWriteStream(path: string, callback?: (err: any, value?: WriteStream) => void): Promise<WriteStream>;
/**
* Creates the parent directories if they does not exist and returns a writable stream.
* @param path
* @param options
* @param callback
*/
export function ensureWriteStream(
path: string,
options?: string | {
flags?: string;
defaultEncoding?: string;
fd?: number;
mode?: number;
autoClose?: boolean;
start?: number;
},
callback?: (err: any, value?: WriteStream) => void
): Promise<WriteStream>;
/**
* Synchronous version of fs.ensureWriteStream.
* @param path
* @param options
*/
export function ensureWriteStreamSync(path: string, options?: string | {
flags?: string;
defaultEncoding?: string;
fd?: number;
mode?: number;
autoClose?: boolean;
start?: number;
}): WriteStream;
// exists
/**
* Test whether or not the given `path` exists by checking with the file system.
* @param path checking if exists.
* @param callback
*/
export function exists(path: PathLike, callback?: (exist: boolean) => void): Promise<boolean>;
/**
* Synchronous version of `fs.exists`.
* @param path
*/
export function existsSync(path: PathLike): boolean;
// fsync
export function fsync(fd: number): Promise<void>; // promisify
export { fsyncSync };
// link
export function link(existingPath: PathLike, newPath: PathLike): Promise<void>; // promisify
export { linkSync };
// listDir
/**
* Lists files in a directory.
* @param path
* @param callback
*/
export function listDir(path: string, callback?: (err: any, value?: string[]) => void): Promise<string[]>;
/**
* Lists files in a directory.
* @param path
* @param options
* @param callback
*/
export function listDir(path: string, options?: DirectoryOptions, callback?: (err: any, value?: string[]) => void): Promise<string[]>;
/**
* Synchronous version of `fs.listDir`.
* @param path
* @param options
* @param parent
*/
export function listDirSync(path: string, options?: DirectoryOptions, parent?: string): string | string[];
// mkdir
export function mkdir(path: PathLike, mode?: string | number): Promise<void>; // promisify
export { mkdirSync };
// mkdirs
/**
* Creates a directory and its parent directories if they does not exist.
* @param path
* @param callback
*/
export function mkdirs(path: PathLike, callback?: (err: any) => void): Promise<void>;
/**
* Synchronous version of `fs.mkdirs`.
* @param path
*/
export function mkdirsSync(path: string): void;
// open
export function open(path: PathLike, flags: string | number, mode?: string | number | null): Promise<number>; // promisify
export { openSync };
// symlink
export function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>; // promisify
export { symlinkSync };
// read
export function read<TBuffer extends Buffer | Uint8Array>(
fd: number,
buffer: TBuffer,
offset: number,
length: number,
position: number | null
): Promise<{ bytesRead: number, buffer: TBuffer }>; // promisify
export { readSync };
// readdir
export function readdir(path: PathLike, options?: { encoding: BufferEncoding | null } | BufferEncoding | null): Promise<string[]>; // promisify
export function readdir(path: PathLike, options: "buffer" | { encoding: "buffer" }): Promise<Buffer[]>; // promisify
export function readdir(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<Array<string | Buffer>>; // promisify
export { readdirSync };
// readFile
/**
* Reads the entire contents of a file.
* @param path
* @param callback
*/
export function readFile(path: PathLike | number, callback?: (err: any, value?: string) => void): Promise<string>;
/**
* Reads the entire contents of a file.
* @param path
* @param options
* @param callback
*/
export function readFile(
path: PathLike | number,
options?: { encoding?: string; flag?: string; escape?: boolean; },
callback?: (err: any, value?: string) => void
): Promise<string>;
/**
* Synchronous version of `fs.readFile`.
* @param path
* @param options
*/
export function readFileSync(path: PathLike | number, options?: { encoding?: string; flag?: string; escape?: boolean; }): string;
// readlink
export function readlink(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>; // promisify
export function readlink(path: PathLike, options: { encoding: 'buffer' } | 'buffer'): Promise<Buffer>; // promisify
export function readlink(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>; // promisify
export { readlinkSync };
// realpath
export function realpath(path: PathLike, options?: { encoding?: BufferEncoding | null } | BufferEncoding | null): Promise<string>; // promisify
export function realpath(path: PathLike, options: { encoding: 'buffer' } | 'buffer'): Promise<Buffer>; // promisify
export function realpath(path: PathLike, options?: { encoding?: string | null } | string | null): Promise<string | Buffer>; // promisify
export { realpathSync };
// rename
export function rename(oldPath: PathLike, newPath: PathLike): Promise<void>; // promisify
export { renameSync };
// rmdir
export function rmdir(path: string, callback?: (err: any) => void): Promise<void>;
export function rmdirSync(path: string): void;
// stat
export function stat(path: PathLike): Promise<Stats>; // promisify
export function fstat(fd: number): Promise<Stats>; // promisify
export function lstat(path: PathLike): Promise<Stats>; // promisify
export { statSync, fstatSync, lstatSync };
// truncate
export function truncate(path: PathLike, len?: number | null): Promise<void>; // promisify
export function ftruncate(fd: number, len?: number | null): Promise<void>; // promisify
export { truncateSync, ftruncateSync };
// unlink
export function unlink(path: PathLike): Promise<void>; // promisify
export { unlinkSync };
// utimes
export function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>; // promisify
export function futimes(fd: number, atime: string | number | Date, mtime: string | number | Date): Promise<void>; // promisify
export { utimesSync, futimesSync };
// watch
import { FSWatcher, WatchOptions } from 'chokidar';
/**
* Watches changes of a file or a directory.
*
* See Chokidar API for more info.
* @param path
* @param options
* @param callback
*/
export function watch(path: string | string[], options?: WatchOptions, callback?: (err: any, value?: FSWatcher) => void): Promise<FSWatcher>;
export { watchFile, unwatchFile };
// write
export function write<TBuffer extends Buffer | Uint8Array>(
fd: number,
buffer?: TBuffer,
offset?: number,
length?: number,
position?: number | null
): Promise<{ bytesWritten: number, buffer: TBuffer }>; // promisify
export function write(
fd: number,
string: any,
position?: number | null,
encoding?: string | null
): Promise<{ bytesWritten: number, buffer: string }>; // promisify
export { writeSync };
// writeFile
/**
* Writes data to a file.
* @param path
* @param data
* @param callback
*/
export function writeFile(path: string, data: any, callback?: (err: any) => void): Promise<void>;
/**
* Writes data to a file.
* @param path
* @param data
* @param options
* @param callback
*/
export function writeFile(
path: string,
data: any,
options?: string | { encoding?: string | null; mode?: string | number; flag?: string },
callback?: (err: any) => void
): Promise<void>;
/**
* Synchronous version of `fs.writeFile`.
* @param path
* @param data
* @param options
*/
export function writeFileSync(path: string, data: any, options?: string | { encoding?: string | null; mode?: string | number; flag?: string }): void;
// Static classes
export let Stats: Stats;
export let ReadStream: ReadStream;
export let WriteStream: WriteStream;
// util
export function escapeEOL(str: string): string;
export function escapeBOM(str: string): string;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"hexo-fs-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4 -1
View File
@@ -1,6 +1,8 @@
// Type definitions for Highstock 2.1.5
// Project: http://www.highcharts.com/
// Definitions by: David Deutsch <https://github.com/DavidKDeutsch>
// Definitions by: David Deutsch <http://github.com/DavidKDeutsch>
// Definitions by: Dave Baumann <https://github.com/route2Dev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Highcharts from "highcharts";
@@ -100,6 +102,7 @@ declare namespace Highstock {
interface Static extends Highcharts.Static {
StockChart: Chart;
stockChart(renderTo: string | HTMLElement, options: Options, callback?: (chart: ChartObject) => void): ChartObject;
}
}
+3 -1
View File
@@ -575,7 +575,7 @@ declare namespace Highcharts {
* categories: ['Apples', 'Bananas', 'Oranges']
* @default null
*/
categories?: string[];
categories?: any[];
/**
* The highest allowed value for automatically computed axis extremes.
* @since 4.0
@@ -1994,6 +1994,8 @@ declare namespace Highcharts {
position?: string;
top?: string;
textOutline?: string;
textOverflow?: string;
whiteSpace?: string;
}
interface CreditsOptions {
+3 -1
View File
@@ -231,6 +231,8 @@ barStream = fooStream.map((x: Foo) => {
barStream = fooStream.pluck<Bar>(str);
fooStream = fooStream.ratelimit(3, 1000);
barStream = fooStream.reduce(bar, (memo: Bar, x: Foo) => {
return memo;
});
@@ -405,4 +407,4 @@ num = _.add(num, num);
numCurNum = _.add(num);
//missing not
//missing not
+20
View File
@@ -765,6 +765,26 @@ declare namespace Highland {
*/
pluck<U>(prop: string): Stream<U>;
/**
* Limits number of values through the stream to a maximum of number of values
* per window. Errors are not limited but allowed to pass through as soon as
* they are read from the source.
*
* @id ratelimit
* @section Transforms
* @name Stream.ratelimit(num, ms)
* @param {Number} num - the number of operations to perform per window
* @param {Number} ms - the window of time to limit the operations in (in ms)
* @api public
*
* _([1, 2, 3, 4, 5]).ratelimit(2, 100);
*
* // after 0ms => 1, 2
* // after 100ms => 1, 2, 3, 4
* // after 200ms => 1, 2, 3, 4, 5
*/
ratelimit(num: number, ms: number): Stream<R>;
/**
* Boils down a Stream to a single value. The memo is the initial state
* of the reduction, and each successive step of it should be returned by
+7 -1
View File
@@ -1,10 +1,12 @@
// Type definitions for htmlparser2 v3.7.x
// Project: https://github.com/fb55/htmlparser2/
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
// Linus Unnebäck <https://github.com/LinusU>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
///<reference types="node"/>
import { Writable } from 'stream'
export interface Handler {
onopentag?: (name: string, attribs: { [type: string]: string }) => void;
@@ -60,6 +62,10 @@ export interface Options {
recognizeSelfClosing?: boolean;
}
export declare class WritableStream extends Writable {
constructor(handler: Handler, options?: Options);
}
export declare class Parser {
constructor(handler: Handler, options?: Options);
+24085 -13917
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "dtslint/dt.json" }
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}
+95
View File
@@ -0,0 +1,95 @@
// Type definitions for jest-validate 21.0
// Project: https://github.com/facebook/jest/tree/master/packages/jest-validate
// Definitions by: Ika <https://github.com/ikatyang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export class ValidationError extends Error {
name: string;
message: string;
constructor(name: string, message: string, comment?: string);
}
export function createDidYouMeanMessage(
unrecognized: string,
allowedOptions: string[]
): string;
export function format(value: any): string;
export function logValidationWarning(
name: string,
message: string,
commant?: string
): void;
export interface Title {
deprecation?: string;
error?: string;
warning?: string;
}
export interface DeprecatedConfig {
[key: string]: (config: object) => string;
}
export interface ValidationOptions {
/**
* optional string to be rendered below error/warning message.
*/
comment?: string;
/**
* an optional function with validation condition.
*/
condition?(value: any, exampleValue: any): boolean;
/**
* optional object with deprecated config keys.
*/
deprecatedConfig?: DeprecatedConfig;
/**
* the only **required** option with configuration against which you'd like to test.
*/
exampleConfig: object;
/**
* optional object of titles for errors and messages.
*/
title?: Title;
/**
* optional functions responsible for displaying warning and error messages.
*/
deprecate?(
config: object,
key: string,
deprecatedConfig: DeprecatedConfig,
options: ValidationOptions
): boolean;
/**
* optional functions responsible for displaying warning and error messages.
*/
error?(
key: string,
received: any,
exampleValue: any,
options: ValidationOptions
): void;
/**
* optional functions responsible for displaying warning and error messages.
*/
unknown?(
config: object,
exampleConfig: object,
key: string,
options: ValidationOptions
): void;
}
/**
* By default jest-validate will print generic warning and error messages.
* You can however customize this behavior by providing `options: ValidationOptions` object as a second argument:
*
* Almost anything can be overwritten to suite your needs.
*/
export function validate(
config: object,
options: ValidationOptions
): { hasDeprecationWarnings: boolean; isValid: boolean };

Some files were not shown because too many files have changed in this diff Show More