diff --git a/types/angular-clipboard/angular-clipboard-tests.ts b/types/angular-clipboard/angular-clipboard-tests.ts index 00c5074ec5..6df5af0c5e 100644 --- a/types/angular-clipboard/angular-clipboard-tests.ts +++ b/types/angular-clipboard/angular-clipboard-tests.ts @@ -1,5 +1,5 @@ import * as angular from "angular"; -import {ClipboardService} from "angular-clipboard"; +import { ClipboardService } from "angular-clipboard"; interface TestScope extends ng.IScope { [index: string]: any; diff --git a/types/angular/angular-component-router.d.ts b/types/angular/angular-component-router.d.ts index da3afc7a71..b8c939f7c8 100644 --- a/types/angular/angular-component-router.d.ts +++ b/types/angular/angular-component-router.d.ts @@ -15,7 +15,7 @@ declare namespace angular { * ### Example * * ``` - * import {Component} from 'angular2/core'; + * import { Component } from 'angular2/core'; * import {bootstrap} from 'angular2/platform/browser'; * import {Router, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, RouteConfig} from 'angular2/router'; * diff --git a/types/argparse/argparse-tests.ts b/types/argparse/argparse-tests.ts index cec1ece95b..f5b9e76f81 100644 --- a/types/argparse/argparse-tests.ts +++ b/types/argparse/argparse-tests.ts @@ -1,7 +1,7 @@ // near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples -import {ArgumentParser, RawDescriptionHelpFormatter} from 'argparse'; +import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse'; var args: any; var simpleExample = new ArgumentParser({ diff --git a/types/arrify/index.d.ts b/types/arrify/index.d.ts index fb552e161e..896ee23224 100644 --- a/types/arrify/index.d.ts +++ b/types/arrify/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for arrify 1.0.1 +// Type definitions for arrify 1.0 // Project: https://github.com/sindresorhus/arrify // Definitions by: AnJun Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/arrify/tsconfig.json b/types/arrify/tsconfig.json index b2579c233e..e0ac439953 100644 --- a/types/arrify/tsconfig.json +++ b/types/arrify/tsconfig.json @@ -19,4 +19,4 @@ "index.d.ts", "arrify-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/arrify/tslint.json b/types/arrify/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/arrify/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/askmethat-rating/askmethat-rating-tests.ts b/types/askmethat-rating/askmethat-rating-tests.ts index 2f17ad0b62..af0ab3cb88 100644 --- a/types/askmethat-rating/askmethat-rating-tests.ts +++ b/types/askmethat-rating/askmethat-rating-tests.ts @@ -13,3 +13,6 @@ let options = { let div = document.createElement("div"); let amcRating = new AskmethatRating(div, 2 , options); + +options.readonly = true; +amcRating.defaultOptions = options; diff --git a/types/askmethat-rating/index.d.ts b/types/askmethat-rating/index.d.ts index ff31f81747..43a59957bd 100644 --- a/types/askmethat-rating/index.d.ts +++ b/types/askmethat-rating/index.d.ts @@ -75,7 +75,12 @@ export class AskmethatRating { * * @return options based on @type AskmethatRatingOptions */ - readonly defaultOptions: any; + /** + * @function set the default option for the rating + * + * @return options based on @type AskmethatRatingOptions + */ + defaultOptions: AskmethatRatingOptions; /** * constructor with div element, default rating value & default options * @@ -122,6 +127,12 @@ export class AskmethatRating { * Update readonly status if needed for the rating */ private mutationEvent(); + /** + * This is fired by mutation observer when an attribute changed in the hidden input + * Is protected to have some unit tests + * @param {MutationRecord[]} mutations list of mutations record + */ + protected mutationDisableEvent(mutations: MutationRecord[]): void; /** * @function static method to retrieve with identifier the value * @param {string} identifier: string container identifier diff --git a/types/assert-plus/index.d.ts b/types/assert-plus/index.d.ts index d79172bc49..6c1f369729 100644 --- a/types/assert-plus/index.d.ts +++ b/types/assert-plus/index.d.ts @@ -5,7 +5,7 @@ /// -import {Stream} from 'stream'; +import { Stream } from 'stream'; export function array(arr: any[], message ?: string): void; diff --git a/types/async.nexttick/async.nexttick-tests.ts b/types/async.nexttick/async.nexttick-tests.ts index 90f6ae7f15..876a8e0f88 100644 --- a/types/async.nexttick/async.nexttick-tests.ts +++ b/types/async.nexttick/async.nexttick-tests.ts @@ -1,4 +1,4 @@ -import {nextTick} from 'async.nexttick'; +import { nextTick } from 'async.nexttick'; function calledOnNextTick(a: string): number { return parseInt(a, 10); diff --git a/types/auto-sni/index.d.ts b/types/auto-sni/index.d.ts index bc252831ca..19272446a6 100644 --- a/types/auto-sni/index.d.ts +++ b/types/auto-sni/index.d.ts @@ -5,7 +5,7 @@ /// -import {Server} from "https"; +import { Server } from "https"; declare namespace createServer { interface Options { diff --git a/types/babel-core/babel-core-tests.ts b/types/babel-core/babel-core-tests.ts index 4c62d3c2f5..45fc649549 100644 --- a/types/babel-core/babel-core-tests.ts +++ b/types/babel-core/babel-core-tests.ts @@ -1,7 +1,5 @@ - import * as babel from "babel-core"; - // Example from https://github.com/babel/babel/tree/master/packages/babel-core const code = `class Example {}`; const result = babel.transform(code, { /* options */ }); @@ -9,7 +7,6 @@ result.code; // Generated code result.map; // Sourcemap result.ast; // AST - // Examples from http://babeljs.io/docs/usage/api/ let options: babel.TransformOptions = { plugins: [ @@ -23,7 +20,7 @@ let options: babel.TransformOptions = { sourceMaps: true }; -babel.transformFile("filename.js", options, function (err, result) { +babel.transformFile("filename.js", options, (err, result) => { result.code; result.map; result.ast; diff --git a/types/babel-core/index.d.ts b/types/babel-core/index.d.ts index 029d5b5433..d3b3053a84 100644 --- a/types/babel-core/index.d.ts +++ b/types/babel-core/index.d.ts @@ -1,22 +1,17 @@ -// Type definitions for babel-core v6.7 +// Type definitions for babel-core 6.25 // Project: https://github.com/babel/babel/tree/master/packages/babel-core // Definitions by: Troy Gerwien // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// -/// -/// - import * as t from 'babel-types'; export {t as types}; -type Node = t.Node; +export type Node = t.Node; export import template = require('babel-template'); -export var version: string; -import traverse, {Visitor} from "babel-traverse"; -export {traverse, Visitor}; - +export const version: string; +import traverse, { Visitor } from "babel-traverse"; +export { traverse, Visitor }; /** Transforms the passed in `code`. Returning an object with the generated code, source map, and AST. */ export function transform(code: string, opts?: TransformOptions): BabelFileResult; @@ -30,7 +25,6 @@ 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; @@ -38,7 +32,7 @@ export interface TransformOptions { filenameRelative?: string; /** A source map object that the output source map will be based on. */ - inputSourceMap?: Object; + inputSourceMap?: object; /** * This is an object of keys that represent different environments. For example, you may have: @@ -46,7 +40,7 @@ export interface TransformOptions { * which will use those options when the enviroment variable `BABEL_ENV` is set to `"production"`. * If `BABEL_ENV` isn't set then `NODE_ENV` will be used, if it's not set then it defaults to `"development"`. */ - env?: Object; + env?: object; /** Retain line numbers - will result in really ugly code. Default: `false` */ retainLines?: boolean; @@ -85,7 +79,7 @@ export interface TransformOptions { * An optional callback that controls whether a comment should be output or not. Called as * `shouldPrintComment(commentContents)`. **NOTE**: This overrides the `comments` option when used. */ - shouldPrintComment?: (comment: string) => boolean; + shouldPrintComment?(comment: string): boolean; /** * Do not include superfluous whitespace characters and line terminators. When set to `"auto"`, `compact` is set to @@ -122,7 +116,7 @@ export interface TransformOptions { * 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; + getModuleId?(moduleName: string): string; /** Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. */ moduleRoot?: string; @@ -140,7 +134,6 @@ export interface TransformOptions { export interface BabelFileResult { ast?: Node; code?: string; - map?: Object; + map?: object; } export as namespace babel; - diff --git a/types/babel-core/tslint.json b/types/babel-core/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/babel-core/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/babel-generator/babel-generator-tests.ts b/types/babel-generator/babel-generator-tests.ts index 92c65b7f54..1aeec38831 100644 --- a/types/babel-generator/babel-generator-tests.ts +++ b/types/babel-generator/babel-generator-tests.ts @@ -1,5 +1,5 @@ // Example from https://github.com/babel/babel/tree/master/packages/babel-generator -import {parse} from 'babylon'; +import { parse } from 'babylon'; import generate from 'babel-generator'; const code = 'class Example {}'; diff --git a/types/babel-template/babel-template-tests.ts b/types/babel-template/babel-template-tests.ts index 31e3bd44d9..684a291be7 100644 --- a/types/babel-template/babel-template-tests.ts +++ b/types/babel-template/babel-template-tests.ts @@ -1,5 +1,3 @@ -/// - // Example from https://github.com/babel/babel/tree/master/packages/babel-template import template = require('babel-template'); import generate from 'babel-generator'; diff --git a/types/babel-template/index.d.ts b/types/babel-template/index.d.ts index fd0852127a..467b0193e7 100644 --- a/types/babel-template/index.d.ts +++ b/types/babel-template/index.d.ts @@ -1,15 +1,11 @@ -// Type definitions for babel-template v6.7 +// Type definitions for babel-template 6.25 // Project: https://github.com/babel/babel/tree/master/packages/babel-template // Definitions by: Troy Gerwien // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// -/// - - -import {BabylonOptions} from 'babylon'; +import { BabylonOptions } from 'babylon'; import * as t from 'babel-types'; type Node = t.Node; @@ -20,4 +16,3 @@ export = template; declare function template(code: string, opts?: BabylonOptions): UseTemplate; type UseTemplate = (nodes?: {[placeholder: string]: Node}) => Node; - diff --git a/types/babel-template/tslint.json b/types/babel-template/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/babel-template/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/babel-traverse/babel-traverse-tests.ts b/types/babel-traverse/babel-traverse-tests.ts index 5952faefd1..571620fd09 100644 --- a/types/babel-traverse/babel-traverse-tests.ts +++ b/types/babel-traverse/babel-traverse-tests.ts @@ -1,11 +1,7 @@ -/// - - import * as babylon from "babylon"; -import traverse, {Visitor} from 'babel-traverse'; +import traverse, { Visitor } from 'babel-traverse'; import * as t from 'babel-types'; - // Examples from: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md const MyVisitor: Visitor = { Identifier: { @@ -24,7 +20,6 @@ const MyVisitor2: Visitor = { } }; - // Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-traverse const code = `function square(n) { return n * n; @@ -41,11 +36,9 @@ traverse(ast, { } }); - // Examples from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#writing-your-first-babel-plugin const v1: Visitor = { - BinaryExpression(path) { if (t.isIdentifier(path.node.left)) { // ... diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index cb2dd53a84..bf92ae899f 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -1,15 +1,12 @@ -// Type definitions for babel-traverse v6.7 +// Type definitions for babel-traverse 6.25 // Project: https://github.com/babel/babel/tree/master/packages/babel-traverse // Definitions by: Troy Gerwien // Marvin Hagemeister // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// - - import * as t from 'babel-types'; -type Node = t.Node; +export type Node = t.Node; export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; @@ -56,7 +53,7 @@ export class Scope { /** Possibly generate a memoised identifier if it is not static and has consequences. */ maybeGenerateMemoised(node: Node, dontPush?: boolean): t.Identifier; - checkBlockScopedCollisions(local: Node, kind: string, name: string, id: Object): void; + checkBlockScopedCollisions(local: Node, kind: string, name: string, id: object): void; rename(oldName: string, newName?: string, block?: Node): void; @@ -97,7 +94,7 @@ export class Scope { getBlockParent(): Scope; /** Walks the scope tree and gathers **all** bindings. */ - getAllBindings(...kinds: string[]): Object; + getAllBindings(...kinds: string[]): object; bindingIdentifierEquals(name: string, node: Node): boolean; @@ -131,9 +128,9 @@ export class Binding { kind: 'var' | 'let' | 'const' | 'module'; referenced: boolean; references: number; - referencePaths: NodePath[]; + referencePaths: Array>; constant: boolean; - constantViolations: NodePath[]; + constantViolations: Array>; } export interface Visitor extends VisitNodeObject { @@ -319,21 +316,21 @@ export interface VisitNodeObject { exit?(path: NodePath, state: any): void; } -export class NodePath { +export class NodePath { constructor(hub: Hub, parent: Node); parent: Node; hub: Hub; contexts: TraversalContext[]; - data: Object; + data: object; shouldSkip: boolean; shouldStop: boolean; removed: boolean; state: any; - opts: Object; - skipKeys: Object; + opts: object; + skipKeys: object; parentPath: NodePath; context: TraversalContext; - container: Object | Object[]; + container: object | object[]; listKey: string; inList: boolean; parentKey: string; @@ -341,7 +338,7 @@ export class NodePath { node: T; scope: Scope; type: string; - typeAnnotation: Object; + typeAnnotation: object; getScope(scope: Scope): Scope; @@ -357,7 +354,8 @@ export class NodePath { getPathLocation(): string; - debug(buildMessage: Function): void; + // Example: https://github.com/babel/babel/blob/63204ae51e020d84a5b246312f5eeb4d981ab952/packages/babel-traverse/src/path/modification.js#L83 + debug(buildMessage: () => string): void; // ------------------------- ancestry ------------------------- /** @@ -381,17 +379,20 @@ export class NodePath { * Earliest is defined as being "before" all the other nodes in terms of list container * position and visiting key. */ - getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath; + getEarliestCommonAncestorFrom(paths: Array>): Array>; /** Get the earliest path in the tree where the provided `paths` intersect. */ - getDeepestCommonAncestorFrom(paths: NodePath[], filter?: Function): NodePath; + getDeepestCommonAncestorFrom( + paths: Array>, + filter?: (deepest: Node, i: number, ancestries: Array>) => NodePath + ): NodePath; /** * Build an array of node paths containing the entire ancestry of the current node path. * * NOTE: The current node path is included in this. */ - getAncestry(): NodePath[]; + getAncestry(): Array>; inType(...candidateTypes: string[]): boolean; @@ -572,11 +573,9 @@ export class NodePath { hoist(scope: Scope): void; // ------------------------- family ------------------------- - getStatementParent(): NodePath; - getOpposite(): NodePath; - getCompletionRecords(): NodePath[]; + getCompletionRecords(): Array>; getSibling(key: string): NodePath; @@ -596,362 +595,362 @@ export class NodePath { addComments(type: string, comments: any[]): void; // ------------------------- isXXX ------------------------- - isArrayExpression(opts?: Object): boolean; - isAssignmentExpression(opts?: Object): boolean; - isBinaryExpression(opts?: Object): boolean; - isDirective(opts?: Object): boolean; - isDirectiveLiteral(opts?: Object): boolean; - isBlockStatement(opts?: Object): boolean; - isBreakStatement(opts?: Object): boolean; - isCallExpression(opts?: Object): boolean; - isCatchClause(opts?: Object): boolean; - isConditionalExpression(opts?: Object): boolean; - isContinueStatement(opts?: Object): boolean; - isDebuggerStatement(opts?: Object): boolean; - isDoWhileStatement(opts?: Object): boolean; - isEmptyStatement(opts?: Object): boolean; - isExpressionStatement(opts?: Object): boolean; - isFile(opts?: Object): boolean; - isForInStatement(opts?: Object): boolean; - isForStatement(opts?: Object): boolean; - isFunctionDeclaration(opts?: Object): boolean; - isFunctionExpression(opts?: Object): boolean; - isIdentifier(opts?: Object): boolean; - isIfStatement(opts?: Object): boolean; - isLabeledStatement(opts?: Object): boolean; - isStringLiteral(opts?: Object): boolean; - isNumericLiteral(opts?: Object): boolean; - isNullLiteral(opts?: Object): boolean; - isBooleanLiteral(opts?: Object): boolean; - isRegExpLiteral(opts?: Object): boolean; - isLogicalExpression(opts?: Object): boolean; - isMemberExpression(opts?: Object): boolean; - isNewExpression(opts?: Object): boolean; - isProgram(opts?: Object): boolean; - isObjectExpression(opts?: Object): boolean; - isObjectMethod(opts?: Object): boolean; - isObjectProperty(opts?: Object): boolean; - isRestElement(opts?: Object): boolean; - isReturnStatement(opts?: Object): boolean; - isSequenceExpression(opts?: Object): boolean; - isSwitchCase(opts?: Object): boolean; - isSwitchStatement(opts?: Object): boolean; - isThisExpression(opts?: Object): boolean; - isThrowStatement(opts?: Object): boolean; - isTryStatement(opts?: Object): boolean; - isUnaryExpression(opts?: Object): boolean; - isUpdateExpression(opts?: Object): boolean; - isVariableDeclaration(opts?: Object): boolean; - isVariableDeclarator(opts?: Object): boolean; - isWhileStatement(opts?: Object): boolean; - isWithStatement(opts?: Object): boolean; - isAssignmentPattern(opts?: Object): boolean; - isArrayPattern(opts?: Object): boolean; - isArrowFunctionExpression(opts?: Object): boolean; - isClassBody(opts?: Object): boolean; - isClassDeclaration(opts?: Object): boolean; - isClassExpression(opts?: Object): boolean; - isExportAllDeclaration(opts?: Object): boolean; - isExportDefaultDeclaration(opts?: Object): boolean; - isExportNamedDeclaration(opts?: Object): boolean; - isExportSpecifier(opts?: Object): boolean; - isForOfStatement(opts?: Object): boolean; - isImportDeclaration(opts?: Object): boolean; - isImportDefaultSpecifier(opts?: Object): boolean; - isImportNamespaceSpecifier(opts?: Object): boolean; - isImportSpecifier(opts?: Object): boolean; - isMetaProperty(opts?: Object): boolean; - isClassMethod(opts?: Object): boolean; - isObjectPattern(opts?: Object): boolean; - isSpreadElement(opts?: Object): boolean; - isSuper(opts?: Object): boolean; - isTaggedTemplateExpression(opts?: Object): boolean; - isTemplateElement(opts?: Object): boolean; - isTemplateLiteral(opts?: Object): boolean; - isYieldExpression(opts?: Object): boolean; - isAnyTypeAnnotation(opts?: Object): boolean; - isArrayTypeAnnotation(opts?: Object): boolean; - isBooleanTypeAnnotation(opts?: Object): boolean; - isBooleanLiteralTypeAnnotation(opts?: Object): boolean; - isNullLiteralTypeAnnotation(opts?: Object): boolean; - isClassImplements(opts?: Object): boolean; - isClassProperty(opts?: Object): boolean; - isDeclareClass(opts?: Object): boolean; - isDeclareFunction(opts?: Object): boolean; - isDeclareInterface(opts?: Object): boolean; - isDeclareModule(opts?: Object): boolean; - isDeclareTypeAlias(opts?: Object): boolean; - isDeclareVariable(opts?: Object): boolean; - isExistentialTypeParam(opts?: Object): boolean; - isFunctionTypeAnnotation(opts?: Object): boolean; - isFunctionTypeParam(opts?: Object): boolean; - isGenericTypeAnnotation(opts?: Object): boolean; - isInterfaceExtends(opts?: Object): boolean; - isInterfaceDeclaration(opts?: Object): boolean; - isIntersectionTypeAnnotation(opts?: Object): boolean; - isMixedTypeAnnotation(opts?: Object): boolean; - isNullableTypeAnnotation(opts?: Object): boolean; - isNumericLiteralTypeAnnotation(opts?: Object): boolean; - isNumberTypeAnnotation(opts?: Object): boolean; - isStringLiteralTypeAnnotation(opts?: Object): boolean; - isStringTypeAnnotation(opts?: Object): boolean; - isThisTypeAnnotation(opts?: Object): boolean; - isTupleTypeAnnotation(opts?: Object): boolean; - isTypeofTypeAnnotation(opts?: Object): boolean; - isTypeAlias(opts?: Object): boolean; - isTypeAnnotation(opts?: Object): boolean; - isTypeCastExpression(opts?: Object): boolean; - isTypeParameterDeclaration(opts?: Object): boolean; - isTypeParameterInstantiation(opts?: Object): boolean; - isObjectTypeAnnotation(opts?: Object): boolean; - isObjectTypeCallProperty(opts?: Object): boolean; - isObjectTypeIndexer(opts?: Object): boolean; - isObjectTypeProperty(opts?: Object): boolean; - isQualifiedTypeIdentifier(opts?: Object): boolean; - isUnionTypeAnnotation(opts?: Object): boolean; - isVoidTypeAnnotation(opts?: Object): boolean; - isJSXAttribute(opts?: Object): boolean; - isJSXClosingElement(opts?: Object): boolean; - isJSXElement(opts?: Object): boolean; - isJSXEmptyExpression(opts?: Object): boolean; - isJSXExpressionContainer(opts?: Object): boolean; - isJSXIdentifier(opts?: Object): boolean; - isJSXMemberExpression(opts?: Object): boolean; - isJSXNamespacedName(opts?: Object): boolean; - isJSXOpeningElement(opts?: Object): boolean; - isJSXSpreadAttribute(opts?: Object): boolean; - isJSXText(opts?: Object): boolean; - isNoop(opts?: Object): boolean; - isParenthesizedExpression(opts?: Object): boolean; - isAwaitExpression(opts?: Object): boolean; - isBindExpression(opts?: Object): boolean; - isDecorator(opts?: Object): boolean; - isDoExpression(opts?: Object): boolean; - isExportDefaultSpecifier(opts?: Object): boolean; - isExportNamespaceSpecifier(opts?: Object): boolean; - isRestProperty(opts?: Object): boolean; - isSpreadProperty(opts?: Object): boolean; - isExpression(opts?: Object): boolean; - isBinary(opts?: Object): boolean; - isScopable(opts?: Object): boolean; - isBlockParent(opts?: Object): boolean; - isBlock(opts?: Object): boolean; - isStatement(opts?: Object): boolean; - isTerminatorless(opts?: Object): boolean; - isCompletionStatement(opts?: Object): boolean; - isConditional(opts?: Object): boolean; - isLoop(opts?: Object): boolean; - isWhile(opts?: Object): boolean; - isExpressionWrapper(opts?: Object): boolean; - isFor(opts?: Object): boolean; - isForXStatement(opts?: Object): boolean; - isFunction(opts?: Object): boolean; - isFunctionParent(opts?: Object): boolean; - isPureish(opts?: Object): boolean; - isDeclaration(opts?: Object): boolean; - isLVal(opts?: Object): boolean; - isLiteral(opts?: Object): boolean; - isImmutable(opts?: Object): boolean; - isUserWhitespacable(opts?: Object): boolean; - isMethod(opts?: Object): boolean; - isObjectMember(opts?: Object): boolean; - isProperty(opts?: Object): boolean; - isUnaryLike(opts?: Object): boolean; - isPattern(opts?: Object): boolean; - isClass(opts?: Object): boolean; - isModuleDeclaration(opts?: Object): boolean; - isExportDeclaration(opts?: Object): boolean; - isModuleSpecifier(opts?: Object): boolean; - isFlow(opts?: Object): boolean; - isFlowBaseAnnotation(opts?: Object): boolean; - isFlowDeclaration(opts?: Object): boolean; - isJSX(opts?: Object): boolean; - isNumberLiteral(opts?: Object): boolean; - isRegexLiteral(opts?: Object): boolean; - isReferencedIdentifier(opts?: Object): boolean; - isReferencedMemberExpression(opts?: Object): boolean; - isBindingIdentifier(opts?: Object): boolean; - isScope(opts?: Object): boolean; - isReferenced(opts?: Object): boolean; - isBlockScoped(opts?: Object): boolean; - isVar(opts?: Object): boolean; - isUser(opts?: Object): boolean; - isGenerated(opts?: Object): boolean; - isPure(opts?: Object): boolean; + isArrayExpression(opts?: object): boolean; + isAssignmentExpression(opts?: object): boolean; + isBinaryExpression(opts?: object): boolean; + isDirective(opts?: object): boolean; + isDirectiveLiteral(opts?: object): boolean; + isBlockStatement(opts?: object): boolean; + isBreakStatement(opts?: object): boolean; + isCallExpression(opts?: object): boolean; + isCatchClause(opts?: object): boolean; + isConditionalExpression(opts?: object): boolean; + isContinueStatement(opts?: object): boolean; + isDebuggerStatement(opts?: object): boolean; + isDoWhileStatement(opts?: object): boolean; + isEmptyStatement(opts?: object): boolean; + isExpressionStatement(opts?: object): boolean; + isFile(opts?: object): boolean; + isForInStatement(opts?: object): boolean; + isForStatement(opts?: object): boolean; + isFunctionDeclaration(opts?: object): boolean; + isFunctionExpression(opts?: object): boolean; + isIdentifier(opts?: object): boolean; + isIfStatement(opts?: object): boolean; + isLabeledStatement(opts?: object): boolean; + isStringLiteral(opts?: object): boolean; + isNumericLiteral(opts?: object): boolean; + isNullLiteral(opts?: object): boolean; + isBooleanLiteral(opts?: object): boolean; + isRegExpLiteral(opts?: object): boolean; + isLogicalExpression(opts?: object): boolean; + isMemberExpression(opts?: object): boolean; + isNewExpression(opts?: object): boolean; + isProgram(opts?: object): boolean; + isObjectExpression(opts?: object): boolean; + isObjectMethod(opts?: object): boolean; + isObjectProperty(opts?: object): boolean; + isRestElement(opts?: object): boolean; + isReturnStatement(opts?: object): boolean; + isSequenceExpression(opts?: object): boolean; + isSwitchCase(opts?: object): boolean; + isSwitchStatement(opts?: object): boolean; + isThisExpression(opts?: object): boolean; + isThrowStatement(opts?: object): boolean; + isTryStatement(opts?: object): boolean; + isUnaryExpression(opts?: object): boolean; + isUpdateExpression(opts?: object): boolean; + isVariableDeclaration(opts?: object): boolean; + isVariableDeclarator(opts?: object): boolean; + isWhileStatement(opts?: object): boolean; + isWithStatement(opts?: object): boolean; + isAssignmentPattern(opts?: object): boolean; + isArrayPattern(opts?: object): boolean; + isArrowFunctionExpression(opts?: object): boolean; + isClassBody(opts?: object): boolean; + isClassDeclaration(opts?: object): boolean; + isClassExpression(opts?: object): boolean; + isExportAllDeclaration(opts?: object): boolean; + isExportDefaultDeclaration(opts?: object): boolean; + isExportNamedDeclaration(opts?: object): boolean; + isExportSpecifier(opts?: object): boolean; + isForOfStatement(opts?: object): boolean; + isImportDeclaration(opts?: object): boolean; + isImportDefaultSpecifier(opts?: object): boolean; + isImportNamespaceSpecifier(opts?: object): boolean; + isImportSpecifier(opts?: object): boolean; + isMetaProperty(opts?: object): boolean; + isClassMethod(opts?: object): boolean; + isObjectPattern(opts?: object): boolean; + isSpreadElement(opts?: object): boolean; + isSuper(opts?: object): boolean; + isTaggedTemplateExpression(opts?: object): boolean; + isTemplateElement(opts?: object): boolean; + isTemplateLiteral(opts?: object): boolean; + isYieldExpression(opts?: object): boolean; + isAnyTypeAnnotation(opts?: object): boolean; + isArrayTypeAnnotation(opts?: object): boolean; + isBooleanTypeAnnotation(opts?: object): boolean; + isBooleanLiteralTypeAnnotation(opts?: object): boolean; + isNullLiteralTypeAnnotation(opts?: object): boolean; + isClassImplements(opts?: object): boolean; + isClassProperty(opts?: object): boolean; + isDeclareClass(opts?: object): boolean; + isDeclareFunction(opts?: object): boolean; + isDeclareInterface(opts?: object): boolean; + isDeclareModule(opts?: object): boolean; + isDeclareTypeAlias(opts?: object): boolean; + isDeclareVariable(opts?: object): boolean; + isExistentialTypeParam(opts?: object): boolean; + isFunctionTypeAnnotation(opts?: object): boolean; + isFunctionTypeParam(opts?: object): boolean; + isGenericTypeAnnotation(opts?: object): boolean; + isInterfaceExtends(opts?: object): boolean; + isInterfaceDeclaration(opts?: object): boolean; + isIntersectionTypeAnnotation(opts?: object): boolean; + isMixedTypeAnnotation(opts?: object): boolean; + isNullableTypeAnnotation(opts?: object): boolean; + isNumericLiteralTypeAnnotation(opts?: object): boolean; + isNumberTypeAnnotation(opts?: object): boolean; + isStringLiteralTypeAnnotation(opts?: object): boolean; + isStringTypeAnnotation(opts?: object): boolean; + isThisTypeAnnotation(opts?: object): boolean; + isTupleTypeAnnotation(opts?: object): boolean; + isTypeofTypeAnnotation(opts?: object): boolean; + isTypeAlias(opts?: object): boolean; + isTypeAnnotation(opts?: object): boolean; + isTypeCastExpression(opts?: object): boolean; + isTypeParameterDeclaration(opts?: object): boolean; + isTypeParameterInstantiation(opts?: object): boolean; + isObjectTypeAnnotation(opts?: object): boolean; + isObjectTypeCallProperty(opts?: object): boolean; + isObjectTypeIndexer(opts?: object): boolean; + isObjectTypeProperty(opts?: object): boolean; + isQualifiedTypeIdentifier(opts?: object): boolean; + isUnionTypeAnnotation(opts?: object): boolean; + isVoidTypeAnnotation(opts?: object): boolean; + isJSXAttribute(opts?: object): boolean; + isJSXClosingElement(opts?: object): boolean; + isJSXElement(opts?: object): boolean; + isJSXEmptyExpression(opts?: object): boolean; + isJSXExpressionContainer(opts?: object): boolean; + isJSXIdentifier(opts?: object): boolean; + isJSXMemberExpression(opts?: object): boolean; + isJSXNamespacedName(opts?: object): boolean; + isJSXOpeningElement(opts?: object): boolean; + isJSXSpreadAttribute(opts?: object): boolean; + isJSXText(opts?: object): boolean; + isNoop(opts?: object): boolean; + isParenthesizedExpression(opts?: object): boolean; + isAwaitExpression(opts?: object): boolean; + isBindExpression(opts?: object): boolean; + isDecorator(opts?: object): boolean; + isDoExpression(opts?: object): boolean; + isExportDefaultSpecifier(opts?: object): boolean; + isExportNamespaceSpecifier(opts?: object): boolean; + isRestProperty(opts?: object): boolean; + isSpreadProperty(opts?: object): boolean; + isExpression(opts?: object): boolean; + isBinary(opts?: object): boolean; + isScopable(opts?: object): boolean; + isBlockParent(opts?: object): boolean; + isBlock(opts?: object): boolean; + isStatement(opts?: object): boolean; + isTerminatorless(opts?: object): boolean; + isCompletionStatement(opts?: object): boolean; + isConditional(opts?: object): boolean; + isLoop(opts?: object): boolean; + isWhile(opts?: object): boolean; + isExpressionWrapper(opts?: object): boolean; + isFor(opts?: object): boolean; + isForXStatement(opts?: object): boolean; + isFunction(opts?: object): boolean; + isFunctionParent(opts?: object): boolean; + isPureish(opts?: object): boolean; + isDeclaration(opts?: object): boolean; + isLVal(opts?: object): boolean; + isLiteral(opts?: object): boolean; + isImmutable(opts?: object): boolean; + isUserWhitespacable(opts?: object): boolean; + isMethod(opts?: object): boolean; + isObjectMember(opts?: object): boolean; + isProperty(opts?: object): boolean; + isUnaryLike(opts?: object): boolean; + isPattern(opts?: object): boolean; + isClass(opts?: object): boolean; + isModuleDeclaration(opts?: object): boolean; + isExportDeclaration(opts?: object): boolean; + isModuleSpecifier(opts?: object): boolean; + isFlow(opts?: object): boolean; + isFlowBaseAnnotation(opts?: object): boolean; + isFlowDeclaration(opts?: object): boolean; + isJSX(opts?: object): boolean; + isNumberLiteral(opts?: object): boolean; + isRegexLiteral(opts?: object): boolean; + isReferencedIdentifier(opts?: object): boolean; + isReferencedMemberExpression(opts?: object): boolean; + isBindingIdentifier(opts?: object): boolean; + isScope(opts?: object): boolean; + isReferenced(opts?: object): boolean; + isBlockScoped(opts?: object): boolean; + isVar(opts?: object): boolean; + isUser(opts?: object): boolean; + isGenerated(opts?: object): boolean; + isPure(opts?: object): boolean; // ------------------------- assertXXX ------------------------- - assertArrayExpression(opts?: Object): void; - assertAssignmentExpression(opts?: Object): void; - assertBinaryExpression(opts?: Object): void; - assertDirective(opts?: Object): void; - assertDirectiveLiteral(opts?: Object): void; - assertBlockStatement(opts?: Object): void; - assertBreakStatement(opts?: Object): void; - assertCallExpression(opts?: Object): void; - assertCatchClause(opts?: Object): void; - assertConditionalExpression(opts?: Object): void; - assertContinueStatement(opts?: Object): void; - assertDebuggerStatement(opts?: Object): void; - assertDoWhileStatement(opts?: Object): void; - assertEmptyStatement(opts?: Object): void; - assertExpressionStatement(opts?: Object): void; - assertFile(opts?: Object): void; - assertForInStatement(opts?: Object): void; - assertForStatement(opts?: Object): void; - assertFunctionDeclaration(opts?: Object): void; - assertFunctionExpression(opts?: Object): void; - assertIdentifier(opts?: Object): void; - assertIfStatement(opts?: Object): void; - assertLabeledStatement(opts?: Object): void; - assertStringLiteral(opts?: Object): void; - assertNumericLiteral(opts?: Object): void; - assertNullLiteral(opts?: Object): void; - assertBooleanLiteral(opts?: Object): void; - assertRegExpLiteral(opts?: Object): void; - assertLogicalExpression(opts?: Object): void; - assertMemberExpression(opts?: Object): void; - assertNewExpression(opts?: Object): void; - assertProgram(opts?: Object): void; - assertObjectExpression(opts?: Object): void; - assertObjectMethod(opts?: Object): void; - assertObjectProperty(opts?: Object): void; - assertRestElement(opts?: Object): void; - assertReturnStatement(opts?: Object): void; - assertSequenceExpression(opts?: Object): void; - assertSwitchCase(opts?: Object): void; - assertSwitchStatement(opts?: Object): void; - assertThisExpression(opts?: Object): void; - assertThrowStatement(opts?: Object): void; - assertTryStatement(opts?: Object): void; - assertUnaryExpression(opts?: Object): void; - assertUpdateExpression(opts?: Object): void; - assertVariableDeclaration(opts?: Object): void; - assertVariableDeclarator(opts?: Object): void; - assertWhileStatement(opts?: Object): void; - assertWithStatement(opts?: Object): void; - assertAssignmentPattern(opts?: Object): void; - assertArrayPattern(opts?: Object): void; - assertArrowFunctionExpression(opts?: Object): void; - assertClassBody(opts?: Object): void; - assertClassDeclaration(opts?: Object): void; - assertClassExpression(opts?: Object): void; - assertExportAllDeclaration(opts?: Object): void; - assertExportDefaultDeclaration(opts?: Object): void; - assertExportNamedDeclaration(opts?: Object): void; - assertExportSpecifier(opts?: Object): void; - assertForOfStatement(opts?: Object): void; - assertImportDeclaration(opts?: Object): void; - assertImportDefaultSpecifier(opts?: Object): void; - assertImportNamespaceSpecifier(opts?: Object): void; - assertImportSpecifier(opts?: Object): void; - assertMetaProperty(opts?: Object): void; - assertClassMethod(opts?: Object): void; - assertObjectPattern(opts?: Object): void; - assertSpreadElement(opts?: Object): void; - assertSuper(opts?: Object): void; - assertTaggedTemplateExpression(opts?: Object): void; - assertTemplateElement(opts?: Object): void; - assertTemplateLiteral(opts?: Object): void; - assertYieldExpression(opts?: Object): void; - assertAnyTypeAnnotation(opts?: Object): void; - assertArrayTypeAnnotation(opts?: Object): void; - assertBooleanTypeAnnotation(opts?: Object): void; - assertBooleanLiteralTypeAnnotation(opts?: Object): void; - assertNullLiteralTypeAnnotation(opts?: Object): void; - assertClassImplements(opts?: Object): void; - assertClassProperty(opts?: Object): void; - assertDeclareClass(opts?: Object): void; - assertDeclareFunction(opts?: Object): void; - assertDeclareInterface(opts?: Object): void; - assertDeclareModule(opts?: Object): void; - assertDeclareTypeAlias(opts?: Object): void; - assertDeclareVariable(opts?: Object): void; - assertExistentialTypeParam(opts?: Object): void; - assertFunctionTypeAnnotation(opts?: Object): void; - assertFunctionTypeParam(opts?: Object): void; - assertGenericTypeAnnotation(opts?: Object): void; - assertInterfaceExtends(opts?: Object): void; - assertInterfaceDeclaration(opts?: Object): void; - assertIntersectionTypeAnnotation(opts?: Object): void; - assertMixedTypeAnnotation(opts?: Object): void; - assertNullableTypeAnnotation(opts?: Object): void; - assertNumericLiteralTypeAnnotation(opts?: Object): void; - assertNumberTypeAnnotation(opts?: Object): void; - assertStringLiteralTypeAnnotation(opts?: Object): void; - assertStringTypeAnnotation(opts?: Object): void; - assertThisTypeAnnotation(opts?: Object): void; - assertTupleTypeAnnotation(opts?: Object): void; - assertTypeofTypeAnnotation(opts?: Object): void; - assertTypeAlias(opts?: Object): void; - assertTypeAnnotation(opts?: Object): void; - assertTypeCastExpression(opts?: Object): void; - assertTypeParameterDeclaration(opts?: Object): void; - assertTypeParameterInstantiation(opts?: Object): void; - assertObjectTypeAnnotation(opts?: Object): void; - assertObjectTypeCallProperty(opts?: Object): void; - assertObjectTypeIndexer(opts?: Object): void; - assertObjectTypeProperty(opts?: Object): void; - assertQualifiedTypeIdentifier(opts?: Object): void; - assertUnionTypeAnnotation(opts?: Object): void; - assertVoidTypeAnnotation(opts?: Object): void; - assertJSXAttribute(opts?: Object): void; - assertJSXClosingElement(opts?: Object): void; - assertJSXElement(opts?: Object): void; - assertJSXEmptyExpression(opts?: Object): void; - assertJSXExpressionContainer(opts?: Object): void; - assertJSXIdentifier(opts?: Object): void; - assertJSXMemberExpression(opts?: Object): void; - assertJSXNamespacedName(opts?: Object): void; - assertJSXOpeningElement(opts?: Object): void; - assertJSXSpreadAttribute(opts?: Object): void; - assertJSXText(opts?: Object): void; - assertNoop(opts?: Object): void; - assertParenthesizedExpression(opts?: Object): void; - assertAwaitExpression(opts?: Object): void; - assertBindExpression(opts?: Object): void; - assertDecorator(opts?: Object): void; - assertDoExpression(opts?: Object): void; - assertExportDefaultSpecifier(opts?: Object): void; - assertExportNamespaceSpecifier(opts?: Object): void; - assertRestProperty(opts?: Object): void; - assertSpreadProperty(opts?: Object): void; - assertExpression(opts?: Object): void; - assertBinary(opts?: Object): void; - assertScopable(opts?: Object): void; - assertBlockParent(opts?: Object): void; - assertBlock(opts?: Object): void; - assertStatement(opts?: Object): void; - assertTerminatorless(opts?: Object): void; - assertCompletionStatement(opts?: Object): void; - assertConditional(opts?: Object): void; - assertLoop(opts?: Object): void; - assertWhile(opts?: Object): void; - assertExpressionWrapper(opts?: Object): void; - assertFor(opts?: Object): void; - assertForXStatement(opts?: Object): void; - assertFunction(opts?: Object): void; - assertFunctionParent(opts?: Object): void; - assertPureish(opts?: Object): void; - assertDeclaration(opts?: Object): void; - assertLVal(opts?: Object): void; - assertLiteral(opts?: Object): void; - assertImmutable(opts?: Object): void; - assertUserWhitespacable(opts?: Object): void; - assertMethod(opts?: Object): void; - assertObjectMember(opts?: Object): void; - assertProperty(opts?: Object): void; - assertUnaryLike(opts?: Object): void; - assertPattern(opts?: Object): void; - assertClass(opts?: Object): void; - assertModuleDeclaration(opts?: Object): void; - assertExportDeclaration(opts?: Object): void; - assertModuleSpecifier(opts?: Object): void; - assertFlow(opts?: Object): void; - assertFlowBaseAnnotation(opts?: Object): void; - assertFlowDeclaration(opts?: Object): void; - assertJSX(opts?: Object): void; - assertNumberLiteral(opts?: Object): void; - assertRegexLiteral(opts?: Object): void; + assertArrayExpression(opts?: object): void; + assertAssignmentExpression(opts?: object): void; + assertBinaryExpression(opts?: object): void; + assertDirective(opts?: object): void; + assertDirectiveLiteral(opts?: object): void; + assertBlockStatement(opts?: object): void; + assertBreakStatement(opts?: object): void; + assertCallExpression(opts?: object): void; + assertCatchClause(opts?: object): void; + assertConditionalExpression(opts?: object): void; + assertContinueStatement(opts?: object): void; + assertDebuggerStatement(opts?: object): void; + assertDoWhileStatement(opts?: object): void; + assertEmptyStatement(opts?: object): void; + assertExpressionStatement(opts?: object): void; + assertFile(opts?: object): void; + assertForInStatement(opts?: object): void; + assertForStatement(opts?: object): void; + assertFunctionDeclaration(opts?: object): void; + assertFunctionExpression(opts?: object): void; + assertIdentifier(opts?: object): void; + assertIfStatement(opts?: object): void; + assertLabeledStatement(opts?: object): void; + assertStringLiteral(opts?: object): void; + assertNumericLiteral(opts?: object): void; + assertNullLiteral(opts?: object): void; + assertBooleanLiteral(opts?: object): void; + assertRegExpLiteral(opts?: object): void; + assertLogicalExpression(opts?: object): void; + assertMemberExpression(opts?: object): void; + assertNewExpression(opts?: object): void; + assertProgram(opts?: object): void; + assertObjectExpression(opts?: object): void; + assertObjectMethod(opts?: object): void; + assertObjectProperty(opts?: object): void; + assertRestElement(opts?: object): void; + assertReturnStatement(opts?: object): void; + assertSequenceExpression(opts?: object): void; + assertSwitchCase(opts?: object): void; + assertSwitchStatement(opts?: object): void; + assertThisExpression(opts?: object): void; + assertThrowStatement(opts?: object): void; + assertTryStatement(opts?: object): void; + assertUnaryExpression(opts?: object): void; + assertUpdateExpression(opts?: object): void; + assertVariableDeclaration(opts?: object): void; + assertVariableDeclarator(opts?: object): void; + assertWhileStatement(opts?: object): void; + assertWithStatement(opts?: object): void; + assertAssignmentPattern(opts?: object): void; + assertArrayPattern(opts?: object): void; + assertArrowFunctionExpression(opts?: object): void; + assertClassBody(opts?: object): void; + assertClassDeclaration(opts?: object): void; + assertClassExpression(opts?: object): void; + assertExportAllDeclaration(opts?: object): void; + assertExportDefaultDeclaration(opts?: object): void; + assertExportNamedDeclaration(opts?: object): void; + assertExportSpecifier(opts?: object): void; + assertForOfStatement(opts?: object): void; + assertImportDeclaration(opts?: object): void; + assertImportDefaultSpecifier(opts?: object): void; + assertImportNamespaceSpecifier(opts?: object): void; + assertImportSpecifier(opts?: object): void; + assertMetaProperty(opts?: object): void; + assertClassMethod(opts?: object): void; + assertObjectPattern(opts?: object): void; + assertSpreadElement(opts?: object): void; + assertSuper(opts?: object): void; + assertTaggedTemplateExpression(opts?: object): void; + assertTemplateElement(opts?: object): void; + assertTemplateLiteral(opts?: object): void; + assertYieldExpression(opts?: object): void; + assertAnyTypeAnnotation(opts?: object): void; + assertArrayTypeAnnotation(opts?: object): void; + assertBooleanTypeAnnotation(opts?: object): void; + assertBooleanLiteralTypeAnnotation(opts?: object): void; + assertNullLiteralTypeAnnotation(opts?: object): void; + assertClassImplements(opts?: object): void; + assertClassProperty(opts?: object): void; + assertDeclareClass(opts?: object): void; + assertDeclareFunction(opts?: object): void; + assertDeclareInterface(opts?: object): void; + assertDeclareModule(opts?: object): void; + assertDeclareTypeAlias(opts?: object): void; + assertDeclareVariable(opts?: object): void; + assertExistentialTypeParam(opts?: object): void; + assertFunctionTypeAnnotation(opts?: object): void; + assertFunctionTypeParam(opts?: object): void; + assertGenericTypeAnnotation(opts?: object): void; + assertInterfaceExtends(opts?: object): void; + assertInterfaceDeclaration(opts?: object): void; + assertIntersectionTypeAnnotation(opts?: object): void; + assertMixedTypeAnnotation(opts?: object): void; + assertNullableTypeAnnotation(opts?: object): void; + assertNumericLiteralTypeAnnotation(opts?: object): void; + assertNumberTypeAnnotation(opts?: object): void; + assertStringLiteralTypeAnnotation(opts?: object): void; + assertStringTypeAnnotation(opts?: object): void; + assertThisTypeAnnotation(opts?: object): void; + assertTupleTypeAnnotation(opts?: object): void; + assertTypeofTypeAnnotation(opts?: object): void; + assertTypeAlias(opts?: object): void; + assertTypeAnnotation(opts?: object): void; + assertTypeCastExpression(opts?: object): void; + assertTypeParameterDeclaration(opts?: object): void; + assertTypeParameterInstantiation(opts?: object): void; + assertObjectTypeAnnotation(opts?: object): void; + assertObjectTypeCallProperty(opts?: object): void; + assertObjectTypeIndexer(opts?: object): void; + assertObjectTypeProperty(opts?: object): void; + assertQualifiedTypeIdentifier(opts?: object): void; + assertUnionTypeAnnotation(opts?: object): void; + assertVoidTypeAnnotation(opts?: object): void; + assertJSXAttribute(opts?: object): void; + assertJSXClosingElement(opts?: object): void; + assertJSXElement(opts?: object): void; + assertJSXEmptyExpression(opts?: object): void; + assertJSXExpressionContainer(opts?: object): void; + assertJSXIdentifier(opts?: object): void; + assertJSXMemberExpression(opts?: object): void; + assertJSXNamespacedName(opts?: object): void; + assertJSXOpeningElement(opts?: object): void; + assertJSXSpreadAttribute(opts?: object): void; + assertJSXText(opts?: object): void; + assertNoop(opts?: object): void; + assertParenthesizedExpression(opts?: object): void; + assertAwaitExpression(opts?: object): void; + assertBindExpression(opts?: object): void; + assertDecorator(opts?: object): void; + assertDoExpression(opts?: object): void; + assertExportDefaultSpecifier(opts?: object): void; + assertExportNamespaceSpecifier(opts?: object): void; + assertRestProperty(opts?: object): void; + assertSpreadProperty(opts?: object): void; + assertExpression(opts?: object): void; + assertBinary(opts?: object): void; + assertScopable(opts?: object): void; + assertBlockParent(opts?: object): void; + assertBlock(opts?: object): void; + assertStatement(opts?: object): void; + assertTerminatorless(opts?: object): void; + assertCompletionStatement(opts?: object): void; + assertConditional(opts?: object): void; + assertLoop(opts?: object): void; + assertWhile(opts?: object): void; + assertExpressionWrapper(opts?: object): void; + assertFor(opts?: object): void; + assertForXStatement(opts?: object): void; + assertFunction(opts?: object): void; + assertFunctionParent(opts?: object): void; + assertPureish(opts?: object): void; + assertDeclaration(opts?: object): void; + assertLVal(opts?: object): void; + assertLiteral(opts?: object): void; + assertImmutable(opts?: object): void; + assertUserWhitespacable(opts?: object): void; + assertMethod(opts?: object): void; + assertObjectMember(opts?: object): void; + assertProperty(opts?: object): void; + assertUnaryLike(opts?: object): void; + assertPattern(opts?: object): void; + assertClass(opts?: object): void; + assertModuleDeclaration(opts?: object): void; + assertExportDeclaration(opts?: object): void; + assertModuleSpecifier(opts?: object): void; + assertFlow(opts?: object): void; + assertFlowBaseAnnotation(opts?: object): void; + assertFlowDeclaration(opts?: object): void; + assertJSX(opts?: object): void; + assertNumberLiteral(opts?: object): void; + assertRegexLiteral(opts?: object): void; } export class Hub { @@ -960,7 +959,7 @@ export class Hub { options: any; } -interface TraversalContext { +export interface TraversalContext { parentPath: NodePath; scope: Scope; state: any; diff --git a/types/babel-traverse/tslint.json b/types/babel-traverse/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/babel-traverse/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/basic-auth/basic-auth-tests.ts b/types/basic-auth/basic-auth-tests.ts index e416afe352..9c03137b37 100644 --- a/types/basic-auth/basic-auth-tests.ts +++ b/types/basic-auth/basic-auth-tests.ts @@ -1,4 +1,4 @@ -import {IncomingMessage} from 'http'; +import { IncomingMessage } from 'http'; import auth = require('basic-auth'); const loginData = auth(undefined! as IncomingMessage); diff --git a/types/bleno/tslint.json b/types/bleno/tslint.json index 377cc837d4..3db14f85ea 100644 --- a/types/bleno/tslint.json +++ b/types/bleno/tslint.json @@ -1 +1 @@ -{ "extends": "../tslint.json" } +{ "extends": "dtslint/dt.json" } diff --git a/types/blessed/index.d.ts b/types/blessed/index.d.ts index b08f77b3b1..abbc31d295 100644 --- a/types/blessed/index.d.ts +++ b/types/blessed/index.d.ts @@ -5,7 +5,7 @@ /// -import {EventEmitter} from 'events'; +import { EventEmitter } from 'events'; import * as stream from "stream"; import * as child_process from "child_process"; diff --git a/types/bwip-js/index.d.ts b/types/bwip-js/index.d.ts index 9c37fa6e44..04732ef703 100644 --- a/types/bwip-js/index.d.ts +++ b/types/bwip-js/index.d.ts @@ -5,7 +5,7 @@ /// -import {IncomingMessage as Request, ServerResponse as Response} from 'http'; +import { IncomingMessage as Request, ServerResponse as Response } from 'http'; declare namespace BwipJs { export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void; diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts index 09e957aa05..b60a4a5655 100644 --- a/types/chokidar/index.d.ts +++ b/types/chokidar/index.d.ts @@ -6,7 +6,7 @@ /// import * as fs from 'fs'; -import {EventEmitter} from 'events'; +import { EventEmitter } from 'events'; /** * The object's keys are all the directories (using absolute paths unless the `cwd` option was diff --git a/types/closure-compiler/closure-compiler-tests.ts b/types/closure-compiler/closure-compiler-tests.ts index 3dd827a0f8..44693fca43 100644 --- a/types/closure-compiler/closure-compiler-tests.ts +++ b/types/closure-compiler/closure-compiler-tests.ts @@ -1,4 +1,4 @@ -import {compile} from 'closure-compiler'; +import { compile } from 'closure-compiler'; compile('some.source()', {'check-only': null}, (err: Error, stdout: string, stderr: string): void => { diff --git a/types/color-convert/color-convert-tests.ts b/types/color-convert/color-convert-tests.ts new file mode 100644 index 0000000000..735c169a2f --- /dev/null +++ b/types/color-convert/color-convert-tests.ts @@ -0,0 +1,6 @@ +import * as color from 'color-convert'; +import * as conv from 'color-convert/conversions'; + +let hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]); +let hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]); +let aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]); diff --git a/types/color-convert/conversions.d.ts b/types/color-convert/conversions.d.ts new file mode 100644 index 0000000000..aa461d40b0 --- /dev/null +++ b/types/color-convert/conversions.d.ts @@ -0,0 +1,136 @@ +import * as cssKeywords from 'color-name'; + +export type RGB = [number, number, number]; +export type HSL = [number, number, number]; +export type HSV = [number, number, number]; +export type HWB = [number, number, number]; +export type CMYK = [number, number, number, number]; +export type XYZ = [number, number, number]; +export type LAB = [number, number, number]; +export type LCH = [number, number, number]; +export type HEX = string; +export type KEYWORD = keyof typeof cssKeywords; +export type ANSI16 = number; +export type ANSI256 = number; +export type HCG = [number, number, number]; +export type APPLE = [number, number, number]; +export type GRAY = [number]; + +export namespace rgb { + const channels: 3; + const labels: 'rgb'; + function hsl(rgb: RGB): HSL; + function hsv(rgb: RGB): HSV; + function hwb(rgb: RGB): HWB; + function cmyk(rgb: RGB): CMYK; + function keyword(rgb: RGB): KEYWORD; + function xyz(rgb: RGB): XYZ; + function lab(rgb: RGB): LAB; + function ansi16(rgb: RGB): ANSI16; + function ansi256(rgb: RGB): ANSI256; + function hex(rgb: RGB): HEX; + function hcg(rgb: RGB): HCG; + function apple(rgb: RGB): APPLE; + function gray(rgb: RGB): GRAY; +} + +export namespace hsl { + const channels: 3; + const labels: 'hsl'; + function rgb(hsl: HSL): RGB; + function hsv(hsl: HSL): HSV; + function hcg(hsl: HSL): HCG; +} + +export namespace hsv { + const channels: 3; + const labels: 'hsv'; + function rgb(hsv: HSV): RGB; + function hsl(hsv: HSV): HSL; + function ansi16(hsv: HSV): ANSI16; + function hcg(hsv: HSV): HCG; +} + +export namespace hwb { + const channels: 3; + const labels: 'hwb'; + function rgb(hwb: HWB): RGB; + function hcg(hwb: HWB): HCG; +} + +export namespace cmyk { + const channels: 4; + const labels: 'cmyk'; + function rgb(cmyk: CMYK): RGB; +} + +export namespace xyz { + const channels: 3; + const labels: 'xyz'; + function rgb(xyz: XYZ): RGB; + function lab(xyz: XYZ): LAB; +} + +export namespace lab { + const channels: 3; + const labels: 'lab'; + function xyz(lab: LAB): XYZ; + function lch(lab: LAB): LCH; +} + +export namespace lch { + const channels: 3; + const labels: 'lch'; + function lab(lch: LCH): LAB; +} + +export namespace hex { + const channels: 1; + const labels: ['hex']; + function rgb(hex: HEX): RGB; +} + +export namespace keyword { + const channels: 1; + const labels: ['keyword']; + function rgb(keyword: KEYWORD): RGB; +} + +export namespace ansi16 { + const channels: 1; + const labels: ['ansi16']; + function rgb(ansi16: ANSI16): RGB; +} + +export namespace ansi256 { + const channels: 1; + const labels: ['ansi256']; + function rgb(ansi256: ANSI256): RGB; +} + +export namespace hcg { + const channels: 3; + const labels: ['h', 'c', 'g']; + function rgb(hcg: HCG): RGB; + function hsv(hcg: HCG): HSV; + function hsl(hcg: HCG): HSL; + function hwb(hcg: HCG): HWB; +} + +export namespace apple { + const channels: 3; + const labels: ['r16', 'g16', 'b16']; + function rgb(apple: APPLE): RGB; +} + +export namespace gray { + const channels: 1; + const labels: ['gray']; + function rgb(gray: GRAY): RGB; + function hsl(gray: GRAY): HSL; + function hsv(gray: GRAY): HSV; + function hwb(gray: GRAY): HWB; + function cmyk(gray: GRAY): CMYK; + function lab(gray: GRAY): LAB; + function hex(gray: GRAY): HEX; +} diff --git a/types/color-convert/index.d.ts b/types/color-convert/index.d.ts new file mode 100644 index 0000000000..be2a0dafa6 --- /dev/null +++ b/types/color-convert/index.d.ts @@ -0,0 +1,98 @@ +// Type definitions for color-convert 1.9 +// Project: https://github.com/qix-/color-convert#readme +// Definitions by: Junyoung Clare Jang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import conversions = require('./conversions'); +import route = require('./route'); + +export const rgb: typeof conversions.rgb & route.rgb & { + [F in keyof route.rgb]: { + raw: route.rgb[F] + } +}; + +export const hsl: typeof conversions.hsl & route.hsl & { + [F in keyof route.hsl]: { + raw: route.hsl[F] + } +}; + +export const hsv: typeof conversions.hsv & route.hsv & { + [F in keyof route.hsv]: { + raw: route.hsv[F] + } +}; + +export const hwb: typeof conversions.hwb & route.hwb & { + [F in keyof route.hwb]: { + raw: route.hwb[F] + } +}; + +export const cmyk: typeof conversions.cmyk & route.cmyk & { + [F in keyof route.cmyk]: { + raw: route.cmyk[F] + } +}; + +export const xyz: typeof conversions.xyz & route.xyz & { + [F in keyof route.xyz]: { + raw: route.xyz[F] + } +}; + +export const lab: typeof conversions.lab & route.lab & { + [F in keyof route.lab]: { + raw: route.lab[F] + } +}; + +export const lch: typeof conversions.lch & route.lch & { + [F in keyof route.lch]: { + raw: route.lch[F] + } +}; + +export const hex: typeof conversions.hex & route.hex & { + [F in keyof route.hex]: { + raw: route.hex[F] + } +}; + +export const keyword: typeof conversions.keyword & route.keyword & { + [F in keyof route.keyword]: { + raw: route.keyword[F] + } +}; + +export const ansi16: typeof conversions.ansi16 & route.ansi16 & { + [F in keyof route.ansi16]: { + raw: route.ansi16[F] + } +}; + +export const ansi256: typeof conversions.ansi256 & route.ansi256 & { + [F in keyof route.ansi256]: { + raw: route.ansi256[F] + } +}; + +export const hcg: typeof conversions.hcg & route.hcg & { + [F in keyof route.hcg]: { + raw: route.hcg[F] + } +}; + +export const apple: typeof conversions.apple & route.apple & { + [F in keyof route.apple]: { + raw: route.apple[F] + } +}; + +export const gray: typeof conversions.gray & route.gray & { + [F in keyof route.gray]: { + raw: route.gray[F] + } +}; diff --git a/types/color-convert/route.d.ts b/types/color-convert/route.d.ts new file mode 100644 index 0000000000..f9ea4f7cf8 --- /dev/null +++ b/types/color-convert/route.d.ts @@ -0,0 +1,262 @@ +import conversions = require('./conversions'); + +declare namespace route { + interface rgb { + hsl(from: conversions.RGB): conversions.HSL; + hsv(from: conversions.RGB): conversions.HSV; + hwb(from: conversions.RGB): conversions.HWB; + cmyk(from: conversions.RGB): conversions.CMYK; + xyz(from: conversions.RGB): conversions.XYZ; + lab(from: conversions.RGB): conversions.LAB; + lch(from: conversions.RGB): conversions.LCH; + hex(from: conversions.RGB): conversions.HEX; + keyword(from: conversions.RGB): conversions.KEYWORD; + ansi16(from: conversions.RGB): conversions.ANSI16; + ansi256(from: conversions.RGB): conversions.ANSI256; + hcg(from: conversions.RGB): conversions.HCG; + apple(from: conversions.RGB): conversions.APPLE; + gray(from: conversions.RGB): conversions.GRAY; + } + interface hsl { + rgb(from: conversions.HSL): conversions.RGB; + hsv(from: conversions.HSL): conversions.HSV; + hwb(from: conversions.HSL): conversions.HWB; + cmyk(from: conversions.HSL): conversions.CMYK; + xyz(from: conversions.HSL): conversions.XYZ; + lab(from: conversions.HSL): conversions.LAB; + lch(from: conversions.HSL): conversions.LCH; + hex(from: conversions.HSL): conversions.HEX; + keyword(from: conversions.HSL): conversions.KEYWORD; + ansi16(from: conversions.HSL): conversions.ANSI16; + ansi256(from: conversions.HSL): conversions.ANSI256; + hcg(from: conversions.HSL): conversions.HCG; + apple(from: conversions.HSL): conversions.APPLE; + gray(from: conversions.HSL): conversions.GRAY; + } + interface hsv { + rgb(from: conversions.HSV): conversions.RGB; + hsl(from: conversions.HSV): conversions.HSL; + hwb(from: conversions.HSV): conversions.HWB; + cmyk(from: conversions.HSV): conversions.CMYK; + xyz(from: conversions.HSV): conversions.XYZ; + lab(from: conversions.HSV): conversions.LAB; + lch(from: conversions.HSV): conversions.LCH; + hex(from: conversions.HSV): conversions.HEX; + keyword(from: conversions.HSV): conversions.KEYWORD; + ansi16(from: conversions.HSV): conversions.ANSI16; + ansi256(from: conversions.HSV): conversions.ANSI256; + hcg(from: conversions.HSV): conversions.HCG; + apple(from: conversions.HSV): conversions.APPLE; + gray(from: conversions.HSV): conversions.GRAY; + } + interface hwb { + rgb(from: conversions.HWB): conversions.RGB; + hsl(from: conversions.HWB): conversions.HSL; + hsv(from: conversions.HWB): conversions.HSV; + cmyk(from: conversions.HWB): conversions.CMYK; + xyz(from: conversions.HWB): conversions.XYZ; + lab(from: conversions.HWB): conversions.LAB; + lch(from: conversions.HWB): conversions.LCH; + hex(from: conversions.HWB): conversions.HEX; + keyword(from: conversions.HWB): conversions.KEYWORD; + ansi16(from: conversions.HWB): conversions.ANSI16; + ansi256(from: conversions.HWB): conversions.ANSI256; + hcg(from: conversions.HWB): conversions.HCG; + apple(from: conversions.HWB): conversions.APPLE; + gray(from: conversions.HWB): conversions.GRAY; + } + interface cmyk { + rgb(from: conversions.CMYK): conversions.RGB; + hsl(from: conversions.CMYK): conversions.HSL; + hsv(from: conversions.CMYK): conversions.HSV; + hwb(from: conversions.CMYK): conversions.HWB; + xyz(from: conversions.CMYK): conversions.XYZ; + lab(from: conversions.CMYK): conversions.LAB; + lch(from: conversions.CMYK): conversions.LCH; + hex(from: conversions.CMYK): conversions.HEX; + keyword(from: conversions.CMYK): conversions.KEYWORD; + ansi16(from: conversions.CMYK): conversions.ANSI16; + ansi256(from: conversions.CMYK): conversions.ANSI256; + hcg(from: conversions.CMYK): conversions.HCG; + apple(from: conversions.CMYK): conversions.APPLE; + gray(from: conversions.CMYK): conversions.GRAY; + } + interface xyz { + rgb(from: conversions.XYZ): conversions.RGB; + hsl(from: conversions.XYZ): conversions.HSL; + hsv(from: conversions.XYZ): conversions.HSV; + hwb(from: conversions.XYZ): conversions.HWB; + cmyk(from: conversions.XYZ): conversions.CMYK; + lab(from: conversions.XYZ): conversions.LAB; + lch(from: conversions.XYZ): conversions.LCH; + hex(from: conversions.XYZ): conversions.HEX; + keyword(from: conversions.XYZ): conversions.KEYWORD; + ansi16(from: conversions.XYZ): conversions.ANSI16; + ansi256(from: conversions.XYZ): conversions.ANSI256; + hcg(from: conversions.XYZ): conversions.HCG; + apple(from: conversions.XYZ): conversions.APPLE; + gray(from: conversions.XYZ): conversions.GRAY; + } + interface lab { + rgb(from: conversions.LAB): conversions.RGB; + hsl(from: conversions.LAB): conversions.HSL; + hsv(from: conversions.LAB): conversions.HSV; + hwb(from: conversions.LAB): conversions.HWB; + cmyk(from: conversions.LAB): conversions.CMYK; + xyz(from: conversions.LAB): conversions.XYZ; + lch(from: conversions.LAB): conversions.LCH; + hex(from: conversions.LAB): conversions.HEX; + keyword(from: conversions.LAB): conversions.KEYWORD; + ansi16(from: conversions.LAB): conversions.ANSI16; + ansi256(from: conversions.LAB): conversions.ANSI256; + hcg(from: conversions.LAB): conversions.HCG; + apple(from: conversions.LAB): conversions.APPLE; + gray(from: conversions.LAB): conversions.GRAY; + } + interface lch { + rgb(from: conversions.LCH): conversions.RGB; + hsl(from: conversions.LCH): conversions.HSL; + hsv(from: conversions.LCH): conversions.HSV; + hwb(from: conversions.LCH): conversions.HWB; + cmyk(from: conversions.LCH): conversions.CMYK; + xyz(from: conversions.LCH): conversions.XYZ; + lab(from: conversions.LCH): conversions.LAB; + hex(from: conversions.LCH): conversions.HEX; + keyword(from: conversions.LCH): conversions.KEYWORD; + ansi16(from: conversions.LCH): conversions.ANSI16; + ansi256(from: conversions.LCH): conversions.ANSI256; + hcg(from: conversions.LCH): conversions.HCG; + apple(from: conversions.LCH): conversions.APPLE; + gray(from: conversions.LCH): conversions.GRAY; + } + interface hex { + rgb(from: conversions.HEX): conversions.RGB; + hsl(from: conversions.HEX): conversions.HSL; + hsv(from: conversions.HEX): conversions.HSV; + hwb(from: conversions.HEX): conversions.HWB; + cmyk(from: conversions.HEX): conversions.CMYK; + xyz(from: conversions.HEX): conversions.XYZ; + lab(from: conversions.HEX): conversions.LAB; + lch(from: conversions.HEX): conversions.LCH; + keyword(from: conversions.HEX): conversions.KEYWORD; + ansi16(from: conversions.HEX): conversions.ANSI16; + ansi256(from: conversions.HEX): conversions.ANSI256; + hcg(from: conversions.HEX): conversions.HCG; + apple(from: conversions.HEX): conversions.APPLE; + gray(from: conversions.HEX): conversions.GRAY; + } + interface keyword { + rgb(from: conversions.KEYWORD): conversions.RGB; + hsl(from: conversions.KEYWORD): conversions.HSL; + hsv(from: conversions.KEYWORD): conversions.HSV; + hwb(from: conversions.KEYWORD): conversions.HWB; + cmyk(from: conversions.KEYWORD): conversions.CMYK; + xyz(from: conversions.KEYWORD): conversions.XYZ; + lab(from: conversions.KEYWORD): conversions.LAB; + lch(from: conversions.KEYWORD): conversions.LCH; + hex(from: conversions.KEYWORD): conversions.HEX; + ansi16(from: conversions.KEYWORD): conversions.ANSI16; + ansi256(from: conversions.KEYWORD): conversions.ANSI256; + hcg(from: conversions.KEYWORD): conversions.HCG; + apple(from: conversions.KEYWORD): conversions.APPLE; + gray(from: conversions.KEYWORD): conversions.GRAY; + } + interface ansi16 { + rgb(from: conversions.ANSI16): conversions.RGB; + hsl(from: conversions.ANSI16): conversions.HSL; + hsv(from: conversions.ANSI16): conversions.HSV; + hwb(from: conversions.ANSI16): conversions.HWB; + cmyk(from: conversions.ANSI16): conversions.CMYK; + xyz(from: conversions.ANSI16): conversions.XYZ; + lab(from: conversions.ANSI16): conversions.LAB; + lch(from: conversions.ANSI16): conversions.LCH; + hex(from: conversions.ANSI16): conversions.HEX; + keyword(from: conversions.ANSI16): conversions.KEYWORD; + ansi256(from: conversions.ANSI16): conversions.ANSI256; + hcg(from: conversions.ANSI16): conversions.HCG; + apple(from: conversions.ANSI16): conversions.APPLE; + gray(from: conversions.ANSI16): conversions.GRAY; + } + interface ansi256 { + rgb(from: conversions.ANSI256): conversions.RGB; + hsl(from: conversions.ANSI256): conversions.HSL; + hsv(from: conversions.ANSI256): conversions.HSV; + hwb(from: conversions.ANSI256): conversions.HWB; + cmyk(from: conversions.ANSI256): conversions.CMYK; + xyz(from: conversions.ANSI256): conversions.XYZ; + lab(from: conversions.ANSI256): conversions.LAB; + lch(from: conversions.ANSI256): conversions.LCH; + hex(from: conversions.ANSI256): conversions.HEX; + keyword(from: conversions.ANSI256): conversions.KEYWORD; + ansi16(from: conversions.ANSI256): conversions.ANSI16; + hcg(from: conversions.ANSI256): conversions.HCG; + apple(from: conversions.ANSI256): conversions.APPLE; + gray(from: conversions.ANSI256): conversions.GRAY; + } + interface hcg { + rgb(from: conversions.HCG): conversions.RGB; + hsl(from: conversions.HCG): conversions.HSL; + hsv(from: conversions.HCG): conversions.HSV; + hwb(from: conversions.HCG): conversions.HWB; + cmyk(from: conversions.HCG): conversions.CMYK; + xyz(from: conversions.HCG): conversions.XYZ; + lab(from: conversions.HCG): conversions.LAB; + lch(from: conversions.HCG): conversions.LCH; + hex(from: conversions.HCG): conversions.HEX; + keyword(from: conversions.HCG): conversions.KEYWORD; + ansi16(from: conversions.HCG): conversions.ANSI16; + ansi256(from: conversions.HCG): conversions.ANSI256; + apple(from: conversions.HCG): conversions.APPLE; + gray(from: conversions.HCG): conversions.GRAY; + } + interface apple { + rgb(from: conversions.APPLE): conversions.RGB; + hsl(from: conversions.APPLE): conversions.HSL; + hsv(from: conversions.APPLE): conversions.HSV; + hwb(from: conversions.APPLE): conversions.HWB; + cmyk(from: conversions.APPLE): conversions.CMYK; + xyz(from: conversions.APPLE): conversions.XYZ; + lab(from: conversions.APPLE): conversions.LAB; + lch(from: conversions.APPLE): conversions.LCH; + hex(from: conversions.APPLE): conversions.HEX; + keyword(from: conversions.APPLE): conversions.KEYWORD; + ansi16(from: conversions.APPLE): conversions.ANSI16; + ansi256(from: conversions.APPLE): conversions.ANSI256; + hcg(from: conversions.APPLE): conversions.HCG; + gray(from: conversions.APPLE): conversions.GRAY; + } + interface gray { + rgb(from: conversions.GRAY): conversions.RGB; + hsl(from: conversions.GRAY): conversions.HSL; + hsv(from: conversions.GRAY): conversions.HSV; + hwb(from: conversions.GRAY): conversions.HWB; + cmyk(from: conversions.GRAY): conversions.CMYK; + xyz(from: conversions.GRAY): conversions.XYZ; + lab(from: conversions.GRAY): conversions.LAB; + lch(from: conversions.GRAY): conversions.LCH; + hex(from: conversions.GRAY): conversions.HEX; + keyword(from: conversions.GRAY): conversions.KEYWORD; + ansi16(from: conversions.GRAY): conversions.ANSI16; + ansi256(from: conversions.GRAY): conversions.ANSI256; + hcg(from: conversions.GRAY): conversions.HCG; + apple(from: conversions.GRAY): conversions.APPLE; + } +} + +declare function route(fromModel: 'rgb'): route.rgb; +declare function route(fromModel: 'hsl'): route.hsl; +declare function route(fromModel: 'hsv'): route.hsv; +declare function route(fromModel: 'hwb'): route.hwb; +declare function route(fromModel: 'cmyk'): route.cmyk; +declare function route(fromModel: 'xyz'): route.xyz; +declare function route(fromModel: 'lab'): route.lab; +declare function route(fromModel: 'lch'): route.lch; +declare function route(fromModel: 'hex'): route.hex; +declare function route(fromModel: 'keyword'): route.keyword; +declare function route(fromModel: 'ansi16'): route.ansi16; +declare function route(fromModel: 'ansi256'): route.ansi256; +declare function route(fromModel: 'hcg'): route.hcg; +declare function route(fromModel: 'apple'): route.apple; +declare function route(fromModel: 'gray'): route.gray; + +export = route; diff --git a/types/color-convert/tsconfig.json b/types/color-convert/tsconfig.json new file mode 100644 index 0000000000..70b4bd0fd9 --- /dev/null +++ b/types/color-convert/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "conversions.d.ts", + "route.d.ts", + "color-convert-tests.ts" + ] +} diff --git a/types/color-convert/tslint.json b/types/color-convert/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/color-convert/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/consul/index.d.ts b/types/consul/index.d.ts index 4d577cd2a1..3d344ae983 100644 --- a/types/consul/index.d.ts +++ b/types/consul/index.d.ts @@ -7,7 +7,7 @@ -import {IncomingMessage as HttpIncomingMessage} from "http"; +import { IncomingMessage as HttpIncomingMessage } from "http"; declare namespace Consul { diff --git a/types/cwise-compiler/index.d.ts b/types/cwise-compiler/index.d.ts index e661934a6a..8703355ba3 100644 --- a/types/cwise-compiler/index.d.ts +++ b/types/cwise-compiler/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/scijs/cwise-compiler // Definitions by: taoqf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { CompiledRoutine } from 'cwise-parser'; import * as ndarray from 'ndarray'; diff --git a/types/cwise/index.d.ts b/types/cwise/index.d.ts index d99d43ce59..95df45bb03 100644 --- a/types/cwise/index.d.ts +++ b/types/cwise/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/scijs/cwise#readme // Definitions by: taoqf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import { ArgType } from "cwise-compiler"; import * as ndarray from "ndarray"; diff --git a/types/d3-hsv/d3-hsv-tests.ts b/types/d3-hsv/d3-hsv-tests.ts index 72e18145e6..0d3e564360 100644 --- a/types/d3-hsv/d3-hsv-tests.ts +++ b/types/d3-hsv/d3-hsv-tests.ts @@ -6,8 +6,8 @@ * are not intended as functional tests. */ -import {hsv, HSVColor} from 'd3-hsv'; -import {rgb, RGBColor} from 'd3-color'; +import { hsv, HSVColor } from 'd3-hsv'; +import { rgb, RGBColor } from 'd3-color'; let c: RGBColor; let cHSV: HSVColor; diff --git a/types/d3-hsv/index.d.ts b/types/d3-hsv/index.d.ts index c10fa6ee44..6a7a2c8560 100644 --- a/types/d3-hsv/index.d.ts +++ b/types/d3-hsv/index.d.ts @@ -5,7 +5,7 @@ // Last module patch version validated against: 0.0.3 -import {Color, RGBColor, ColorSpaceObject, ColorCommonInstance} from 'd3-color'; +import { Color, RGBColor, ColorSpaceObject, ColorCommonInstance } from 'd3-color'; export type ColorSpaceObjectWithHSV = ColorSpaceObject | HSVColor; diff --git a/types/d3-selection-multi/index.d.ts b/types/d3-selection-multi/index.d.ts index da3c64e5e3..4dd2a47c46 100644 --- a/types/d3-selection-multi/index.d.ts +++ b/types/d3-selection-multi/index.d.ts @@ -5,8 +5,8 @@ // Last module patch version validated against: 1.0.0 -import {Selection, BaseType, ArrayLike, ValueFn} from 'd3-selection'; -import {Transition} from 'd3-transition'; +import { Selection, BaseType, ArrayLike, ValueFn } from 'd3-selection'; +import { Transition } from 'd3-transition'; /** * An object mapping attribute (or style or property) names to value accessors diff --git a/types/d3-tip/index.d.ts b/types/d3-tip/index.d.ts index e820e8120f..5a70a6cf4d 100644 --- a/types/d3-tip/index.d.ts +++ b/types/d3-tip/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Gert Braspenning // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {Primitive} from "d3"; +import { Primitive } from "d3"; declare module "d3" { type TooltipDirection = ("n" | "s" | "e" | "w" | "nw" | "ne" | "sw" | "se"); diff --git a/types/datatables.net-rowreorder/datatables.net-rowreorder-tests.ts b/types/datatables.net-rowreorder/datatables.net-rowreorder-tests.ts new file mode 100644 index 0000000000..bb0926bfda --- /dev/null +++ b/types/datatables.net-rowreorder/datatables.net-rowreorder-tests.ts @@ -0,0 +1,14 @@ +$(document).ready(() => { + const config: DataTables.Settings = { + // reorder extension options + rowReorder: { + dataSrc: "somesrc", + editor: {}, + enable: true, + formOptions: {}, + selector: "someselector", + snapX: true, + update: true, + }, + }; +}); diff --git a/types/datatables.net-rowreorder/index.d.ts b/types/datatables.net-rowreorder/index.d.ts new file mode 100644 index 0000000000..110da7a747 --- /dev/null +++ b/types/datatables.net-rowreorder/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for JQuery DataTables RowReorder extension 1.1 +// Project: http://datatables.net/extensions/rowreorder/ +// Definitions by: Vincent Biret +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +/// + +declare namespace DataTables { + interface Settings { + /** + * Enable and configure the RowReorder extension for DataTables + */ + rowReorder?: RowReorderSettings; + } + + interface RowReorderSettings { + /** + * Configure the data point that will be used for the reordering data + */ + dataSrc?: string; + /** + * Attach an Editor instance for database updating + */ + editor?: any; + /** + * Enable / disable RowReorder's user interaction + */ + enable?: boolean; + /** + * Set the options for the Editor form when submitting data + */ + formOptions?: any; + /** + * Define the selector used to pick the elements that will start a drag + */ + selector?: string; + /** + * Horizontal position control of the row being dragged + */ + snapX?: number | boolean; + /** + * Control automatic of data when a row is dropped + */ + update?: boolean; + } +} diff --git a/types/datatables.net-rowreorder/tsconfig.json b/types/datatables.net-rowreorder/tsconfig.json new file mode 100644 index 0000000000..c0b35cadfe --- /dev/null +++ b/types/datatables.net-rowreorder/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "datatables.net-rowreorder-tests.ts" + ] +} \ No newline at end of file diff --git a/types/datatables.net-rowreorder/tslint.json b/types/datatables.net-rowreorder/tslint.json new file mode 100644 index 0000000000..21764ccb0d --- /dev/null +++ b/types/datatables.net-rowreorder/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + } +} \ No newline at end of file diff --git a/types/debessmann/debessmann-tests.ts b/types/debessmann/debessmann-tests.ts index 802257992e..4a247827fd 100644 --- a/types/debessmann/debessmann-tests.ts +++ b/types/debessmann/debessmann-tests.ts @@ -1,4 +1,4 @@ -import {DM, Event, EventId} from 'debessmann'; +import { DM, Event, EventId } from 'debessmann'; let eventId: EventId = {seq: 0, time: new Date()}; let e: Event = {_id: eventId, headers: {header1: 'header1Val'}}; diff --git a/types/decay/decay-tests.ts b/types/decay/decay-tests.ts index 20f33210ac..af45c63923 100644 --- a/types/decay/decay-tests.ts +++ b/types/decay/decay-tests.ts @@ -1,4 +1,4 @@ -import {redditHot, hackerHot, wilsonScore} from 'decay'; +import { redditHot, hackerHot, wilsonScore } from 'decay'; const upvotes = 42; const downvotes = 12; diff --git a/types/decorum/decorum-tests.ts b/types/decorum/decorum-tests.ts index 8cd03e046c..d6f2565fa5 100644 --- a/types/decorum/decorum-tests.ts +++ b/types/decorum/decorum-tests.ts @@ -1,4 +1,4 @@ -import {Required} from 'decorum'; +import { Required } from 'decorum'; import {Email} from 'decorum'; import {MinLength} from 'decorum'; import {MaxLength} from 'decorum'; diff --git a/types/dockerode/dockerode-tests.ts b/types/dockerode/dockerode-tests.ts index ef2ed924d1..14ea3ca639 100644 --- a/types/dockerode/dockerode-tests.ts +++ b/types/dockerode/dockerode-tests.ts @@ -74,6 +74,10 @@ docker.buildImage('archive.tar', { t: 'imageName' }, (err, response) => { // NOOP }); +docker.buildImage({context: '.', src: ['Dockerfile', 'test.sh']}, { t: 'imageName' }, (err, response) => { + // NOOP +}); + docker.createContainer({ Tty: true }, (err, container) => { container.start((err, data) => { // NOOP diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index d6cbadf938..aa6c03bf29 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for dockerode 2.4 // Project: https://github.com/apocas/dockerode -// Definitions by: Carl Winkler , Nicolas Laplante +// Definitions by: Carl Winkler +// Nicolas Laplante +// ByeongHun Yoo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -804,6 +806,11 @@ declare namespace Dockerode { tail?: number; timestamps?: boolean; } + + interface ImageBuildContext { + context: string; + src: string[]; + } } type Callback = (error?: any, result?: T) => void; @@ -830,9 +837,9 @@ declare class Dockerode { checkAuth(options: any, callback: Callback): void; checkAuth(options: any): Promise; - buildImage(file: string | NodeJS.ReadableStream, options: {}, callback: Callback): void; - buildImage(file: string | NodeJS.ReadableStream, callback: Callback): void; - buildImage(file: string | NodeJS.ReadableStream, options?: {}): Promise; + buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options: {}, callback: Callback): void; + buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, callback: Callback): void; + buildImage(file: string | NodeJS.ReadableStream | Dockerode.ImageBuildContext, options?: {}): Promise; getContainer(id: string): Dockerode.Container; diff --git a/types/dookie/dookie-tests.ts b/types/dookie/dookie-tests.ts index 476538b8de..e672d59de6 100644 --- a/types/dookie/dookie-tests.ts +++ b/types/dookie/dookie-tests.ts @@ -1,4 +1,4 @@ -import {push, pull} from 'dookie'; +import { push, pull } from 'dookie'; (async () => { await push('mongodb://localhost:27017/test', {test: [{ok: 1}, {ok: 2}]}); diff --git a/types/dot-prop/dot-prop-tests.ts b/types/dot-prop/dot-prop-tests.ts index b7687bb64b..420fe2d320 100644 --- a/types/dot-prop/dot-prop-tests.ts +++ b/types/dot-prop/dot-prop-tests.ts @@ -1,11 +1,23 @@ +/// +import dotProp = require('dot-prop'); +import { get, has, set } from 'dot-prop'; -import * as dotProp from 'dot-prop'; - -dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); +get({foo: {bar: 'unicorn'}}, 'foo.bar'); dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); +dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep', 'default value'); dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); const obj = {foo: {bar: 'a'}}; -dotProp.set(obj, 'foo.bar', 'b'); +set(obj, 'foo.bar', 'b'); +console.log(obj); dotProp.set(obj, 'foo.baz', 'x'); -dotProp.set(obj, 'foo.dot\\.dot', 'unicorn'); +console.log(obj); + +has({foo: {bar: 'unicorn'}}, 'foo.bar'); +dotProp.has({foo: {bar: 'unicorn'}}, 'foo.bar'); + +dotProp.delete(obj, 'foo.bar'); +console.log(obj); +( obj).foo.bar = {x: 'y', y: 'x'}; +dotProp.delete(obj, 'foo.bar.x'); +console.log(obj); diff --git a/types/dot-prop/index.d.ts b/types/dot-prop/index.d.ts index b8d9ce406c..31877dbd9e 100644 --- a/types/dot-prop/index.d.ts +++ b/types/dot-prop/index.d.ts @@ -1,8 +1,17 @@ -// Type definitions for dot-prop -// Project: https://github.com/sindresorhus/dot-prop +// Type definitions for dot-prop 4.1 +// Project: https://github.com/sindresorhus/dot-prop#readme // Definitions by: Sam Verschueren +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 +interface DotProp { + get(obj: object, path: string, defaultValue?: any): any; + set(obj: object, path: string, value: any): void; + has(obj: object, path: string): boolean; + delete(obj: object, path: string): boolean; +} -export declare function get(object: any, path: string): any; -export declare function set(object: any, path: string, value: any): void; +declare const dotProp: DotProp; + +export = dotProp; diff --git a/types/dot-prop/tsconfig.json b/types/dot-prop/tsconfig.json index f404606239..9569bb6470 100644 --- a/types/dot-prop/tsconfig.json +++ b/types/dot-prop/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "dot-prop-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/dot-prop/tslint.json b/types/dot-prop/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dot-prop/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/dot-prop/v2/dot-prop-tests.ts b/types/dot-prop/v2/dot-prop-tests.ts new file mode 100644 index 0000000000..f9991f8d5b --- /dev/null +++ b/types/dot-prop/v2/dot-prop-tests.ts @@ -0,0 +1,10 @@ +import * as dotProp from 'dot-prop'; + +dotProp.get({foo: {bar: 'unicorn'}}, 'foo.bar'); +dotProp.get({foo: {bar: 'a'}}, 'foo.notDefined.deep'); +dotProp.get({foo: {'dot.dot': 'unicorn'}}, 'foo.dot\\.dot'); + +const obj = {foo: {bar: 'a'}}; +dotProp.set(obj, 'foo.bar', 'b'); +dotProp.set(obj, 'foo.baz', 'x'); +dotProp.set(obj, 'foo.dot\\.dot', 'unicorn'); diff --git a/types/dot-prop/v2/index.d.ts b/types/dot-prop/v2/index.d.ts new file mode 100644 index 0000000000..86964e32a7 --- /dev/null +++ b/types/dot-prop/v2/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for dot-prop 2.x +// Project: https://github.com/sindresorhus/dot-prop +// Definitions by: Sam Verschueren +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function get(object: any, path: string): any; +export function set(object: any, path: string, value: any): void; diff --git a/types/dot-prop/v2/tsconfig.json b/types/dot-prop/v2/tsconfig.json new file mode 100644 index 0000000000..2e274e84da --- /dev/null +++ b/types/dot-prop/v2/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "dot-prop": ["dot-prop/v2"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dot-prop-tests.ts" + ] +} diff --git a/types/dot-prop/v2/tslint.json b/types/dot-prop/v2/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dot-prop/v2/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/draft-js/draft-js-tests.tsx b/types/draft-js/draft-js-tests.tsx index 4315611765..46f90a8a31 100644 --- a/types/draft-js/draft-js-tests.tsx +++ b/types/draft-js/draft-js-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import {Map} from "immutable"; +import { Map } from "immutable"; import { ContentBlock, diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 73c248df03..00c9302740 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -903,6 +903,7 @@ declare namespace Draft { } import Editor = Draft.Component.Base.DraftEditor; +import EditorProps = Draft.Component.Base.DraftEditorProps; import EditorBlock = Draft.Component.Components.DraftEditorBlock; import EditorState = Draft.Model.ImmutableData.EditorState; @@ -936,6 +937,7 @@ import getVisibleSelectionRect = Draft.Component.Selection.getVisibleSelectionRe export { Editor, + EditorProps, EditorBlock, EditorState, diff --git a/types/ebongarde-root/ebongarde-root-tests.ts b/types/ebongarde-root/ebongarde-root-tests.ts index f40eec7172..7286f811c6 100644 --- a/types/ebongarde-root/ebongarde-root-tests.ts +++ b/types/ebongarde-root/ebongarde-root-tests.ts @@ -1,3 +1,3 @@ -import {ROOT} from 'ebongarde-root'; +import { ROOT } from 'ebongarde-root'; console.log(ROOT); diff --git a/types/electron-json-storage/electron-json-storage-tests.ts b/types/electron-json-storage/electron-json-storage-tests.ts index dd0504f8b6..3abc584a46 100644 --- a/types/electron-json-storage/electron-json-storage-tests.ts +++ b/types/electron-json-storage/electron-json-storage-tests.ts @@ -1,5 +1,3 @@ -/// - import electron = require('electron'); import storage = require('electron-json-storage'); diff --git a/types/electron-json-storage/index.d.ts b/types/electron-json-storage/index.d.ts index 23b26920af..428b784638 100644 --- a/types/electron-json-storage/index.d.ts +++ b/types/electron-json-storage/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jviotti/electron-json-storage // Definitions by: Sam Saint-Pettersen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.1 export declare function get(key: string, callback: (error: any, data: Object) => void): void; export declare function set(key: string, json: Object, callback: (error: any) => void): void; diff --git a/types/electron-json-storage/package.json b/types/electron-json-storage/package.json new file mode 100644 index 0000000000..b68da5cd37 --- /dev/null +++ b/types/electron-json-storage/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "electron": "^1.7.5" + } +} diff --git a/types/electron-notifications/index.d.ts b/types/electron-notifications/index.d.ts index 3bda7f4ef9..870fcb1bbc 100644 --- a/types/electron-notifications/index.d.ts +++ b/types/electron-notifications/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/blainesch/electron-notifications // Definitions by: Daniel Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 import * as Electron from 'electron'; diff --git a/types/electron-notifications/package.json b/types/electron-notifications/package.json new file mode 100644 index 0000000000..b68da5cd37 --- /dev/null +++ b/types/electron-notifications/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "electron": "^1.7.5" + } +} diff --git a/types/electron-notify/index.d.ts b/types/electron-notify/index.d.ts index 225ab9de9e..16f786d379 100644 --- a/types/electron-notify/index.d.ts +++ b/types/electron-notify/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/hankbao/electron-notify // Definitions by: Daniel Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// @@ -18,7 +19,7 @@ export interface ICustomConfig { appIcon?: string, pathToModule?: string, logging?: boolean, - defaultWindow?: Electron.BrowserWindowOptions, + defaultWindow?: Electron.BrowserWindowConstructorOptions, defaultStyleContainer?: any, defaultStyleAppIcon?: any, defaultStyleImage?: any, @@ -57,4 +58,4 @@ export function closeAll(): void; export function getTemplatePath(): string; -export function setTemplatePath(path: string): void; \ No newline at end of file +export function setTemplatePath(path: string): void; diff --git a/types/electron-notify/package.json b/types/electron-notify/package.json new file mode 100644 index 0000000000..b68da5cd37 --- /dev/null +++ b/types/electron-notify/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "electron": "^1.7.5" + } +} diff --git a/types/electron-window-state/electron-window-state-tests.ts b/types/electron-window-state/electron-window-state-tests.ts index 8a345d0ec9..62ba0599f7 100644 --- a/types/electron-window-state/electron-window-state-tests.ts +++ b/types/electron-window-state/electron-window-state-tests.ts @@ -1,6 +1,6 @@ -import {app, BrowserWindow} from 'electron'; +import { app, BrowserWindow } from 'electron'; import windowStateKeeper = require('electron-window-state'); let win: Electron.BrowserWindow = null; diff --git a/types/electron-window-state/index.d.ts b/types/electron-window-state/index.d.ts index 1ff10ed7d5..1ff0a15878 100644 --- a/types/electron-window-state/index.d.ts +++ b/types/electron-window-state/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mawie81/electron-window-state // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/types/electron-window-state/package.json b/types/electron-window-state/package.json new file mode 100644 index 0000000000..b68da5cd37 --- /dev/null +++ b/types/electron-window-state/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "electron": "^1.7.5" + } +} diff --git a/types/engine.io-client/engine.io-client-tests.ts b/types/engine.io-client/engine.io-client-tests.ts new file mode 100644 index 0000000000..4a73136cef --- /dev/null +++ b/types/engine.io-client/engine.io-client-tests.ts @@ -0,0 +1,77 @@ +import engine = require('engine.io'); +import client = require('engine.io-client'); + +let server: engine.Server; +let socket: client.Socket; +let options: client.SocketOptions = {}; + +options.agent = false; +options.upgrade = true; +options.forceJSONP = false; +options.jsonp = false; +options.forceBase64 = false; +options.enablesXDR = false; +options.timestampRequests = true; +options.timestampParam = 't'; +options.policyPort = 843; +options.path = '/engine.io'; +options.transports = ['websocket']; +options.transportOptions = {}; +options.rememberUpgrade = true; +options.pfx = ''; +options.key = ''; +options.passphrase = ''; +options.cert = ''; +options.ca = ''; +options.ciphers = undefined; +options.rejectUnauthorized = true; +options.perMessageDeflate = false; +options.extraHeaders = {foo: 'bar'}; +options.onlyBinaryUpgrades = true; +options.forceNode = false; +options.localAddress = 'localhost'; + +socket = client("ws://localhost:32767", options); +socket.on('close', (mes, detail) => { + console.log('CLOSE', mes, detail); +}); +socket.on('error', (err) => { + console.log('ERROR', err); +}); + +server = engine.listen(8000, {pingTimeout: 100, pingInterval: 30}); +server.on("connection", socket => { + socket.send('hello'); +}); + +socket = client("ws://localhost:8000"); +socket.on("message", (data) => { + console.log('MESSAGE', data); +}); +socket.on('close', (mes, detail) => { + console.log('CLOSE', mes, detail); +}); +socket.on('ping', () => { + console.log('client ping callback'); +}); +socket.on('pong', () => { + console.log('client pong callback'); +}); +socket.on('flush', () => { + console.log('client flush callback'); +}); +socket.on('drain', () => { + console.log('client drain callback'); +}); +socket.on("open", () => { + socket.send("hi", {compress: false}, () => { + console.log('client send callback'); + setTimeout(() => { + socket.close(); + setTimeout(() => { + server.close(); + server.httpServer!.close(); + }, 200); + }, 200); + }); +}); diff --git a/types/engine.io-client/index.d.ts b/types/engine.io-client/index.d.ts new file mode 100644 index 0000000000..0407c86fed --- /dev/null +++ b/types/engine.io-client/index.d.ts @@ -0,0 +1,184 @@ +// Type definitions for engine.io-client 3.1 +// Project: https://github.com/socketio/engine.io-client +// Definitions by: KentarouTakeda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import http = require('http'); + +declare namespace client { + type Transport = 'polling'|'websocket'; + type Message = string|ArrayBuffer|ArrayBufferView|Blob; + interface MessageOptions { + compress?: boolean; + } + interface SocketOptions { + /** + * http.Agent to use, defaults to false (NodeJS only) + */ + agent?: http.Agent|false; + /** + * defaults to true, whether the client should try to upgrade the transport from long-polling to something better. + */ + upgrade?: boolean; + /** + * forces JSONP for polling transport. + */ + forceJSONP?: boolean; + /** + * determines whether to use JSONP when necessary for polling. + * If disabled (by settings to false) an error will be emitted (saying "No transports available") + * if no other transports are available. If another transport is available + * for opening a connection (e.g. WebSocket) that transport will be used instead. + */ + jsonp?: boolean; + /** + * forces base 64 encoding for polling transport even when XHR2 responseType is available and WebSocket even if the used standard supports binary. + */ + forceBase64?: boolean; + /** + * enables XDomainRequest for IE8 to avoid loading bar flashing with click sound. default to false because XDomainRequest has a flaw of not sending cookie. + */ + enablesXDR?: boolean; + /** + * whether to add the timestamp with each transport request. Note: polling requests are always stamped unless this option is explicitly set to false (false) + */ + timestampRequests?: boolean; + /** + * timestamp parameter (t) + */ + timestampParam?: string; + /** + * port the policy server listens on (843) + */ + policyPort?: number; + /** + * path to connect to, default is /engine.io + */ + path?: string; + /** + * a list of transports to try (in order). Defaults to ['polling', 'websocket']. Engine always attempts to connect directly with the first one, provided the feature detection test for it passes. + */ + transports?: Transport[]; + /** + * hash of options, indexed by transport name, overriding the common options for the given transport + */ + transportOptions?: {[key: string]: SocketOptions}; + /** + * defaults to false. If true and if the previous websocket connection to the server succeeded, + * the connection attempt will bypass the normal upgrade process and will initially try websocket. + * A connection attempt following a transport error will use the normal upgrade process. + * It is recommended you turn this on only when using SSL/TLS connections, + * or if you know that your network does not block websockets. + */ + rememberUpgrade?: boolean; + /** + * Certificate, Private key and CA certificates to use for SSL. Can be used in Node.js client environment to manually specify certificate information. + */ + pfx?: string; + /** + * Private key to use for SSL. Can be used in Node.js client environment to manually specify certificate information. + */ + key?: string; + /** + * A string of passphrase for the private key or pfx. Can be used in Node.js client environment to manually specify certificate information. + */ + passphrase?: string; + /** + * Public x509 certificate to use. Can be used in Node.js client environment to manually specify certificate information. + */ + cert?: string; + /** + * An authority certificate or array of authority certificates to check the remote host against. + * Can be used in Node.js client environment to manually specify certificate information. + */ + ca?: string|string[]; + /** + * A string describing the ciphers to use or exclude. Consult the cipher format list for details on the format. + * Can be used in Node.js client environment to manually specify certificate information. + */ + ciphers?: string; + /** + * If true, the server certificate is verified against the list of supplied CAs. + * An 'error' event is emitted if verification fails. Verification happens at the connection level, + * before the HTTP request is sent. Can be used in Node.js client environment to manually specify certificate information. + */ + rejectUnauthorized?: boolean; + /** + * parameters of the WebSocket permessage-deflate extension (see ws module api docs). Set to false to disable. (true) + */ + perMessageDeflate?: any; + /** + * Headers that will be passed for each request to the server (via xhr-polling and via websockets). + * These values then can be used during handshake or for special proxies. Can only be used in Node.js client environment. + */ + extraHeaders?: {[header: string]: string}; + /** + * whether transport upgrades should be restricted to transports supporting binary data (false) + */ + onlyBinaryUpgrades?: boolean; + /** + * Uses NodeJS implementation for websockets - even if there is a native Browser-Websocket available, + * which is preferred by default over the NodeJS implementation. (This is useful when using hybrid platforms + * like nw.js or electron) (false, NodeJS only) + */ + forceNode?: boolean; + /** + * the local IP address to connect to + */ + localAddress?: string; + } + + interface UpgradeError extends Error { + transport: string; + } + + class Socket { + protocol?: number; + binaryType?: 'arraybuffer'|'blob'; + + /* + * open: Fired upon successful connection. + * flush: Fired upon completing a buffer flush + * drain: Fired after drain event of transport if writeBuffer is empty + * ping: Fired upon flushing a ping packet (ie: actual packet write out) + * pong: Fired upon receiving a pong packet. + */ + on(ev: 'open'|'flush'|'drain'|'ping'|'pong' , cb: () => void): this; + /* + * Fired when data is received from the server. + */ + on(ev: 'message' , cb: (data: string|ArrayBuffer) => void): this; + /* + * Fired upon disconnection. In compliance with the WebSocket API spec, this event may be fired even if the open event does not occur (i.e. due to connection error or close()). + */ + on(ev: 'close' , cb: (mes: string, detail?: Error) => void): this; + /* + * Fired when an error occurs. + */ + on(ev: 'error' , cb: (err: Error) => void): this; + /* + * Fired if an error occurs with a transport we're trying to upgrade to. + */ + on(ev: 'upgradeError' , cb: (err: UpgradeError) => void): this; + /* + * Fired upon upgrade success, after the new transport is set + */ + on(ev: 'upgrade' , cb: (transport: any) => void): this; + + /** + * Sends a message to the server + */ + send(message: Message, opts?: MessageOptions, cb?: () => void): this; + + /** + * Disconnects the client. + */ + close(): this; + } +} + +declare function client(url?: string, opts?: client.SocketOptions): client.Socket; + +export = client; diff --git a/types/engine.io-client/tsconfig.json b/types/engine.io-client/tsconfig.json new file mode 100644 index 0000000000..aacd3365c5 --- /dev/null +++ b/types/engine.io-client/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "noImplicitReturns": true, + "strict": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "engine.io-client-tests.ts" + ] +} diff --git a/types/engine.io-client/tslint.json b/types/engine.io-client/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/engine.io-client/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/epub/index.d.ts b/types/epub/index.d.ts index fe4f36ce87..2c2480e91a 100644 --- a/types/epub/index.d.ts +++ b/types/epub/index.d.ts @@ -32,7 +32,7 @@ **/ declare module "epub" { - import {EventEmitter} from "events"; + import { EventEmitter } from "events"; interface TocElement { level: number; diff --git a/types/ethjs-signer/ethjs-signer-tests.ts b/types/ethjs-signer/ethjs-signer-tests.ts new file mode 100644 index 0000000000..7f6939fc3b --- /dev/null +++ b/types/ethjs-signer/ethjs-signer-tests.ts @@ -0,0 +1,16 @@ +import { sign, recover } from "ethjs-signer"; + +const nonce = 0; +const privateKey = '0xecbcd9838f7f2afa6e809df8d7cdae69aa5dfc14d563ee98e97effd3f6a652f2'; + +const transaction = { + to: '0xce31a19193d4b23f4e9d6163d7247243bAF801c3', + value: 300000, + gasPrice: 2000000, + nonce +}; + +const signedTransactionString = sign(transaction, privateKey) as string; +const signedTransaction = sign(transaction, privateKey, true) as any[]; + +const publicKey = recover(signedTransactionString, -1, signedTransaction[7], signedTransaction[8]); diff --git a/types/ethjs-signer/index.d.ts b/types/ethjs-signer/index.d.ts new file mode 100644 index 0000000000..969ed9e9ea --- /dev/null +++ b/types/ethjs-signer/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for ethjs-signer 0.1 +// Project: https://github.com/ethjs/ethjs-signer/ +// Definitions by: Bryson Thill +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +/** + * Signs a raw transaction and return it either as a serialized hex string or raw tx object. + */ +export function sign(transaction: object, privateKey: string, toObject?: false): string; +export function sign(transaction: object, privateKey: string, toObject: true): any[]; + +/** + * Recovers a ECDSA public key from a raw transaction. + */ +export function recover(rawTx: string | Buffer, v: number, r: Buffer, s: Buffer): Buffer; diff --git a/types/ethjs-signer/tsconfig.json b/types/ethjs-signer/tsconfig.json new file mode 100644 index 0000000000..202b9ca11a --- /dev/null +++ b/types/ethjs-signer/tsconfig.json @@ -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", + "ethjs-signer-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ethjs-signer/tslint.json b/types/ethjs-signer/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/ethjs-signer/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/exceljs/index.d.ts b/types/exceljs/index.d.ts index be82b7d7f9..87b7864016 100644 --- a/types/exceljs/index.d.ts +++ b/types/exceljs/index.d.ts @@ -501,17 +501,17 @@ export interface Column { /** * Can be a string to set one row high header or an array to set multi-row high header */ - header: string | string[]; + header?: string | string[]; /** * The name of the properties associated with this column in each row */ - key: string; + key?: string; /** * The width of the column */ - width: number; + width?: number; /** * Set an outline level for columns diff --git a/types/expect/expect-tests.ts b/types/expect/expect-tests.ts index 6238a63c60..41bdbe5581 100644 --- a/types/expect/expect-tests.ts +++ b/types/expect/expect-tests.ts @@ -1,6 +1,6 @@ /// -import {Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies} from 'expect'; +import { Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies } from 'expect'; import * as expect from 'expect'; describe('chaining assertions', () => { diff --git a/types/falcor-express/index.d.ts b/types/falcor-express/index.d.ts index b149df75b9..c8a65e9f6c 100644 --- a/types/falcor-express/index.d.ts +++ b/types/falcor-express/index.d.ts @@ -7,6 +7,6 @@ -import {Request, Response, Handler} from 'express'; +import { Request, Response, Handler } from 'express'; import {DataSource} from 'falcor'; declare function dataSourceRoute(getDataSource: (req: Request, res: Response) => DataSource): Handler; diff --git a/types/falcor-http-datasource/falcor-http-datasource-tests.ts b/types/falcor-http-datasource/falcor-http-datasource-tests.ts index b341274a19..e014706df1 100644 --- a/types/falcor-http-datasource/falcor-http-datasource-tests.ts +++ b/types/falcor-http-datasource/falcor-http-datasource-tests.ts @@ -1,5 +1,5 @@ import HttpDataSource from 'falcor-http-datasource'; -import {Model} from 'falcor'; +import { Model } from 'falcor'; const model = new Model({ source: new HttpDataSource('/model.json') diff --git a/types/falcor-json-graph/falcor-json-graph-tests.ts b/types/falcor-json-graph/falcor-json-graph-tests.ts index 992ede0053..1b082c4720 100644 --- a/types/falcor-json-graph/falcor-json-graph-tests.ts +++ b/types/falcor-json-graph/falcor-json-graph-tests.ts @@ -1,6 +1,6 @@ -import {Key, KeySet, Path, PathSet, ref, atom, error, pathValue, pathInvalidation} from 'falcor-json-graph'; +import { Key, KeySet, Path, PathSet, ref, atom, error, pathValue, pathInvalidation } from 'falcor-json-graph'; const stringKey: Key = "productsById"; const numberKey: Key = 10; diff --git a/types/file-saver/file-saver-tests.ts b/types/file-saver/file-saver-tests.ts index c76815a6fb..1cc06f58ba 100644 --- a/types/file-saver/file-saver-tests.ts +++ b/types/file-saver/file-saver-tests.ts @@ -1,6 +1,6 @@ -import {saveAs as importedSaveAs} from "file-saver"; +import { saveAs as importedSaveAs } from "file-saver"; function testImportedSaveAs() { var data: Blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); var filename: string = 'hello world.txt'; diff --git a/types/finalhandler/finalhandler-tests.ts b/types/finalhandler/finalhandler-tests.ts index af3550a4f4..81b9565404 100644 --- a/types/finalhandler/finalhandler-tests.ts +++ b/types/finalhandler/finalhandler-tests.ts @@ -1,5 +1,5 @@ -import {ServerRequest, ServerResponse} from "http"; +import { ServerRequest, ServerResponse } from "http"; import * as finalHandler from "finalhandler"; let req: ServerRequest; diff --git a/types/finalhandler/index.d.ts b/types/finalhandler/index.d.ts index a238c0d2a5..baad707772 100644 --- a/types/finalhandler/index.d.ts +++ b/types/finalhandler/index.d.ts @@ -5,7 +5,7 @@ /// -import {ServerRequest, ServerResponse} from "http"; +import { ServerRequest, ServerResponse } from "http"; declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: finalHandler.Options): (err: any) => void; diff --git a/types/fixed-data-table/fixed-data-table-tests.tsx b/types/fixed-data-table/fixed-data-table-tests.tsx index 96c17a4a9a..cdbd46eb6c 100644 --- a/types/fixed-data-table/fixed-data-table-tests.tsx +++ b/types/fixed-data-table/fixed-data-table-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import {Table, Cell, Column, CellProps} from "fixed-data-table"; +import { Table, Cell, Column, CellProps } from "fixed-data-table"; // create your Table class MyTable1 extends React.Component { diff --git a/types/flat/flat-tests.ts b/types/flat/flat-tests.ts index 68699326c3..324ee3bb14 100644 --- a/types/flat/flat-tests.ts +++ b/types/flat/flat-tests.ts @@ -1,6 +1,6 @@ -import {flatten, unflatten} from "flat"; +import { flatten, unflatten } from "flat"; namespace TestFlatten { let options: { diff --git a/types/geokdbush/index.d.ts b/types/geokdbush/index.d.ts index 4ece8ff98d..117a1c10e9 100644 --- a/types/geokdbush/index.d.ts +++ b/types/geokdbush/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Denis Carriere // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {KDBush} from 'kdbush'; +import { KDBush } from 'kdbush'; export function around( index: KDBush, diff --git a/types/gl-matrix/gl-matrix-tests.ts b/types/gl-matrix/gl-matrix-tests.ts index 6325ff5cd4..3642cca521 100644 --- a/types/gl-matrix/gl-matrix-tests.ts +++ b/types/gl-matrix/gl-matrix-tests.ts @@ -1,5 +1,5 @@ // common -import {vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat} from "gl-matrix"; +import { vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat } from "gl-matrix"; var outVal: number; var outBool: boolean; diff --git a/types/google-libphonenumber/google-libphonenumber-tests.ts b/types/google-libphonenumber/google-libphonenumber-tests.ts index 9f6fd2e7e7..f9e7c4bf8e 100644 --- a/types/google-libphonenumber/google-libphonenumber-tests.ts +++ b/types/google-libphonenumber/google-libphonenumber-tests.ts @@ -1,6 +1,6 @@ import libphonenumber = require('google-libphonenumber'); -import {PhoneNumberFormat, PhoneNumberUtil, AsYouTypeFormatter} from 'google-libphonenumber'; +import { PhoneNumberFormat, PhoneNumberUtil, AsYouTypeFormatter } from 'google-libphonenumber'; () => { // Require `PhoneNumberFormat`. diff --git a/types/graphql-date/graphql-date-tests.ts b/types/graphql-date/graphql-date-tests.ts index 07542c8c0d..14a6882646 100644 --- a/types/graphql-date/graphql-date-tests.ts +++ b/types/graphql-date/graphql-date-tests.ts @@ -1,4 +1,4 @@ -import {GraphQLObjectType} from 'graphql'; +import { GraphQLObjectType } from 'graphql'; import * as GraphQLDate from 'graphql-date'; const fooType = new GraphQLObjectType({ diff --git a/types/graphql-date/index.d.ts b/types/graphql-date/index.d.ts index 20cd74d61e..35ad44f7e1 100644 --- a/types/graphql-date/index.d.ts +++ b/types/graphql-date/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Eric Naeseth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {GraphQLScalarType} from 'graphql'; +import { GraphQLScalarType } from 'graphql'; declare const date: GraphQLScalarType; diff --git a/types/graphql-type-json/graphql-type-json-tests.ts b/types/graphql-type-json/graphql-type-json-tests.ts index 3282681845..8d2435270e 100644 --- a/types/graphql-type-json/graphql-type-json-tests.ts +++ b/types/graphql-type-json/graphql-type-json-tests.ts @@ -1,4 +1,4 @@ -import {GraphQLObjectType, GraphQLInputObjectType} from "graphql"; +import { GraphQLObjectType, GraphQLInputObjectType } from "graphql"; import * as GraphQLJSON from "graphql-type-json"; const TestType = new GraphQLObjectType({ diff --git a/types/graphql-type-json/index.d.ts b/types/graphql-type-json/index.d.ts index 7d41b83013..c9549b946d 100644 --- a/types/graphql-type-json/index.d.ts +++ b/types/graphql-type-json/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/taion/graphql-type-json#readme // Definitions by: Pavel Ivanov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {GraphQLScalarType} from "graphql"; +import { GraphQLScalarType } from "graphql"; declare const GraphQLJSON: GraphQLScalarType; export = GraphQLJSON; diff --git a/types/gulp-watch/index.d.ts b/types/gulp-watch/index.d.ts index f9855f09a6..8b96e78c97 100644 --- a/types/gulp-watch/index.d.ts +++ b/types/gulp-watch/index.d.ts @@ -5,7 +5,7 @@ /// -import {SrcOptions} from "vinyl-fs"; +import { SrcOptions } from "vinyl-fs"; interface IOptions extends SrcOptions { ignoreInitial?: boolean; diff --git a/types/hapi-auth-jwt2/index.d.ts b/types/hapi-auth-jwt2/index.d.ts index 2e5826e044..0109bfb33d 100644 --- a/types/hapi-auth-jwt2/index.d.ts +++ b/types/hapi-auth-jwt2/index.d.ts @@ -2,7 +2,7 @@ // Project: http://github.com/dwyl/hapi-auth-jwt2 // Definitions by: Warren Seymour // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {Request, Response, PluginFunction} from 'hapi'; +import { Request, Response, PluginFunction } from 'hapi'; declare namespace hapiAuthJwt2 { /** diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 91432e1d1f..789a181efd 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -42,7 +42,7 @@ import { type JoiValidationObject = JoiSchema | JoiSchemaMap | (JoiSchema | JoiSchemaMap)[]; import * as Catbox from 'catbox'; -import {MimosOptions} from 'mimos'; +import { MimosOptions } from 'mimos'; import Podium = require('podium'); import * as Shot from 'shot'; diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 4a252c899f..914fb83f96 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -6694,6 +6694,8 @@ declare namespace Highcharts { getOptions(): Options; map(array: any[], fn: Function): any[]; + + wrap(prototype: any, type: string, cb: (proceed: Function, ...args: any[]) => void): void; } /** diff --git a/types/iconv/iconv-tests.ts b/types/iconv/iconv-tests.ts index 396c207279..d3d9bff917 100644 --- a/types/iconv/iconv-tests.ts +++ b/types/iconv/iconv-tests.ts @@ -1,5 +1,5 @@ import Iconv = require("iconv"); -import {Writable} from "stream"; +import { Writable } from "stream"; const iconv: Iconv.Iconv = new Iconv("utf-8", "cp932"); const iconvFromFunction: Iconv.Iconv = Iconv("utf-8", "cp932"); diff --git a/types/inherits/index.d.ts b/types/inherits/index.d.ts index 0c8b2f0f8c..4ae7eef4c5 100644 --- a/types/inherits/index.d.ts +++ b/types/inherits/index.d.ts @@ -6,5 +6,5 @@ /// -import {inherits} from "util"; +import { inherits } from "util"; export = inherits; diff --git a/types/inline-style-prefixer/index.d.ts b/types/inline-style-prefixer/index.d.ts new file mode 100644 index 0000000000..f5b496f25a --- /dev/null +++ b/types/inline-style-prefixer/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for inline-style-prefixer 3.0 +// Project: https://github.com/rofrischmann/inline-style-prefixer +// Definitions by: Andrej Hazucha +// dpetrezselyova +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = InlineStylePrefixer; + +interface Configuration { + userAgent?: string; + keepUnprefixed?: boolean; +} + +declare class InlineStylePrefixer { + constructor(cfg?: Configuration); + + prefix(style: CSSStyleDeclaration): CSSStyleDeclaration; + + // support for React.CSSProperties + prefix(style: T): T; + + static prefixAll(style: CSSStyleDeclaration): CSSStyleDeclaration; + + // support for React.CSSProperties + static prefixAll(style: T): T; +} diff --git a/types/inline-style-prefixer/inline-style-prefixer-tests.ts b/types/inline-style-prefixer/inline-style-prefixer-tests.ts new file mode 100644 index 0000000000..7592cdc252 --- /dev/null +++ b/types/inline-style-prefixer/inline-style-prefixer-tests.ts @@ -0,0 +1,8 @@ +import Prefixer = require('inline-style-prefixer'); + +const prefixer = new Prefixer(); + +const prefixed = prefixer.prefix({ + fontSize: '16', + flexDirection: 'column' +} as CSSStyleDeclaration); diff --git a/types/inline-style-prefixer/tsconfig.json b/types/inline-style-prefixer/tsconfig.json new file mode 100644 index 0000000000..a0651edee4 --- /dev/null +++ b/types/inline-style-prefixer/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "inline-style-prefixer-tests.ts" + ] +} diff --git a/types/inline-style-prefixer/tslint.json b/types/inline-style-prefixer/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/inline-style-prefixer/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/japanese-holidays/japanese-holidays-tests.ts b/types/japanese-holidays/japanese-holidays-tests.ts index 32f760360e..a3f77b2dc4 100644 --- a/types/japanese-holidays/japanese-holidays-tests.ts +++ b/types/japanese-holidays/japanese-holidays-tests.ts @@ -1,4 +1,4 @@ -import {isHoliday, isHolidayAt, getHolidaysOf} from 'japanese-holidays'; +import { isHoliday, isHolidayAt, getHolidaysOf } from 'japanese-holidays'; const date = new Date(2017, 0, 9); const h: string | undefined = isHoliday(date); diff --git a/types/jdenticon/jdenticon-tests.ts b/types/jdenticon/jdenticon-tests.ts index b26a01696b..aaa5abc531 100644 --- a/types/jdenticon/jdenticon-tests.ts +++ b/types/jdenticon/jdenticon-tests.ts @@ -1,4 +1,4 @@ -import {jdenticon} from "jdenticon"; +import { jdenticon } from "jdenticon"; function testJdenticon() { if (typeof jdenticon.version !== 'string') { diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 633af80085..267f1d4a1a 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -729,7 +729,7 @@ declare namespace jest { type TestResultsProcessor = (testResult: AggregatedResult) => AggregatedResult; type HasteResolver = any; // import HasteResolver from 'jest-resolve'; - type ModuleMocker = any; // import {ModuleMocker} from 'jest-mock'; + type ModuleMocker = any; // import { ModuleMocker } from 'jest-mock'; type ModuleMap = any; // import {ModuleMap} from 'jest-haste-map'; type HasteFS = any; // import {FS as HasteFS} from 'jest-haste-map'; type Runtime = any; // import Runtime from 'jest-runtime'; diff --git a/types/jpm/jpm-tests.ts b/types/jpm/jpm-tests.ts index 526bbe6063..34523f1a14 100644 --- a/types/jpm/jpm-tests.ts +++ b/types/jpm/jpm-tests.ts @@ -100,7 +100,7 @@ console.log(urls.toFilename(urls.URL("http://example.com"))); console.log(urls.DataURL("file:///my/path/file.txt").mimeType); import * as windows from "sdk/windows"; -import {stringify} from "sdk/querystring"; +import { stringify } from "sdk/querystring"; for (let window of windows.browserWindows) { console.info(window.title); } diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 2fd196fd41..024dcc3ab8 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -6281,7 +6281,7 @@ declare namespace JQuery { */ interface Promise3 { + VR, VJ, VN> extends PromiseLike { /** * Add handlers to be called when the Deferred object is either resolved or rejected. * @@ -6611,7 +6611,7 @@ declare namespace JQuery { CRP = never, CJP = never, CNP = never> (doneFilter: null, failFilter: null, - progressFilter: (t: TN, u: UN, v: VN) => Promise3 Promise3 | Thenable | ANP): Promise3; - // PromiseLike compatibility - then(onfulfilled?: ((value: TR) => TResult1 | PromiseLike) | undefined | null, - onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; /** * Add handlers to be called when the Deferred object is rejected. @@ -6712,7 +6709,7 @@ declare namespace JQuery { * * @see {@link http://api.jquery.com/Types/#Promise} */ - interface Promise { + interface Promise extends PromiseLike { /** * Add handlers to be called when the Deferred object is either resolved or rejected. * diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 4bbe9c553e..d223be9d5c 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -7153,6 +7153,10 @@ function Promise3() { a; // $ExpectType string }); } + + async function testAsync(p: JQuery.Promise3): Promise { + return await p; + } } function Promise2(p: JQuery.Promise2) { @@ -7284,6 +7288,10 @@ function Promise2(p: JQuery.Promise2): Promise { + return await p; + } } function _Promise(p: JQuery.Promise) { @@ -7392,4 +7400,8 @@ function _Promise(p: JQuery.Promise) { }); } } + + async function testAsync(p: JQuery.Promise): Promise { + return await p; + } } diff --git a/types/json-rpc-ws/index.d.ts b/types/json-rpc-ws/index.d.ts new file mode 100644 index 0000000000..61d72afcf4 --- /dev/null +++ b/types/json-rpc-ws/index.d.ts @@ -0,0 +1,118 @@ +// Type definitions for json-rpc-ws 4.0 +// Project: https://www.npmjs.com/package/json-rpc-ws +// Definitions by: Nicolas Penin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as ws from 'ws'; + +export function createServer(): Server; +export function createClient(): Client; + +export class Server extends Base { + constructor(); + + /** + * Start the server + */ + start(options?: ws.IServerOptions, callback?: () => void): void; + server: ws.Server; + /** + * Stop the server + */ + stop(): void; +} + +export class Client extends Base { + constructor(WebSocket: ws, browser?: boolean); + + /** + * Connect to a json-rpc-ws server + */ + connect(url: string, connected: () => void): void; + + /** + * Test whether we have a connection or not + */ + isConnected(): boolean; + + /** + * Return the current connection (there can be only one) + */ + getConnection(): TConnection; + + /** + * Close the current connection + */ + disconnect(callback: () => void): void; +} +export class Base { + /** + * Add a handler function for a given method + */ + expose(eventName: string, handler: Handler): void; + /** + * Send a method request through a specific connection + */ + send(eventName: string, params?: ParamType, callback?: ReplyCallback): void; + send(eventName: string, params: ParamType): void; + /** + * Connected event handler + */ + connected(socket: ws): void; + /** + * Disconnected event handler + */ + disconnected(connection: TConnection): void; + /** + * Test if a handler exists for a given method + */ + hasHandler(method: string): boolean; + + /** + * Get handler for a given method + */ + getHandler(method: string): Handler; + /** + * Get a connection by id + */ + getConnection(id: string): Connection; + /** + * Shut down all existing connections + * + * @public + */ + hangup(): void; +} + +export interface Connection { + id: string; + socket: ws; + parent: Base; + responseHandlers: { [id: string]: ReplyCallback }; + sendRaw(payload: Payload): void; + processPayload(payload: Payload): void; + sendResult(id: string, error?: any, result?: any): void; + sendMethod(method: string, params: ParamType, callback?: ReplyCallback): void; + sendError(error: any, id?: string, data?: any): void; + close(error?: any): void; + hangup(callback?: () => void): void; + message(data: any): void; +} + +export interface Payload { + jsonrpc?: '2.0'; + id: string; + method: string; + params?: ParamType; + result?: any; + error?: any; +} + +export type Handler = (this: TConnection, params: ParamType, reply: ReplyCallback) => void; +export type ReplyCallback = (error: any, params?: ParamType) => void; + +/** + * Returns a valid jsonrpc2.0 error reply + */ +export function Errors(type: string, id: string | number | null, data: any): any | null; diff --git a/types/json-rpc-ws/json-rpc-ws-tests.ts b/types/json-rpc-ws/json-rpc-ws-tests.ts new file mode 100644 index 0000000000..efcf51cfaf --- /dev/null +++ b/types/json-rpc-ws/json-rpc-ws-tests.ts @@ -0,0 +1,42 @@ +import * as JsonRpcWs from 'json-rpc-ws'; + +let server = JsonRpcWs.createServer(); + +server.expose('mirror', function mirror(params, reply) { + console.log('mirror handler', params); + reply(null, params); +}); + +server.start({ port: 8080 }, function started() { + console.log('Server started on port 8080'); +}); + +let client = JsonRpcWs.createClient(); + +client.connect('ws://localhost:8080', function connected() { + client.send('mirror', ['a param', 'another param'], function mirrorReply(error, reply) { + console.log('mirror reply', reply); + }); +}); + +interface CustomConnection extends JsonRpcWs.Connection { + rooms?: string[]; +} + +let serverWithCustomConnection = JsonRpcWs.createServer(); + +serverWithCustomConnection.expose('join', function(params: { room: string }) { + this.rooms = this.rooms || []; + this.rooms.push(params.room); + console.log(this.id + ' joined ' + params.room); +}); + +serverWithCustomConnection.start({ port: 8080 }, () => { + console.log('Server started on port 8080'); +}); + +let clientForServerWithCustomConnection = JsonRpcWs.createClient(); + +client.connect('ws://localhost:8080', () => { + client.send('join', { room: 'my room' }); +}); diff --git a/types/json-rpc-ws/tsconfig.json b/types/json-rpc-ws/tsconfig.json new file mode 100644 index 0000000000..9707d8e10f --- /dev/null +++ b/types/json-rpc-ws/tsconfig.json @@ -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", + "json-rpc-ws-tests.ts" + ] +} \ No newline at end of file diff --git a/types/json-rpc-ws/tslint.json b/types/json-rpc-ws/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/json-rpc-ws/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/json-socket/index.d.ts b/types/json-socket/index.d.ts index cd38cf94c2..e496cdcaf5 100644 --- a/types/json-socket/index.d.ts +++ b/types/json-socket/index.d.ts @@ -7,7 +7,7 @@ -import {Socket} from "net"; +import { Socket } from "net"; declare class JsonSocket extends Socket { diff --git a/types/json-socket/json-socket-tests.ts b/types/json-socket/json-socket-tests.ts index f8a4a4a1a7..84e4e6f1a1 100644 --- a/types/json-socket/json-socket-tests.ts +++ b/types/json-socket/json-socket-tests.ts @@ -1,6 +1,6 @@ import JsonSocket = require("json-socket"); -import {Socket} from "net"; +import { Socket } from "net"; JsonSocket.sendSingleMessage(42, "localhost", {foo: "bar"}, (err: Error) => {}); JsonSocket.sendSingleMessageAndReceive(42, "localhost", {foo: "bar"}, (err: Error, message: any) => {}); diff --git a/types/jsoneditor/jsoneditor-tests.ts b/types/jsoneditor/jsoneditor-tests.ts index 3c8b66d76b..cc659cfe04 100644 --- a/types/jsoneditor/jsoneditor-tests.ts +++ b/types/jsoneditor/jsoneditor-tests.ts @@ -1,4 +1,4 @@ -import JSONEditor, {JSONEditorMode, JSONEditorNode, JSONEditorOptions} from 'jsoneditor'; +import JSONEditor, {JSONEditorMode, JSONEditorNode, JSONEditorOptions } from 'jsoneditor'; let options: JSONEditorOptions; options = { diff --git a/types/jui-core/jui-core-tests.ts b/types/jui-core/jui-core-tests.ts index a5d4f23bcb..64e97a9a11 100644 --- a/types/jui-core/jui-core-tests.ts +++ b/types/jui-core/jui-core-tests.ts @@ -1,4 +1,4 @@ -import {jui, UtilColor, UtilBase} from "jui-core"; +import { jui, UtilColor, UtilBase } from "jui-core"; jui.ready(["util.color"], (color: UtilColor) => { console.log(color.rgb("#ff0000")); diff --git a/types/jui-grid/jui-grid-tests.ts b/types/jui-grid/jui-grid-tests.ts index 3b5bfa3db8..f2d1781b77 100644 --- a/types/jui-grid/jui-grid-tests.ts +++ b/types/jui-grid/jui-grid-tests.ts @@ -1,7 +1,7 @@ /// -import {jui} from 'jui-core'; -import {GridTable, GridXTable, GridRow} from "jui-grid"; +import { jui } from 'jui-core'; +import { GridTable, GridXTable, GridRow } from "jui-grid"; jui.ready([ "grid.table" ], (table: GridTable) => { const table_1: GridTable = table("#table_1", { diff --git a/types/jui/jui-tests.ts b/types/jui/jui-tests.ts index 5cc6dd93f2..739c320604 100644 --- a/types/jui/jui-tests.ts +++ b/types/jui/jui-tests.ts @@ -1,4 +1,4 @@ -import {jui} from 'jui-core'; +import { jui } from 'jui-core'; import { UIAccordion, UIAutoComplete, UIColorPicker, UICombo, UIDatePicker, UIDropdown, UIModal, UINotify, UIPaging, UIProgress, UIProperty, UISelect diff --git a/types/kdbush/kdbush-tests.ts b/types/kdbush/kdbush-tests.ts index fb7e268290..e552af4c19 100644 --- a/types/kdbush/kdbush-tests.ts +++ b/types/kdbush/kdbush-tests.ts @@ -1,5 +1,5 @@ import * as kdbush from 'kdbush'; -import {KDBush} from 'kdbush'; +import { KDBush } from 'kdbush'; // API const points = [[110, 60], [130, 40]]; diff --git a/types/knex/index.d.ts b/types/knex/index.d.ts index 4df241d8d4..3a76221bd4 100644 --- a/types/knex/index.d.ts +++ b/types/knex/index.d.ts @@ -67,6 +67,7 @@ declare namespace Knex { // Withs with: With; withRaw: WithRaw; + withSchema: WithSchema; withWrapped: WithWrapped; // Wheres @@ -220,6 +221,10 @@ declare namespace Knex { (alias: string, sql: string, bindings?: Value[] | Object): QueryBuilder; } + interface WithSchema { + (schema: string): QueryBuilder + } + interface WithWrapped { (alias: string, callback: (queryBuilder: QueryBuilder) => any): QueryBuilder; } diff --git a/types/koa-generic-session/koa-generic-session-tests.ts b/types/koa-generic-session/koa-generic-session-tests.ts index e9a4f94232..e48d4dbef6 100644 --- a/types/koa-generic-session/koa-generic-session-tests.ts +++ b/types/koa-generic-session/koa-generic-session-tests.ts @@ -1,5 +1,5 @@ import * as Koa from "koa"; -import {MemoryStore, Session} from "koa-generic-session"; +import { MemoryStore, Session } from "koa-generic-session"; import session = require("koa-generic-session"); const app = new Koa(); diff --git a/types/koa-helmet/index.d.ts b/types/koa-helmet/index.d.ts index f97480f505..3e862fe6e6 100644 --- a/types/koa-helmet/index.d.ts +++ b/types/koa-helmet/index.d.ts @@ -11,7 +11,7 @@ import { IHelmetDnsPrefetchControlConfiguration, IHelmetHpkpConfiguration, IHelmetReferrerPolicyConfiguration } from 'helmet'; -import {Middleware, Context} from 'koa'; +import { Middleware, Context } from 'koa'; declare namespace koaHelmet { type KoaHelmetContentSecurityPolicyDirectiveFunction = (ctx: Context) => string; diff --git a/types/koa-redis/index.d.ts b/types/koa-redis/index.d.ts index 94937c6455..1103665858 100644 --- a/types/koa-redis/index.d.ts +++ b/types/koa-redis/index.d.ts @@ -3,8 +3,8 @@ // Definitions by: Nick Simmons // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {ClientOpts} from 'redis'; -import {SessionStore} from 'koa-generic-session'; +import { ClientOpts } from 'redis'; +import { SessionStore } from 'koa-generic-session'; declare namespace redisStore { interface RedisOptions extends ClientOpts { diff --git a/types/koa-redis/koa-redis-tests.ts b/types/koa-redis/koa-redis-tests.ts index 68d557336c..21c8e010b0 100644 --- a/types/koa-redis/koa-redis-tests.ts +++ b/types/koa-redis/koa-redis-tests.ts @@ -1,5 +1,5 @@ import * as Koa from "koa"; -import {MemoryStore, Session} from "koa-generic-session"; +import { MemoryStore, Session } from "koa-generic-session"; import session = require("koa-generic-session"); import redisStore = require("koa-redis"); diff --git a/types/libpq/index.d.ts b/types/libpq/index.d.ts index d336d95c9f..1ad194eb14 100644 --- a/types/libpq/index.d.ts +++ b/types/libpq/index.d.ts @@ -6,8 +6,8 @@ /// -import {EventEmitter} from 'events'; -import {Buffer} from 'buffer'; +import { EventEmitter } from 'events'; +import { Buffer } from 'buffer'; declare namespace Libpq { interface NotifyMsg { diff --git a/types/libpq/libpq-tests.ts b/types/libpq/libpq-tests.ts index b6afd997e5..fee968dabc 100644 --- a/types/libpq/libpq-tests.ts +++ b/types/libpq/libpq-tests.ts @@ -1,6 +1,6 @@ /// -import {Buffer} from 'buffer'; +import { Buffer } from 'buffer'; import * as assert from 'assert'; import * as async from 'async'; import * as PQ from 'libpq'; diff --git a/types/ltx/index.d.ts b/types/ltx/index.d.ts index b466521876..33311a3175 100644 --- a/types/ltx/index.d.ts +++ b/types/ltx/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -export {Element} from './lib/Element'; +export {Element } from './lib/Element'; export {nameEqual, attrsEqual, childrenEqual, equal} from './lib/equal'; export {isNode, isElement, isText} from './lib/is'; export {clone} from './lib/clone'; diff --git a/types/ltx/lib/Parser.d.ts b/types/ltx/lib/Parser.d.ts index 3af418d21f..083e3ace66 100644 --- a/types/ltx/lib/Parser.d.ts +++ b/types/ltx/lib/Parser.d.ts @@ -1,5 +1,5 @@ /// -import {EventEmitter} from 'events'; +import { EventEmitter } from 'events'; export declare class Parser extends EventEmitter { constructor(options?: any); } diff --git a/types/ltx/lib/createElement.d.ts b/types/ltx/lib/createElement.d.ts index 2deead1663..c372f11150 100644 --- a/types/ltx/lib/createElement.d.ts +++ b/types/ltx/lib/createElement.d.ts @@ -1,2 +1,2 @@ -import {Element} from './Element'; +import { Element } from './Element'; export declare function createElement(name: string, attrs: any): Element; diff --git a/types/markdown-it-anchor/index.d.ts b/types/markdown-it-anchor/index.d.ts index 93bcdac9f8..045082abf1 100644 --- a/types/markdown-it-anchor/index.d.ts +++ b/types/markdown-it-anchor/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import {MarkdownIt, Core, Token} from 'markdown-it'; +import { MarkdownIt, Core, Token } from 'markdown-it'; declare namespace anchor { interface AnchorInfo { diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 632ab397b7..8373997f5c 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -9,6 +9,7 @@ // Matthias Schlesinger // Jonathon Kelly // Artyom Stukans +// Dan Jones // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -1472,6 +1473,7 @@ declare namespace __MaterialUI { style?: React.CSSProperties; uncheckedIcon?: React.ReactElement<{ style?: React.CSSProperties }>; // Normally an SvgIcon valueLink?: ReactLink; + inputStyle?: React.CSSProperties; } export class Checkbox extends React.Component { /** @deprecated Use checked property instead */ diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index c927fdd2e6..4321423041 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -231,6 +231,9 @@ const styles: { [key: string]: React.CSSProperties } = { floatingLabelFocusStyle: { color: blue500, }, + inputStyle: { + width: '100%', + } }; const style = { @@ -3618,6 +3621,12 @@ const CheckboxExampleSimple = () => ( labelPosition="left" style={styles.checkbox} /> + ); diff --git a/types/mimos/index.d.ts b/types/mimos/index.d.ts index 9d000b0ce9..06587e42db 100644 --- a/types/mimos/index.d.ts +++ b/types/mimos/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import {DataStructure as MimeDbDataStructure} from 'mime-db'; +import { DataStructure as MimeDbDataStructure } from 'mime-db'; /** * diff --git a/types/mithril/test/test-class-component.ts b/types/mithril/test/test-class-component.ts index 19f3aa343a..11e9fa3279 100644 --- a/types/mithril/test/test-class-component.ts +++ b/types/mithril/test/test-class-component.ts @@ -1,5 +1,5 @@ import * as m from 'mithril'; -import {ClassComponent, Vnode, CVnode, CVnodeDOM} from 'mithril'; +import { ClassComponent, Vnode, CVnode, CVnodeDOM } from 'mithril'; /////////////////////////////////////////////////////////// // 0. diff --git a/types/mithril/test/test-component.ts b/types/mithril/test/test-component.ts index 67e271329e..d1fec567d2 100644 --- a/types/mithril/test/test-component.ts +++ b/types/mithril/test/test-component.ts @@ -1,6 +1,6 @@ import * as m from 'mithril'; -import {Comp, Component} from 'mithril'; +import { Comp, Component } from 'mithril'; /////////////////////////////////////////////////////////// // 0. diff --git a/types/mithril/test/test-factory-component.ts b/types/mithril/test/test-factory-component.ts index 82ba4fd3c9..38faec9e4a 100644 --- a/types/mithril/test/test-factory-component.ts +++ b/types/mithril/test/test-factory-component.ts @@ -1,5 +1,5 @@ import * as m from 'mithril'; -import {Component, FactoryComponent, Vnode} from 'mithril'; +import { Component, FactoryComponent, Vnode } from 'mithril'; /////////////////////////////////////////////////////////// // 0. diff --git a/types/mithril/test/test-fragment.ts b/types/mithril/test/test-fragment.ts index f67d39b7ad..097831d3ed 100644 --- a/types/mithril/test/test-fragment.ts +++ b/types/mithril/test/test-fragment.ts @@ -1,5 +1,5 @@ import * as m from 'mithril'; -import {Vnode} from 'mithril/'; +import { Vnode } from 'mithril/'; import * as h from 'mithril/hyperscript'; const vnode = m.fragment({id: 'abc'}, ['test']); diff --git a/types/mithril/test/test-jsonp.ts b/types/mithril/test/test-jsonp.ts index 7abad457e4..4c51807363 100644 --- a/types/mithril/test/test-jsonp.ts +++ b/types/mithril/test/test-jsonp.ts @@ -1,4 +1,4 @@ -import {jsonp} from 'mithril/request'; +import { jsonp } from 'mithril/request'; interface Result { id: number; diff --git a/types/mithril/test/test-misc.ts b/types/mithril/test/test-misc.ts index 93ac049ef3..fbb7e83d36 100644 --- a/types/mithril/test/test-misc.ts +++ b/types/mithril/test/test-misc.ts @@ -1,7 +1,7 @@ -import {trust, parseQueryString, buildQueryString} from 'mithril'; +import { trust, parseQueryString, buildQueryString } from 'mithril'; import * as h from 'mithril/hyperscript'; -import {render} from 'mithril/render'; -import {redraw} from 'mithril/redraw'; +import { render } from 'mithril/render'; +import { redraw } from 'mithril/redraw'; import * as withAttr from 'mithril/withAttr'; const vnode = trust('Some bold text.'); diff --git a/types/mithril/test/test-request.ts b/types/mithril/test/test-request.ts index 99d1bc1ef3..5bc0e3b242 100644 --- a/types/mithril/test/test-request.ts +++ b/types/mithril/test/test-request.ts @@ -1,4 +1,4 @@ -import {request} from 'mithril/request'; +import { request } from 'mithril/request'; interface Result { id: number; diff --git a/types/mithril/test/test-route.ts b/types/mithril/test/test-route.ts index e3ca4e4aa6..d8acdd092c 100644 --- a/types/mithril/test/test-route.ts +++ b/types/mithril/test/test-route.ts @@ -1,4 +1,4 @@ -import {Component, Comp, RouteResolver} from 'mithril'; +import { Component, Comp, RouteResolver } from 'mithril'; import * as h from 'mithril/hyperscript'; import * as route from 'mithril/route'; diff --git a/types/mithril/test/test-stream.ts b/types/mithril/test/test-stream.ts index 288a59fdd3..7fcb6a0372 100644 --- a/types/mithril/test/test-stream.ts +++ b/types/mithril/test/test-stream.ts @@ -1,5 +1,5 @@ import * as stream from 'mithril/stream'; -import {Stream} from 'mithril/stream'; +import { Stream } from 'mithril/stream'; { const s = stream(1); diff --git a/types/mongoose/README.md b/types/mongoose/README.md index 822e66d1f6..ad12702574 100644 --- a/types/mongoose/README.md +++ b/types/mongoose/README.md @@ -21,7 +21,7 @@ var MySchema: mongoose.Schema = new mongoose.Schema(...); Alternatively, you can import individual names and call them: ```typescript -import {model, Schema} from 'mongoose'; +import { model, Schema } from 'mongoose'; var MyModel = model(...); var MySchema: Schema = new Schema(...): ``` diff --git a/types/moxios/index.d.ts b/types/moxios/index.d.ts index 94756158c9..2ff3694ba4 100644 --- a/types/moxios/index.d.ts +++ b/types/moxios/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Asuka Ito // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {AxiosInstance} from "axios"; +import { AxiosInstance } from "axios"; interface Item { response?: any; diff --git a/types/moxios/moxios-tests.ts b/types/moxios/moxios-tests.ts index 0e6820d287..4dde304435 100644 --- a/types/moxios/moxios-tests.ts +++ b/types/moxios/moxios-tests.ts @@ -1,5 +1,5 @@ // from https://github.com/mzabriskie/moxios/blob/master/test.js -import {equal, notEqual, deepEqual} from 'power-assert'; // compatible with 'assert'; +import { equal, notEqual, deepEqual } from 'power-assert'; // compatible with 'assert'; import axios from 'axios'; import * as moxios from 'moxios'; diff --git a/types/multer-gridfs-storage/index.d.ts b/types/multer-gridfs-storage/index.d.ts index 752609b4e3..93cf650bb8 100644 --- a/types/multer-gridfs-storage/index.d.ts +++ b/types/multer-gridfs-storage/index.d.ts @@ -3,10 +3,10 @@ // Definitions by: devconcept // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {EventEmitter} from 'events'; -import {Express} from 'express'; +import { EventEmitter } from 'events'; +import { Express } from 'express'; import * as Multer from 'multer'; -import {Grid} from 'gridfs-stream'; +import { Grid } from 'gridfs-stream'; type logConfig = 'file' | 'all'; diff --git a/types/multer-gridfs-storage/multer-gridfs-storage-tests.ts b/types/multer-gridfs-storage/multer-gridfs-storage-tests.ts index 229fd7877d..b341fe0cea 100644 --- a/types/multer-gridfs-storage/multer-gridfs-storage-tests.ts +++ b/types/multer-gridfs-storage/multer-gridfs-storage-tests.ts @@ -1,5 +1,5 @@ import * as MulterGridfsStorage from 'multer-gridfs-storage'; -import {Grid} from "gridfs-stream"; +import { Grid } from "gridfs-stream"; // Exported interfaces let opt1: MulterGridfsStorage.GfsStorageOptions; diff --git a/types/musicmetadata/index.d.ts b/types/musicmetadata/index.d.ts index 4f80854138..30577e7455 100644 --- a/types/musicmetadata/index.d.ts +++ b/types/musicmetadata/index.d.ts @@ -6,7 +6,7 @@ /// declare module "musicmetadata" { - import {Readable} from "stream"; + import { Readable } from "stream"; import {EventEmitter} from "events"; function mm(readStream: Readable, callback: (err: Error, metadata: MM.Metadata) => void): EventEmitter; diff --git a/types/ndarray/index.d.ts b/types/ndarray/index.d.ts index f409e7fe74..718c7075c3 100644 --- a/types/ndarray/index.d.ts +++ b/types/ndarray/index.d.ts @@ -1,34 +1,38 @@ // Type definitions for ndarray 1.0 // Project: https://github.com/scijs/ndarray -// Definitions by: Giff Song +// Definitions by: Giff Song , taoqf // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -declare function ndarray( - data: ndarray.Data, shape?: number[], stride?: number[], offset?: number -): ndarray; +declare function ndarray( + data: ndarray.Data, shape?: number[], stride?: number[], offset?: number +): ndarray; -interface ndarray { - data: ndarray.Data; +interface ndarray { + data: ndarray.Data; shape: number[]; stride: number[]; offset: number; - dtype: 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' | 'uint32' | - 'float32' | 'float64' | 'array' | 'uint8_clamped' | 'buffer' | 'generic'; + dtype: ndarray.DataType; size: number; order: number[]; dimension: number; - get(...args: number[]): number; - set(...args: number[]): number; - index(...args: number[]): number; - lo(...args: number[]): ndarray; - hi(...args: number[]): ndarray; - step(...args: number[]): ndarray; - transpose(...args: number[]): ndarray; - pick(...args: number[]): ndarray; + get(...args: number[]): T; + set(...args: number[]): T; + index(...args: number[]): T; + lo(...args: number[]): ndarray; + hi(...args: number[]): ndarray; + step(...args: number[]): ndarray; + transpose(...args: number[]): ndarray; + pick(...args: number[]): ndarray; + reshape(...shapes: number[]): ndarray; + T: ndarray; } declare namespace ndarray { - type Data = number[] | Int8Array | Int16Array | Int32Array | + type DataType = 'int8' | 'int16' | 'int32' | 'uint8' | 'uint16' | 'uint32' | + 'float32' | 'float64' | 'array' | 'uint8_clamped' | 'buffer' | 'generic'; + type Data = T[] | Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Float32Array | Float64Array | Uint8ClampedArray; } diff --git a/types/node-mysql-wrapper/index.d.ts b/types/node-mysql-wrapper/index.d.ts index c887da3368..4960794a90 100644 --- a/types/node-mysql-wrapper/index.d.ts +++ b/types/node-mysql-wrapper/index.d.ts @@ -8,7 +8,7 @@ import * as Mysql from 'mysql'; import * as Promise from 'bluebird'; -import {EventEmitter} from 'events'; +import { EventEmitter } from 'events'; declare var EQUAL_TO_PROPERTY_SYMBOL: string; declare var TABLE_RULES_PROPERTY: string; diff --git a/types/node-static/node-static-tests.ts b/types/node-static/node-static-tests.ts index 471a8fde50..c118103f1e 100644 --- a/types/node-static/node-static-tests.ts +++ b/types/node-static/node-static-tests.ts @@ -1,4 +1,4 @@ -import {Server, version, mime} from 'node-static'; +import { Server, version, mime } from 'node-static'; let server = new Server(__dirname); let pathname = server.resolve('./tsconfig.json'); diff --git a/types/node-xmpp-client/node-xmpp-client-tests.ts b/types/node-xmpp-client/node-xmpp-client-tests.ts index 4b5bd72a28..e0cd32a417 100644 --- a/types/node-xmpp-client/node-xmpp-client-tests.ts +++ b/types/node-xmpp-client/node-xmpp-client-tests.ts @@ -1,4 +1,4 @@ -import {Client} from 'node-xmpp-client'; +import { Client } from 'node-xmpp-client'; const client = new Client({ jid: 'user@example.com', diff --git a/types/node-xmpp-core/index.d.ts b/types/node-xmpp-core/index.d.ts index 8c552c08f2..20937aae98 100644 --- a/types/node-xmpp-core/index.d.ts +++ b/types/node-xmpp-core/index.d.ts @@ -4,8 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 /// -import {Element} from 'ltx'; -import {EventEmitter} from 'events'; +import { Element } from 'ltx'; +import { EventEmitter } from 'events'; // fixme: not ideal export {createElement, Element, escapeXML, escapeXMLText} from 'ltx'; diff --git a/types/node-xmpp-core/node-xmpp-core-tests.ts b/types/node-xmpp-core/node-xmpp-core-tests.ts index 0b0e7016ff..6a6fac9644 100644 --- a/types/node-xmpp-core/node-xmpp-core-tests.ts +++ b/types/node-xmpp-core/node-xmpp-core-tests.ts @@ -1,4 +1,4 @@ -import {Connection} from 'node-xmpp-core'; +import { Connection } from 'node-xmpp-core'; const con = new Connection(); con.on('online', () => { diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 017124eb7e..a0122dca8c 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -811,6 +811,7 @@ declare module "http" { maxHeadersCount: number; timeout: number; listening: boolean; + keepAliveTimeout: number; } /** * @deprecated Use IncomingMessage diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 4c2f5de484..9f9954cc40 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -29,7 +29,7 @@ import * as dns from "dns"; import * as async_hooks from "async_hooks"; // Specifically test buffer module regression. -import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; +import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buffer"; ////////////////////////////////////////////////////////// /// Global Tests : https://nodejs.org/api/global.html /// @@ -1065,6 +1065,12 @@ namespace http_tests { // http Server { var server: http.Server = new http.Server(); + + // test public props + const maxHeadersCount: number = server.maxHeadersCount; + const timeout: number = server.timeout; + const listening: boolean = server.listening; + const keepAliveTimeout: number = server.keepAliveTimeout; } // http IncomingMessage diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 16a035f08e..94e32eee63 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -22,7 +22,7 @@ import * as string_decoder from "string_decoder"; import * as dns from "dns"; // Specifically test buffer module regression. -import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; +import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buffer"; ////////////////////////////////////////////////////////// /// Global Tests : https://nodejs.org/api/global.html /// diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 492b9e36df..982ce3bf41 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -27,7 +27,7 @@ import * as repl from "repl"; import * as dns from "dns"; // Specifically test buffer module regression. -import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; +import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buffer"; ////////////////////////////////////////////////////////// /// Global Tests : https://nodejs.org/api/global.html /// diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index b89adb57ae..552c7b4b06 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -28,7 +28,7 @@ import * as v8 from "v8"; import * as dns from "dns"; // Specifically test buffer module regression. -import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; +import { Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer } from "buffer"; ////////////////////////////////////////////////////////// /// Global Tests : https://nodejs.org/api/global.html /// diff --git a/types/nodegit/blame-options.d.ts b/types/nodegit/blame-options.d.ts index fdebbeff67..3505e7cf0a 100644 --- a/types/nodegit/blame-options.d.ts +++ b/types/nodegit/blame-options.d.ts @@ -1,4 +1,4 @@ -import {Oid} from './oid'; +import { Oid } from './oid'; export class BlameOptions { /** diff --git a/types/nodegit/blame.d.ts b/types/nodegit/blame.d.ts index 684db81b6c..79fc6a85b4 100644 --- a/types/nodegit/blame.d.ts +++ b/types/nodegit/blame.d.ts @@ -1,6 +1,6 @@ import { Repository } from './repository'; import { BlameOptions } from './blame-options'; -import {BlameHunk} from './blame-hunk'; +import { BlameHunk } from './blame-hunk'; export namespace Blame { const enum FLAG { diff --git a/types/nodegit/fetch-options.d.ts b/types/nodegit/fetch-options.d.ts index 3b3a1b26c1..d391b8dab1 100644 --- a/types/nodegit/fetch-options.d.ts +++ b/types/nodegit/fetch-options.d.ts @@ -1,5 +1,5 @@ import { RemoteCallbacks } from './remote-callbacks'; -import { Strarray} from './str-array'; +import { Strarray } from './str-array'; export interface FetchOptions { /** diff --git a/types/nodegit/note.d.ts b/types/nodegit/note.d.ts index e1412afe3c..c5d06f63a7 100644 --- a/types/nodegit/note.d.ts +++ b/types/nodegit/note.d.ts @@ -1,6 +1,6 @@ -import {Repository} from './repository'; -import {Signature} from './signature'; -import {Oid} from './oid'; +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; export class Note { /** diff --git a/types/numjs/index.d.ts b/types/numjs/index.d.ts new file mode 100644 index 0000000000..af464b7410 --- /dev/null +++ b/types/numjs/index.d.ts @@ -0,0 +1,555 @@ +// Type definitions for numjs 0.14 +// Project: https://github.com/nicolaspanel/numjs#readme +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export as namespace nj; +import * as BaseNdArray from 'ndarray'; + +export type NdType = BaseNdArray.DataType | BaseNdArray.Data; + +export interface NdArray extends BaseNdArray { + ndim: number; + T: NdArray; + slice(...args: number[]): NdArray; + + /** + * Return a copy of the array collapsed into one dimension using row-major order (C-style) + * + */ + flatten

(): NdArray

; + + /** + * Permute the dimensions of the array. + * + */ + transpose(args?: number[]): NdArray; + transpose(...args: number[]): NdArray; + + /** + * Dot product of two arrays. + * + */ + dot(x: NjArray): NdArray; + + /** + * Assign `x` to the array, element-wise. + * + * @param {boolean} [copy=true] + */ + assign(x: NjParam, copy?: boolean): NdArray; + + /** + * Add `x` to the array, element-wise. + * + * @param {boolean} [copy=true] + */ + add(x: NjParam, copy?: boolean): NdArray; + + /** + * Subtract `x` to the array, element-wise. + * + * @param {boolean} [copy=true] + */ + subtract(x: NjParam, copy?: boolean): NdArray; + + /** + * Multiply array by `x`, element-wise. + * + * @param {boolean} [copy=true] + */ + multiply(x: NjParam, copy?: boolean): NdArray; + + /** + * Divide array by `x`, element-wise. + * + * @param {boolean} [copy=true] + */ + divide(x: NjParam, copy?: boolean): NdArray; + + /** + * Raise array elements to powers from given array, element-wise. + * + * @param {boolean} [copy=true] - set to false to modify the array rather than create a new one + */ + pow(x: NjParam, copy?: boolean): NdArray; + + /** + * Calculate the exponential of all elements in the array, element-wise. + * + * @param {boolean} [copy=true] - set to false to modify the array rather than create a new one + */ + exp(copy?: boolean): NdArray; + + /** + * Calculate the positive square-root of all elements in the array, element-wise. + * + * @param {boolean} [copy=true] - set to false to modify the array rather than create a new one + */ + sqrt(copy?: boolean): NdArray; + + /** + * Return the maximum value of the array + * + */ + max(): T; + + /** + * Return the minimum value of the array + * + */ + min(): T; + + /** + * Sum of array elements. + * + */ + sum(): T; + + /** + * Returns the standard deviation, a measure of the spread of a distribution, of the array elements. + * + */ + std(): number; + + /** + * Return the arithmetic mean of array elements. + * + */ + mean(): T; + + /** + * Converts {NdArray} to a native JavaScript {Array} + * + */ + tolist(): T[]; + + valueOf(): T[]; + + /** + * Stringify the array to make it readable in the console, by a human. + * + */ + inspect(): string; + + /** + * Stringify object to JSON + */ + toJSON(): any; + + /** + * Create a full copy of the array + * + */ + clone(): NdArray; + + /** + * Return true if two arrays have the same shape and elements, false otherwise. + */ + equal(array: NjArray): boolean; + + /** + * Round array to the to the nearest integer. + * + * @param {boolean} [copy=true] + */ + round(copy?: boolean): NdArray; + + /** + * Return the inverse of the array, element-wise. + * + */ + negative(): NdArray; + + diag(): NdArray; + + iteraxis(axis: number, cb: (x: NdArray, i: number) => any): void; + + /** + * Returns the discrete, linear convolution of the array using the given filter. + * + * @note: Arrays must have the same dimensions and `filter` must be smaller than the array. + * @note: The convolution product is only given for points where the signals overlap completely. Values outside the signal boundary have no effect. This behaviour is known as the 'valid' mode. + * @note: Use optimized code for 3x3, 3x3x1, 5x5, 5x5x1 filters, FFT otherwise. + * + */ + convolve(filter: NjArray): NdArray; + + fftconvolve(filter: NjArray): NdArray; +} + +export type NdArrayData = BaseNdArray.Data; +export type NjArray = NdArrayData | NdArray; +export type NjParam = NjArray | number; + +/** + * Return absolute value of the input array, element-wise. + * + */ +export function abs(x: NjParam): NdArray; + +/** + * Add arguments, element-wise. + * + */ +export function add(a: NjParam, b: NjParam): NdArray; + +/** + * Return evenly spaced values within a given interval. + * + * @param {number} [start = 0] Start of interval. The interval includes this value. + * @param {number} stop End of interval. The interval does not include this value. + * @param {number} [step = 1] Spacing between values. The default step size is 1. If step is specified, start must also be given. + * @param {(NdArray.ndType)} [dtype = Array] The type of the output array. + * @returns {NdArray} Array of evenly spaced values. + */ +export function arange(start: number, stop?: number, dtype?: NdType): NdArray; +export function arange(stop: number, dtype: NdType): NdArray; +export function arange(start: number, stop: number, step: number, dtype?: NdType): NdArray; + +/** + * Return trigonometric inverse cosine of the input array, element-wise. + * + */ +export function arccos(x: NjParam): NdArray; + +/** + * Return trigonometric inverse sine of the input array, element-wise. + * + */ +export function arcsin(x: NjParam): NdArray; + +/** + * Return trigonometric inverse tangent of the input array, element-wise. + * + */ +export function arctan(x: NjParam): NdArray; + +/** + * Clip (limit) the values in an array between min and max, element-wise. + * + * @param {number} [min = 0] + * @param {number} [max = 1] + */ +export function clip(x: NjParam, min?: number, max?: number): NdArray; +/** + * Join given arrays along the last axis. + * + */ +export function concatenate(...arrays: Array>): NdArray; + +/** + * Convolve 2 N-dimensionnal arrays + * + */ +export function convolve(a: NjArray, b: NjArray): NdArray; + +/** + * Return trigonometric cosine of the input array, element-wise. + * + */ +export function cos(x: NjParam): NdArray; + +/** + * Divide `a` by `b`, element-wise. + * + */ +export function divide(a: NjArray, b: NjParam): NdArray; + +/** + * Dot product of two arrays. WARNING: supported products are: - matrix dot matrix - vector dot vector - matrix dot vector - vector dot matrix + * + */ +export function dot(a: NjArray, b: NjArray): NdArray; + +/** + * Return a new array of given shape and type, filled with `undefined` values. + * + * @param {(ndArray | number)} shape Shape of the new array, e.g., [2, 3] or 2. + * @param {NdArray.ndType} [dtype] The type of the output array. + * @returns {NdArray} Array of `undefined` values with the given shape and dtype + */ +export function empty(shape: NdArrayData | number, dtype?: NdType): NdArray; + +/** + * Return true if two arrays have the same shape and elements, false otherwise. + * + */ +export function equal(a: NjArray, b: NjArray): boolean; + +/** + * Calculate the exponential of all elements in the input array, element-wise. + * + */ +export function exp(x: NjParam): NdArray; + +/** + * Convolve 2 N-dimensionnal arrays using Fast Fourier Transform (FFT) + * + */ +export function fftconvolve(a: NjArray, b: NjArray): NdArray; + +/** + * Return a copy of the array collapsed into one dimension using row-major order (C-style) + * + */ +export function flatten(array: NjArray): NdArray; + +export function getRawData(array: NdArrayData): Uint8Array; +export function setRawData(array: NdArrayData, data: NdArrayData): Uint8Array; + +/** + * Return the maximum value of the array + * + */ +export function max(x: NjParam): T; + +/** + * Return the arithmetic mean of input array elements. + * + */ +export function mean(x: NjParam): T; + +/** + * Return the minimum value of the array + * + */ +export function min(x: NjParam): T; + +/** + * Multiply arguments, element-wise. + * + */ +export function multiply(a: NjArray, b: NjParam): NdArray; + +/** + * Return the inverse of the input array, element-wise. + * + */ +export function negative(x: NjParam): NdArray; + +/** + * Return a new array of given shape and type, filled with ones. + * + * @param {(ndArray | number)} shape Shape of the new array, e.g., [2, 3] or 2. + * @param {NdArray.dtType} [dtype] The type of the output array. + * @returns {NdArray} Array of ones with the given shape and dtype + */ +export function ones(shape: NdArrayData | number, dtype?: BaseNdArray.DataType): NdArray; + +/** + * Raise first array elements to powers from second array, element-wise. + * + */ +export function power(x1: NjParam, x2: NjParam): NdArray; + +/** + * Create an array of the given shape and propagate it with random samples from a uniform distribution over [0, 1]. + * + * @param {(ndArray | number)} [shape] he dimensions of the returned array, should all be positive integers + */ +export function random(shape?: NdArrayData | number): NdArray; + +/** + * Gives a new shape to an array without changing its data. + * + * @param {ndArray} shape The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length + */ +export function reshape(array: NjArray, shape: NdArray): NdArray; + +/** + * Round an array to the to the nearest integer. + * + */ +export function round(x: NjArray): NdArray; + +/** + * Return the sigmoid of the input array, element-wise. + * + * @param {number} [t = 1] stifness parameter + */ +export function sigmoid(x: NjParam, t?: number): NdArray; + +/** + * Return trigonometric sine of the input array, element-wise. + * + */ +export function sin(x: NjParam): NdArray; + +/** + * Return the softmax, or normalized exponential, of the input array, element-wise. + * + */ +export function softmax(x: NjParam): NdArray; + +/** + * Calculate the positive square-root of all elements in the input array, element-wise. + * + */ +export function sqrt(x: NjParam): NdArray; + +/** + * Returns the standard deviation, a measure of the spread of a distribution, of the input array elements. + * + */ +export function std(x: NjParam): T; + +/** + * Subtract second argument from the first, element-wise. + * + */ +export function subtract(a: NjParam, b: NjParam): T; + +/** + * Return the sum of input array elements. + * + */ +export function sum(x: NjParam): T; + +/** + * Return trigonometric tangent of the input array, element-wise. + * + */ +export function tan(x: NjParam): NdArray; + +/** + * Return hyperbolic tangent of the input array, element-wise. + * + */ +export function tanh(x: NjParam): NdArray; + +/** + * Permute the dimensions of the input array according to the given axes. + * + * @example + * + * arr = nj.arange(6).reshape(1,2,3) + * // array([[[ 0, 1, 2], + * // [ 3, 4, 5]]]) + * arr.T + * // array([[[ 0], + * // [ 3]], + * // [[ 1], + * // [ 4]], + * // [[ 2], + * // [ 5]]]) + * arr.transpose(1,0,2) + * // array([[[ 0, 1, 2]], + * // [[ 3, 4, 5]]]) + */ +export function transpose(x: NjParam, axes?: number): NdArray; + +/** + * Return a new array of given shape and type, filled with zeros. + * + * @param {ndArray} shape Shape of the new array, e.g., [2, 3] or 2. + * @param {NdArray.dtType} [dtype = Array] The type of the output array. + * @returns {numjs} Array of zeros with the given shape and dtype + */ +export function zeros(shape: NdArrayData | number, dtype?: BaseNdArray.DataType): NdArray; + +export namespace errors { + function ValueError(message?: string): Error; + function ConfigError(message?: string): Error; + function NotImplementedError(message?: string): Error; +} + +export function broadcast(shape1: T[], shape2: U[]): Array; + +export function fft(x: NjArray): NdArray; + +export function ifft(x: NjArray): NdArray; + +/** + * Extract a diagonal or construct a diagonal array. + * + * @returns {NdArray} a view a of the original array when possible, a new array otherwise + */ +export function diag(x: NjArray): NdArray; + +/** + * The identity array is a square array with ones on the main diagonal. + * @param {number} Number of rows (and columns) in n x n output. + * @param {(String|Object)} [dtype=Array] The type of the output array. + * @return {Array} n x n array with its main diagonal set to one, and all other elements 0 + */ +export function identity(n: T, dtype?: BaseNdArray.DataType): NdArray; + +/** + * Join a sequence of arrays along a new axis. + * The axis parameter specifies the index of the new axis in the dimensions of the result. + * For example, if axis=0 it will be the first dimension and if axis=-1 it will be the last dimension. + * @param {Array} sequence of array_like + * @param {number} [axis=0] The axis in the result array along which the input arrays are stacked. + * @return {Array} The stacked array has one more dimension than the input arrays. + */ +export function stack(arrays: Array>, axis?: number): NdArray; + +export namespace images { + namespace data { + /** + * @property {NdArray} digit - 28x28 grayscale image with an handwritten digit extracted from MNIST database + */ + const digit: NdArray; + /** + * @property {NdArray} five - 28x28 grayscale image with an handwritten digit extracted from MNIST database + */ + const five: NdArray; + /** + * @property {NdArray} node - 300x600 COLOR image representing Node.js's logo + */ + const node: NdArray; + /** + * @property {NdArray} lena - The standard, yet sometimes controversial + * Lena test image was scanned from the November 1972 edition of + * Playboy magazine. From an image processing perspective, this image + * is useful because it contains smooth, textured, shaded as well as + * detail areas. + */ + const lena: NdArray; + /** + * @property {NdArray} lenna - The standard, yet sometimes + * controversial Lena test image was scanned from the November 1972 + * edition of Playboy magazine. From an image processing perspective, + * this image is useful because it contains smooth, textured, shaded as + * well as detail areas. + */ + const lenna: NdArray; + /** + * @property {NdArray} moon - This low-contrast image of the surface of + * the moon is useful for illustrating histogram equalization and + * contrast stretching. + */ + const moon: NdArray; + } + function read(input: string): NdArray; + function save(img: NdArray, dest: string): void; + function resize(img: NdArray, height: number, width: number): NdArray; + function sat(img: NdArray): NdArray; + function ssat(img: NdArray): NdArray; + function sobel(img: NdArray): NdArray; + function scharr(img: NdArray): NdArray; + function areaSum(h0: number, w0: number, H: number, W: number, SAT: NdArray): number; + function areaValue(img: NdArray): number; + function rgb2gray(img: NdArray): NdArray; + function flip(img: NdArray): NdArray; +} + +export function array(arr: NjArray, dtype?: BaseNdArray.DataType): NdArray; + +export function int8(arr: NjArray): NjArray; + +export function uint8(arr: NjArray): NjArray; + +export function int16(arr: NjArray): NjArray; + +export function uint16(arr: NjArray): NjArray; + +export function int32(arr: NjArray): NjArray; + +export function uint32(arr: NjArray): NjArray; + +export function float32(arr: NjArray): NjArray; + +export function float64(arr: NjArray): NjArray; diff --git a/types/numjs/numjs-tests.ts b/types/numjs/numjs-tests.ts new file mode 100644 index 0000000000..b13cf60fb0 --- /dev/null +++ b/types/numjs/numjs-tests.ts @@ -0,0 +1,23 @@ +import { abs } from 'numjs'; +import * as nj from 'numjs'; + +const a = abs(2); + +const arr = nj.arange(6); +arr.reshape(1, 2, 3); +// array([[[ 0, 1, 2], +// [ 3, 4, 5]]]) +arr.T; +// array([[[ 0], +// [ 3]], +// [[ 1], +// [ 4]], +// [[ 2], +// [ 5]]]) +arr.transpose(1, 0, 2); +// array([[[ 0, 1, 2]], +// [[ 3, 4, 5]]]) + +const b = nj.array([2, 3, 4]); + +const c = nj.uint8([1, 2, 3]); diff --git a/types/numjs/tsconfig.json b/types/numjs/tsconfig.json new file mode 100644 index 0000000000..1c1fa8fbd3 --- /dev/null +++ b/types/numjs/tsconfig.json @@ -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", + "numjs-tests.ts" + ] +} diff --git a/types/numjs/tslint.json b/types/numjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/numjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/observe-js/observe-js-tests.ts b/types/observe-js/observe-js-tests.ts index 23dc1159f3..130bc7cd77 100644 --- a/types/observe-js/observe-js-tests.ts +++ b/types/observe-js/observe-js-tests.ts @@ -1,4 +1,4 @@ -import {PathObserver, ArrayObserver, ObjectObserver, CompoundObserver, ObserverTransform} from 'observe-js'; +import { PathObserver, ArrayObserver, ObjectObserver, CompoundObserver, ObserverTransform } from 'observe-js'; namespace observejs { diff --git a/types/osmtogeojson/osmtogeojson-tests.ts b/types/osmtogeojson/osmtogeojson-tests.ts index 429dda705f..8356ec5a1b 100644 --- a/types/osmtogeojson/osmtogeojson-tests.ts +++ b/types/osmtogeojson/osmtogeojson-tests.ts @@ -1,5 +1,5 @@ import osmtogeojson from 'osmtogeojson'; -import {OsmJSON, GeoJSON} from 'osmtogeojson'; +import { OsmJSON, GeoJSON } from 'osmtogeojson'; import * as xmldom from 'xmldom'; let xml: Document = (new xmldom.DOMParser()).parseFromString("", 'text/xml'); diff --git a/types/passport-client-cert/index.d.ts b/types/passport-client-cert/index.d.ts index 5bb80c5027..3bd79d312a 100644 --- a/types/passport-client-cert/index.d.ts +++ b/types/passport-client-cert/index.d.ts @@ -4,8 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import {Strategy as PassportStrategy} from 'passport-strategy'; -import {Request} from 'express'; +import { Strategy as PassportStrategy } from 'passport-strategy'; +import { Request } from 'express'; export class Strategy extends PassportStrategy { constructor(verify: PkiCallback); diff --git a/types/passport-client-cert/passport-client-cert-tests.ts b/types/passport-client-cert/passport-client-cert-tests.ts index 256d2ddcd6..de1498525f 100644 --- a/types/passport-client-cert/passport-client-cert-tests.ts +++ b/types/passport-client-cert/passport-client-cert-tests.ts @@ -1,5 +1,5 @@ import * as passport from "passport"; -import {ClientCert, PkiVerifiedCallback, Strategy as ClientCertStrategy} from "passport-client-cert"; +import { ClientCert, PkiVerifiedCallback, Strategy as ClientCertStrategy } from "passport-client-cert"; passport.use(new ClientCertStrategy( (clientCert: ClientCert, done: PkiVerifiedCallback) => { let cn = clientCert.subject.cn; diff --git a/types/passport-google-oauth2/index.d.ts b/types/passport-google-oauth2/index.d.ts index 5c131622e7..a2ba210c4b 100644 --- a/types/passport-google-oauth2/index.d.ts +++ b/types/passport-google-oauth2/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import {Request} from 'express'; +import { Request } from 'express'; export interface StrategyOptions { clientID: string; diff --git a/types/passport-jwt/index.d.ts b/types/passport-jwt/index.d.ts index 066921efe6..207f0ad945 100644 --- a/types/passport-jwt/index.d.ts +++ b/types/passport-jwt/index.d.ts @@ -4,7 +4,7 @@ // Alex Young // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {Strategy as PassportStrategy} from 'passport-strategy'; +import { Strategy as PassportStrategy } from 'passport-strategy'; import {Request} from 'express'; export declare class Strategy extends PassportStrategy { diff --git a/types/passport-jwt/passport-jwt-tests.ts b/types/passport-jwt/passport-jwt-tests.ts index 1dd2baeb1e..024a06cfef 100644 --- a/types/passport-jwt/passport-jwt-tests.ts +++ b/types/passport-jwt/passport-jwt-tests.ts @@ -2,7 +2,7 @@ /// 'use strict'; -import {Strategy as JwtStrategy, ExtractJwt, StrategyOptions} from 'passport-jwt'; +import { Strategy as JwtStrategy, ExtractJwt, StrategyOptions } from 'passport-jwt'; import {Request} from 'express'; import * as passport from 'passport'; diff --git a/types/password-hash/password-hash-tests.ts b/types/password-hash/password-hash-tests.ts index 92f7a93f17..a8da4b01b8 100644 --- a/types/password-hash/password-hash-tests.ts +++ b/types/password-hash/password-hash-tests.ts @@ -1,7 +1,7 @@ 'use strict'; -import {generate, verify, isHashed} from 'password-hash'; +import { generate, verify, isHashed } from 'password-hash'; let password = 'raw-password'; let hashed: string; diff --git a/types/pg-pool/index.d.ts b/types/pg-pool/index.d.ts index 7887ddc82f..0a27987bb5 100644 --- a/types/pg-pool/index.d.ts +++ b/types/pg-pool/index.d.ts @@ -4,4 +4,4 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -export {Pool, PoolConfig} from "pg"; +export {Pool, PoolConfig } from "pg"; diff --git a/types/pg-pool/pg-pool-tests.ts b/types/pg-pool/pg-pool-tests.ts index 13c2a7c4ec..a2995fd747 100644 --- a/types/pg-pool/pg-pool-tests.ts +++ b/types/pg-pool/pg-pool-tests.ts @@ -1,4 +1,4 @@ -import {Pool} from "pg-pool"; +import { Pool } from "pg-pool"; let pool = new Pool() diff --git a/types/pinyin/index.d.ts b/types/pinyin/index.d.ts new file mode 100644 index 0000000000..059adead21 --- /dev/null +++ b/types/pinyin/index.d.ts @@ -0,0 +1,79 @@ +// Type definitions for pinyin 2.8 +// Project: https://github.com/hotoo/pinyin +// Definitions by: AnJun Wang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = pinyin; +export as namespace pinyin; + +/** + * 转换中文字符为拼音。可以设定拼音风格,可以打开多音字选项,也可以打开分词。 + * @example + * pinyin("中心") // returns [ [ 'zhōng' ], [ 'xīn' ] ] + */ +declare function pinyin(words: string, options?: pinyin.Options): string[][]; + +declare namespace pinyin { + /** + * 按拼音比较两个字符串 a 和 b 的顺序。 + * 如果返回 -1 表示 a 在 b 前 + * 如果返回 0 表示 a 和 b 顺序相同 + * 如果返回 1 表示 a 在 b 后 + */ + function compare(a: string, b: string): -1 | 0 | 1; + /** + * 普通风格,即不带声调。 + * 如:pin yin + */ + const STYLE_NORMAL: number; + /** + * 声调风格,拼音声调在韵母第一个字母上。 + * 如:pīn yīn + */ + const STYLE_TONE: number; + /** + * 声调风格 2,即拼音声调以数字形式在各个拼音之后,用数字 [0-4] 进行表示。 + * 如:pin1 yin1 + */ + const STYLE_TONE2: number; + /** + * 声调风格 3,即拼音声调以数字形式在注音字符之后,用数字 [0-4] 进行表示。 + * 如:pi1n yi1n + */ + const STYLE_TO3NE: number; + /** + * 声母风格,只返回各个拼音的声母部分。对于没有声母的汉字,返回空白字符串。 + * 如:中国 的拼音 zh g + * 注:声母风格会区分 zh 和 z,ch 和 c,sh 和 s。 + * 部分汉字没有声母,如 啊,饿 等,另外 y, w, yu 都不是声母, 这些汉字的拼音声母风格会返回 "" + */ + const STYLE_INITIALS: number; + /** + * 首字母风格,只返回拼音的首字母部分。 + * 如:p y + */ + const STYLE_FIRST_LETTER: number; + interface Options { + /** + * 设置拼音风格,默认风格是 {@link STYLE_TONE} + * @see {@link STYLE_NORMAL} + * @see {@link STYLE_TONE} + * @see {@link STYLE_TONE2} + * @see {@link STYLE_TO3NE} + * @see {@link STYLE_INITIALS} + * @see {@link STYLE_FIRST_LETTER} + */ + style?: number; + /** + * 是否启用分词模式,默认关闭。 + * 中文分词有助于极大的降低多音字问题。但性能会极大的下降,内存也会使用更多。 + */ + segment?: boolean; + /** + * 是否启用多音字模式,默认关闭。 + * 关闭多音字模式时,返回每个汉字第一个匹配的拼音。 + * 启用多音字模式时,返回多音字的所有拼音列表。 + */ + heteronym?: boolean; + } +} diff --git a/types/pinyin/pinyin-tests.ts b/types/pinyin/pinyin-tests.ts new file mode 100644 index 0000000000..918ac00a76 --- /dev/null +++ b/types/pinyin/pinyin-tests.ts @@ -0,0 +1,24 @@ +import pinyin = require("pinyin"); + +pinyin("中心"); +pinyin("中心", { + heteronym: true +}); +pinyin("中心", { + heteronym: true, + segment: true +}); +const options: pinyin.Options = { + style: pinyin.STYLE_INITIALS, + heteronym: true +}; +pinyin("中心", options); + +pinyin.compare('测', '这'); + +pinyin.STYLE_NORMAL; +pinyin.STYLE_TONE; +pinyin.STYLE_TONE2; +pinyin.STYLE_TO3NE; +pinyin.STYLE_INITIALS; +pinyin.STYLE_FIRST_LETTER; diff --git a/types/pinyin/tsconfig.json b/types/pinyin/tsconfig.json new file mode 100644 index 0000000000..88101a7841 --- /dev/null +++ b/types/pinyin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pinyin-tests.ts" + ] +} diff --git a/types/pinyin/tslint.json b/types/pinyin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pinyin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/prompt-sync-history/index.d.ts b/types/prompt-sync-history/index.d.ts index 09ac3af5b3..de7bc637b2 100644 --- a/types/prompt-sync-history/index.d.ts +++ b/types/prompt-sync-history/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: TANAKA Koichi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {History} from 'prompt-sync'; +import { History } from 'prompt-sync'; declare namespace history {} declare function history(file?:string, max?:number): History; diff --git a/types/properties-reader/index.d.ts b/types/properties-reader/index.d.ts new file mode 100644 index 0000000000..9a76f16cc9 --- /dev/null +++ b/types/properties-reader/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for properties-reader 0.0 +// Project: https://github.com/steveukx/properties +// Definitions by: Zlatko Andonovski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace PropertiesReader { + type Value = string|number|boolean; + + interface Reader { + get(propertyName: string): Value|null; + getRaw(propertyName: string): string|null; + path(): {}; + append(path: string): Reader; + read(properties: string): Reader; + set(propertyName: string, value: Value): Reader; + length: number; + each(iterator: (key: string, value: Value) => void): Reader; + each(iterator: (this: T, key: string, value: Value) => void, scope: T): Reader; + getAllProperties(): { [key: string]: Value; }; + clone(): Reader; + } +} + +declare function PropertiesReader(path: string): PropertiesReader.Reader; + +export = PropertiesReader; diff --git a/types/properties-reader/properties-reader-tests.ts b/types/properties-reader/properties-reader-tests.ts new file mode 100644 index 0000000000..309ba9cab2 --- /dev/null +++ b/types/properties-reader/properties-reader-tests.ts @@ -0,0 +1,25 @@ +// Trying some things from the official documentation: https://github.com/steveukx/properties/blob/master/README.md + +import PropertiesReader = require('properties-reader'); + +let properties = PropertiesReader('/path/to/properties.file'); +// Fully qualified name +let property = properties.get('some.property.name'); +// Yeah, so we have no way of doing this properly. +property = ( properties.path()).some.property.name; + +properties = properties.append('/another.file').append('/yet/another.file'); +properties = properties.read('some.property = Value \n another.property = Another Value'); +properties = properties.set('property.name', 'Property Value'); + +properties.get('main.some.thing') === 'foo'; +properties.get('blah.some.thing') === 'bar'; + +const propertiesCount: number = properties.length; +const raw: string|null = properties.getRaw('path.to.prop'); + +properties = properties.each((key, value) => {}); +properties = properties.each(function(key, value) { + this.x = 5; +}, { x: 3 }); +const value = properties.getAllProperties()["myKey"]; diff --git a/types/properties-reader/tsconfig.json b/types/properties-reader/tsconfig.json new file mode 100644 index 0000000000..12dabc301b --- /dev/null +++ b/types/properties-reader/tsconfig.json @@ -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", + "properties-reader-tests.ts" + ] +} diff --git a/types/properties-reader/tslint.json b/types/properties-reader/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/properties-reader/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/prosemirror-collab/prosemirror-collab-tests.ts b/types/prosemirror-collab/prosemirror-collab-tests.ts index 8970399c59..b128ec5d9f 100644 --- a/types/prosemirror-collab/prosemirror-collab-tests.ts +++ b/types/prosemirror-collab/prosemirror-collab-tests.ts @@ -1,5 +1,5 @@ import * as collab from 'prosemirror-collab'; -import {EditorState} from 'prosemirror-state'; +import { EditorState } from 'prosemirror-state'; let state = new EditorState(); let version = collab.getVersion(state); diff --git a/types/prosemirror-history/prosemirror-history-tests.ts b/types/prosemirror-history/prosemirror-history-tests.ts index 3beccd390b..10134e9db7 100644 --- a/types/prosemirror-history/prosemirror-history-tests.ts +++ b/types/prosemirror-history/prosemirror-history-tests.ts @@ -1,5 +1,5 @@ import * as history from 'prosemirror-history'; -import {EditorState} from 'prosemirror-state'; +import { EditorState } from 'prosemirror-state'; let state = new EditorState(); history.undo(state); diff --git a/types/q/v0/index.d.ts b/types/q/v0/index.d.ts index 11bf8fa7f7..94dc7ef712 100644 --- a/types/q/v0/index.d.ts +++ b/types/q/v0/index.d.ts @@ -166,6 +166,28 @@ declare namespace Q { * - { state: "rejected", reason: } */ inspect(): PromiseState; + + all(this: Promise<[IWhenable, IWhenable, IWhenable, IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C, D, E, F]>; + /** + * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. + */ + all(this: Promise<[IWhenable, IWhenable, IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C, D, E]>; + /** + * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. + */ + all(this: Promise<[IWhenable, IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C, D]>; + /** + * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. + */ + all(this: Promise<[IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C]>; + /** + * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. + */ + all(this: Promise<[IWhenable, IWhenable]>): Promise<[A, B]>; + /** + * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. + */ + all(this: Promise[]>): Promise; } interface PromiseState { diff --git a/types/q/v0/q-tests.ts b/types/q/v0/q-tests.ts index 5c64fa1ace..9bd95a77c8 100644 --- a/types/q/v0/q-tests.ts +++ b/types/q/v0/q-tests.ts @@ -220,7 +220,9 @@ var y2 = Q().then(() => { return <[typeof s, typeof n]>[s, n]; }); +var p1: Q.Promise<[string, number]> = y1.all(); var p2: Q.Promise<[string, number]> = y1.then(val => Q.all(val)); var p3: Q.Promise<[string, number]> = Q.all(y1); +var p4: Q.Promise<[string, number]> = y2.all(); var p5: Q.Promise<[string, number]> = y2.then(val => Q.all(val)); var p6: Q.Promise<[string, number]> = Q.all(y2); diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 7be57541d0..5ff9a54fce 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -7,6 +7,7 @@ // Stephen King // Alejandro Fernandez Haro // Vítor Castro +// Jordan Quagliatini // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -1004,6 +1005,45 @@ declare namespace R { */ mergeAll(list: any[]): T; + /** + * Creates a new object with the own properties of the first object merged with the own properties of the second object. + * If a key exists in both objects: + * and both values are objects, the two values will be recursively merged + * otherwise the value from the first object will be used. + */ + mergeDeepLeft(a: T1, b: T2): T1 & T2; + mergeDeepLeft(a: T1): (b: T2) => T1 & T2; + + /** + * Creates a new object with the own properties of the first object merged with the own properties of the second object. + * If a key exists in both objects: + * and both values are objects, the two values will be recursively merged + * otherwise the value from the second object will be used. + */ + mergeDeepRight(a: A, b: B): A & B; + mergeDeepRight(a: A): (b: B) => A & B; + + /** + * Creates a new object with the own properties of the two provided objects. If a key exists in both objects: + * and both associated values are also objects then the values will be recursively merged. + * otherwise the provided function is applied to associated values using the resulting value as the new value + * associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object. + */ + mergeDeepWith(fn: (x: T3, z: T4) => T3 & T4, a: T1, b: T2): T1 & T2; + mergeDeepWith(fn: (x: T3, z: T4) => T3 & T4, a: T1): (b: T2) => T1 & T2; + mergeDeepWith(fn: (x: T3, z: T4) => T3 & T4): (a: T1, b: T2) => T1 & T2; + + /** + * Creates a new object with the own properties of the two provided objects. If a key exists in both objects: + * and both associated values are also objects then the values will be recursively merged. + * otherwise the provided function is applied to the key and associated values using the resulting value as + * the new value associated with the key. If a key only exists in one object, the value will be associated with + * the key of the resulting object. + */ + mergeDeepWithKey(fn: (k: string, x: T3, z: T4) => T3 & T4, a: T1, b: T2): T1 & T2; + mergeDeepWithKey(fn: (k: string, x: T3, z: T4) => T3 & T4, a: T1): (b: T2) => T1 & T2; + mergeDeepWithKey(fn: (k: string, x: T3, z: T4) => T3 & T4): (a: T1, b: T2) => T1 & T2; + /** * Creates a new object with the own properties of the two provided objects. If a key exists in both objects, * the provided function is applied to the values associated with the key in each object, with the result being used as diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index ef1cba10be..f6afc8d29d 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1376,6 +1376,30 @@ class Rectangle { const b = R.mergeAll([{foo: 1}, {foo: 2}, {bar: 2}]); // => {foo:2,bar:2} }; +() => { + const a = R.mergeDeepLeft({foo: {bar: 1}}, {foo: {bar: 2}}); // => {foo: {bar: 1}} +}; + +() => { + const a = R.mergeDeepRight({foo: {bar: 1}}, {foo: {bar: 2}}); // => {foor: bar: 2}} +}; + +() => { + const a = R.mergeDeepWith( + (a: number[], b: number[]) => a.concat(b), + {foo: {bar: [1, 2]}}, + {foo: {bar: [3, 4]}}, + ); // => {foo: {bar: [1,2,3,4]}} +}; + +() => { + const a = R.mergeDeepWithKey( + (k: string, a: number[], b: number[]) => k === 'bar' ? a.concat(b) : a, + {foo: {bar: [1, 2], userIds: [42]}}, + {foo: {bar: [3, 4], userIds: [34]}} + ); // => { foo: { bar: [ 1, 2, 3, 4 ], userIds: [42] } } +}; + () => { const a = R.mergeWith(R.concat, {a: true, values: [10, 20]}, diff --git a/types/react-bytesize-icons/react-bytesize-icons-tests.tsx b/types/react-bytesize-icons/react-bytesize-icons-tests.tsx index 6d73100fe2..36eba21342 100644 --- a/types/react-bytesize-icons/react-bytesize-icons-tests.tsx +++ b/types/react-bytesize-icons/react-bytesize-icons-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {render} from 'react-dom'; +import { render } from 'react-dom'; import {Activity, External, Export} from 'react-bytesize-icons'; render(, document.getElementById('test')); diff --git a/types/react-chartjs-2/test/doughnut.tsx b/types/react-chartjs-2/test/doughnut.tsx index 268ddfe40e..6a25d0354b 100755 --- a/types/react-chartjs-2/test/doughnut.tsx +++ b/types/react-chartjs-2/test/doughnut.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {Doughnut} from 'react-chartjs-2'; +import { Doughnut } from 'react-chartjs-2'; const data = { labels: [ diff --git a/types/react-chartjs-2/test/horizontalBar.tsx b/types/react-chartjs-2/test/horizontalBar.tsx index 4d6381749d..bf66f6b9fc 100755 --- a/types/react-chartjs-2/test/horizontalBar.tsx +++ b/types/react-chartjs-2/test/horizontalBar.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {HorizontalBar} from 'react-chartjs-2'; +import { HorizontalBar } from 'react-chartjs-2'; const data = { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], diff --git a/types/react-chartjs-2/test/line.tsx b/types/react-chartjs-2/test/line.tsx index fb60416e4a..55b0ad73fd 100755 --- a/types/react-chartjs-2/test/line.tsx +++ b/types/react-chartjs-2/test/line.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {Line} from 'react-chartjs-2'; +import { Line } from 'react-chartjs-2'; const data = { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], diff --git a/types/react-chartjs-2/test/pie.tsx b/types/react-chartjs-2/test/pie.tsx index 454088331d..9fb1912f5b 100755 --- a/types/react-chartjs-2/test/pie.tsx +++ b/types/react-chartjs-2/test/pie.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {Pie} from 'react-chartjs-2'; +import { Pie } from 'react-chartjs-2'; const data = { labels: [ diff --git a/types/react-chartjs-2/test/polar.tsx b/types/react-chartjs-2/test/polar.tsx index b38fc9b44f..d586ca44be 100755 --- a/types/react-chartjs-2/test/polar.tsx +++ b/types/react-chartjs-2/test/polar.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {Polar} from 'react-chartjs-2'; +import { Polar } from 'react-chartjs-2'; const data = { datasets: [{ diff --git a/types/react-chartjs-2/test/radar.tsx b/types/react-chartjs-2/test/radar.tsx index fb4535d5e3..5c6dbc7c7d 100755 --- a/types/react-chartjs-2/test/radar.tsx +++ b/types/react-chartjs-2/test/radar.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {Radar} from 'react-chartjs-2'; +import { Radar } from 'react-chartjs-2'; const data = { labels: ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running'], diff --git a/types/react-dates/react-dates-tests.tsx b/types/react-dates/react-dates-tests.tsx index c775480a2f..e8dd3752b3 100644 --- a/types/react-dates/react-dates-tests.tsx +++ b/types/react-dates/react-dates-tests.tsx @@ -11,7 +11,7 @@ import { isSameDay, toISODateString, toLocalizedDateString, - toMomentObject} from "react-dates"; + toMomentObject } from "react-dates"; diff --git a/types/react-dropzone/react-dropzone-tests.tsx b/types/react-dropzone/react-dropzone-tests.tsx index d0477e3e4c..3bf54cdc2b 100644 --- a/types/react-dropzone/react-dropzone-tests.tsx +++ b/types/react-dropzone/react-dropzone-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import { DragEvent, SyntheticEvent} from "react"; +import { DragEvent, SyntheticEvent } from "react"; import Dropzone = require("react-dropzone"); import { ImageFile } from "react-dropzone"; diff --git a/types/react-grid-layout/index.d.ts b/types/react-grid-layout/index.d.ts index 63a6d0e6d7..d6d89c6727 100644 --- a/types/react-grid-layout/index.d.ts +++ b/types/react-grid-layout/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for react-grid-layout 0.14 // Project: https://github.com/STRML/react-grid-layout -// Definitions by: Andrew Birkholz , Ali Taheri +// Definitions by: Andrew Birkholz , +// Ali Taheri , +// Zheyang Song // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -78,7 +80,7 @@ declare namespace ReactGridLayout { } type Layouts = { - [P in Breakpoints]: Layout; + [P in Breakpoints]?: Layout[]; }; type ItemCallback = ( @@ -250,7 +252,7 @@ declare namespace ReactGridLayout { /** * layouts is an object mapping breakpoints to layouts. * - * e.g. `{lg: Layout, md: Layout, ...}` + * e.g. `{lg: Layout[], md: Layout[], ...}` */ layouts?: Layouts; diff --git a/types/react-grid-layout/react-grid-layout-tests.tsx b/types/react-grid-layout/react-grid-layout-tests.tsx index 629769970c..6c47e42d95 100644 --- a/types/react-grid-layout/react-grid-layout-tests.tsx +++ b/types/react-grid-layout/react-grid-layout-tests.tsx @@ -31,8 +31,17 @@ class DefaultGridTest extends React.Component { class ResponsiveGridTest extends React.Component { render() { + const layouts = { + lg: [ + { i: '1', x: 0, y: 0, w: 1, h: 2, static: true }, + { i: '2', x: 1, y: 0, w: 3, h: 2, minW: 2, maxW: 4 }, + { i: '3', x: 4, y: 0, w: 1, h: 2 } + ] + }; + return ( { state: State = {isOpen: false}; diff --git a/types/react-icon-base/index.d.ts b/types/react-icon-base/index.d.ts index 7697b42bb5..e60719a762 100644 --- a/types/react-icon-base/index.d.ts +++ b/types/react-icon-base/index.d.ts @@ -9,11 +9,8 @@ import * as React from "react"; export = IconBaseClass; declare namespace IconBaseClass { - interface IconBaseProps { - color?: string; + interface IconBaseProps extends React.SVGProps { size?: string | number; - style?: React.CSSProperties; - viewBox?: string; } } diff --git a/types/react-icon-base/react-icon-base-tests.tsx b/types/react-icon-base/react-icon-base-tests.tsx index c0d56f03f2..cb4fe929a9 100644 --- a/types/react-icon-base/react-icon-base-tests.tsx +++ b/types/react-icon-base/react-icon-base-tests.tsx @@ -1,4 +1,4 @@ import * as React from "react"; import * as IconBase from "react-icon-base"; -export default ; +export default ; diff --git a/types/react-icons/react-icons-tests.tsx b/types/react-icons/react-icons-tests.tsx index 584776c0af..83b9196a70 100644 --- a/types/react-icons/react-icons-tests.tsx +++ b/types/react-icons/react-icons-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import FaBeer from 'react-icons/fa/beer'; -import {FaExclamation} from 'react-icons/fa'; +import { FaExclamation } from 'react-icons/fa'; class Question extends React.Component { render() { diff --git a/types/react-intl/v1/react-intl-tests.tsx b/types/react-intl/v1/react-intl-tests.tsx index 33abc5890d..298f05f6ed 100644 --- a/types/react-intl/v1/react-intl-tests.tsx +++ b/types/react-intl/v1/react-intl-tests.tsx @@ -5,7 +5,7 @@ import * as React from 'react' import * as reactMixin from 'react-mixin' -import {IntlMixin, IntlComponent, FormattedNumber, FormattedMessage, FormattedDate} from 'react-intl' +import { IntlMixin, IntlComponent, FormattedNumber, FormattedMessage, FormattedDate } from 'react-intl' /////////////////////////////////////////////////////////////////////////// diff --git a/types/react-lazyload/index.d.ts b/types/react-lazyload/index.d.ts index 7ec2ae156c..3c4ae99805 100644 --- a/types/react-lazyload/index.d.ts +++ b/types/react-lazyload/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import {Component} from 'react'; +import { Component } from 'react'; export interface LazyLoadProps { once?: boolean; diff --git a/types/react-mdl/react-mdl-tests.tsx b/types/react-mdl/react-mdl-tests.tsx index 9243eaa32c..e9405820fe 100644 --- a/types/react-mdl/react-mdl-tests.tsx +++ b/types/react-mdl/react-mdl-tests.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; -import {Chip, ChipContact, +import { Chip, ChipContact, Badge, FABButton, Button, IconButton, Card, CardActions, CardTitle, CardText, CardMenu, CardMedia, @@ -23,7 +23,7 @@ import {Chip, ChipContact, Tabs, Tab, Textfield, Tooltip, - MDLComponent} from 'react-mdl'; + MDLComponent } from 'react-mdl'; // all tests are from the examples provided here: https://tleunen.github.io/react-mdl/ diff --git a/types/react-motion/react-motion-tests.tsx b/types/react-motion/react-motion-tests.tsx index 3a672db6d6..71aab1bfab 100644 --- a/types/react-motion/react-motion-tests.tsx +++ b/types/react-motion/react-motion-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import {StaggeredMotion, Motion, spring, TransitionMotion, TransitionPlainStyle, TransitionStyle, Style, PlainStyle} from 'react-motion'; +import { StaggeredMotion, Motion, spring, TransitionMotion, TransitionPlainStyle, TransitionStyle, Style, PlainStyle } from 'react-motion'; class Root extends React.Component { render() { diff --git a/types/react-native-fetch-blob/react-native-fetch-blob-tests.ts b/types/react-native-fetch-blob/react-native-fetch-blob-tests.ts index d276a0a7ab..33698e8caf 100644 --- a/types/react-native-fetch-blob/react-native-fetch-blob-tests.ts +++ b/types/react-native-fetch-blob/react-native-fetch-blob-tests.ts @@ -1,4 +1,4 @@ -import {RNFetchBlob} from "react-native-fetch-blob"; +import { RNFetchBlob } from "react-native-fetch-blob"; let BASE64_IMAGE_STRING = 'some base64 image'; let PATH_TO_THE_FILE = '/some/path.png'; diff --git a/types/react-native-sortable-list/react-native-sortable-list-tests.tsx b/types/react-native-sortable-list/react-native-sortable-list-tests.tsx index 8940484ab2..6518118173 100644 --- a/types/react-native-sortable-list/react-native-sortable-list-tests.tsx +++ b/types/react-native-sortable-list/react-native-sortable-list-tests.tsx @@ -12,7 +12,7 @@ import { TextStyle, ImageStyle, } from 'react-native'; -import SortableList, {RowProps} from 'react-native-sortable-list'; +import SortableList, {RowProps } from 'react-native-sortable-list'; const window = Dimensions.get('window'); diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 42fe51fc8c..a6bb0d7dba 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -1659,7 +1659,8 @@ export interface ViewPropertiesAndroid { type Falsy = undefined | null | false interface RecursiveArray extends Array> {} -interface RegisteredStyle extends Number {} +/** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle` and return `T`. */ +type RegisteredStyle = number & { __registeredStyleBrand: T }; export type StyleProp = T | RegisteredStyle | RecursiveArray | Falsy> | Falsy /** diff --git a/types/react-redux-toastr/react-redux-toastr-tests.ts b/types/react-redux-toastr/react-redux-toastr-tests.ts index c76208171c..f675bf5c78 100644 --- a/types/react-redux-toastr/react-redux-toastr-tests.ts +++ b/types/react-redux-toastr/react-redux-toastr-tests.ts @@ -1,4 +1,4 @@ -import {toastr, reducer as toastrReducer, actions} from 'react-redux-toastr'; +import { toastr, reducer as toastrReducer, actions } from 'react-redux-toastr'; import ReduxToastr from 'react-redux-toastr'; import * as React from 'react'; import * as ReactDOM from 'react-dom'; diff --git a/types/react-router-native/react-router-native-tests.tsx b/types/react-router-native/react-router-native-tests.tsx index 40cd5b8532..17888e56f7 100644 --- a/types/react-router-native/react-router-native-tests.tsx +++ b/types/react-router-native/react-router-native-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import {StyleSheet, Text, View} from 'react-native'; -import {NativeRouter as Router, Route, Link} from 'react-router-native'; +import { StyleSheet, Text, View } from 'react-native'; +import { NativeRouter as Router, Route, Link } from 'react-router-native'; const Home: React.SFC<{}> = () => { return ( diff --git a/types/react-sticky/react-sticky-tests.tsx b/types/react-sticky/react-sticky-tests.tsx index 6eb9d0e0d0..f7cc460611 100644 --- a/types/react-sticky/react-sticky-tests.tsx +++ b/types/react-sticky/react-sticky-tests.tsx @@ -1,4 +1,4 @@ -import {Sticky, StickyContainer} from "react-sticky"; +import { Sticky, StickyContainer } from "react-sticky"; import * as React from "react"; const StickyAllOptions: JSX.Element = diff --git a/types/react-tagcloud/react-tagcloud-tests.tsx b/types/react-tagcloud/react-tagcloud-tests.tsx index efdbfab378..4d4382db6d 100644 --- a/types/react-tagcloud/react-tagcloud-tests.tsx +++ b/types/react-tagcloud/react-tagcloud-tests.tsx @@ -1,7 +1,7 @@ // simple cloud import * as React from "react"; import * as ReactDOM from "react-dom"; -import {TagCloud, DefaultRenderer} from "react-tagcloud"; +import { TagCloud, DefaultRenderer } from "react-tagcloud"; let data = [ { value: "jQuery", count: 25 }, { value: "MongoDB", count: 18 }, diff --git a/types/react-virtualized/dist/es/ArrowKeyStepper.d.ts b/types/react-virtualized/dist/es/ArrowKeyStepper.d.ts index e42ff353f2..6bc853361b 100644 --- a/types/react-virtualized/dist/es/ArrowKeyStepper.d.ts +++ b/types/react-virtualized/dist/es/ArrowKeyStepper.d.ts @@ -21,6 +21,14 @@ export type ArrowKeyStepperProps = { columnCount: number; rowCount: number; mode?: 'edges' | 'cells'; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; } export type ScrollIndexes = { scrollToRow: number, diff --git a/types/react-virtualized/dist/es/AutoSizer.d.ts b/types/react-virtualized/dist/es/AutoSizer.d.ts index 1da48c8120..35a9081095 100644 --- a/types/react-virtualized/dist/es/AutoSizer.d.ts +++ b/types/react-virtualized/dist/es/AutoSizer.d.ts @@ -20,6 +20,14 @@ export type AutoSizerProps = { * ({ height, width }) => PropTypes.element */ children?: (props: Dimensions) => React.ReactNode + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; }; /** * Decorator component that automatically adjusts the width and height of a single child. diff --git a/types/react-virtualized/dist/es/CellMeasurer.d.ts b/types/react-virtualized/dist/es/CellMeasurer.d.ts index 0621d5579a..46c033ba49 100644 --- a/types/react-virtualized/dist/es/CellMeasurer.d.ts +++ b/types/react-virtualized/dist/es/CellMeasurer.d.ts @@ -53,6 +53,14 @@ export type CellMeasurerProps = { parent?: React.ReactType; rowIndex?: number; style?: React.CSSProperties; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; } /** * Wraps a cell and measures its rendered content. diff --git a/types/react-virtualized/dist/es/Collection.d.ts b/types/react-virtualized/dist/es/Collection.d.ts index 9a6730b76e..e3b378eacb 100644 --- a/types/react-virtualized/dist/es/Collection.d.ts +++ b/types/react-virtualized/dist/es/Collection.d.ts @@ -106,6 +106,14 @@ export type CollectionProps = { * (vs virtualized) columns. */ width: number; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; }; /** diff --git a/types/react-virtualized/dist/es/ColumnSizer.d.ts b/types/react-virtualized/dist/es/ColumnSizer.d.ts index 512e8db4a1..c3779c493c 100644 --- a/types/react-virtualized/dist/es/ColumnSizer.d.ts +++ b/types/react-virtualized/dist/es/ColumnSizer.d.ts @@ -26,6 +26,14 @@ export type ColumnSizerProps = { columnCount?: number; /** Width of Grid or Table child */ width: number; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; } /** * High-order component that auto-calculates column-widths for `Grid` cells. diff --git a/types/react-virtualized/dist/es/Grid.d.ts b/types/react-virtualized/dist/es/Grid.d.ts index 66801c4592..cc4cbaa9ac 100644 --- a/types/react-virtualized/dist/es/Grid.d.ts +++ b/types/react-virtualized/dist/es/Grid.d.ts @@ -280,6 +280,14 @@ export type GridCoreProps = { * Width of Grid; this property determines the number of visible (vs virtualized) columns. */ width: number; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; } export type GridProps = GridCoreProps & { diff --git a/types/react-virtualized/dist/es/InfiniteLoader.d.ts b/types/react-virtualized/dist/es/InfiniteLoader.d.ts index 1062caeb35..746ddc71f0 100644 --- a/types/react-virtualized/dist/es/InfiniteLoader.d.ts +++ b/types/react-virtualized/dist/es/InfiniteLoader.d.ts @@ -44,6 +44,14 @@ export type InfiniteLoaderProps = { * This value defaults to 15. */ threshold?: number; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; }; /** diff --git a/types/react-virtualized/dist/es/Masonry.d.ts b/types/react-virtualized/dist/es/Masonry.d.ts index 25b790ced6..4c67835722 100644 --- a/types/react-virtualized/dist/es/Masonry.d.ts +++ b/types/react-virtualized/dist/es/Masonry.d.ts @@ -46,7 +46,15 @@ export type MasonryProps = { scrollTop?: number, style?: React.CSSProperties, tabIndex?: number, - width: number + width: number, + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; } export type MasonryState = { diff --git a/types/react-virtualized/dist/es/ScrollSync.d.ts b/types/react-virtualized/dist/es/ScrollSync.d.ts index 2d49bee5d0..00137bf635 100644 --- a/types/react-virtualized/dist/es/ScrollSync.d.ts +++ b/types/react-virtualized/dist/es/ScrollSync.d.ts @@ -26,6 +26,14 @@ export type ScrollSyncProps = { * ({ onScroll, scrollLeft, scrollTop }) => PropTypes.element */ children?: (props: ScrollSyncChildProps) => React.ReactNode + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; }; export type ScrollSyncState = { diff --git a/types/react-virtualized/dist/es/WindowScroller.d.ts b/types/react-virtualized/dist/es/WindowScroller.d.ts index 16be9f8e1a..5ee54eb178 100644 --- a/types/react-virtualized/dist/es/WindowScroller.d.ts +++ b/types/react-virtualized/dist/es/WindowScroller.d.ts @@ -19,6 +19,14 @@ export type WindowScrollerProps = { onScroll?: (params: { scrollTop: number }) => void; /** Element to attach scroll event listeners. Defaults to window. */ scrollElement?: HTMLElement; + /** + * PLEASE NOTE + * The [key: string]: any; line is here on purpose + * This is due to the need of force re-render of PureComponent + * Check the following link if you want to know more + * https://github.com/bvaughn/react-virtualized#pass-thru-props + */ + [key: string]: any; } export type WindowScrollerState = { height: number, diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index 598d65302c..8bd32e7b26 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bvaughn/react-virtualized // Definitions by: Kalle Ott // John Gunther +// Konstantin Nesterov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index 3f6a6d8a35..e0bd1d50ed 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -1656,7 +1656,7 @@ export class TableExample extends PureComponent<{}, any> { } } -import {TableCellProps} from "react-virtualized" +import { TableCellProps } from "react-virtualized" export class DynamicHeightTableColumnExample extends PureComponent { state; diff --git a/types/react-widgets/lib/Calendar.d.ts b/types/react-widgets/lib/Calendar.d.ts index 1f68410dd9..d9d0a6d540 100644 --- a/types/react-widgets/lib/Calendar.d.ts +++ b/types/react-widgets/lib/Calendar.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonProps} from './CommonProps'; +import { ReactWidgetsCommonProps } from './CommonProps'; interface CalendarProps extends ReactWidgetsCommonProps{ /** diff --git a/types/react-widgets/lib/Combobox.d.ts b/types/react-widgets/lib/Combobox.d.ts index 473919f31d..a3b6aadb94 100644 --- a/types/react-widgets/lib/Combobox.d.ts +++ b/types/react-widgets/lib/Combobox.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonDropdownProps} from './CommonProps'; +import { ReactWidgetsCommonDropdownProps } from './CommonProps'; interface ComboBoxMessages { /** diff --git a/types/react-widgets/lib/DateTimePicker.d.ts b/types/react-widgets/lib/DateTimePicker.d.ts index 87f95a15e9..2f2f520cf2 100644 --- a/types/react-widgets/lib/DateTimePicker.d.ts +++ b/types/react-widgets/lib/DateTimePicker.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonDropdownProps} from './CommonProps'; +import { ReactWidgetsCommonDropdownProps } from './CommonProps'; interface DateTimePickerProps extends ReactWidgetsCommonDropdownProps { /** diff --git a/types/react-widgets/lib/DropdownList.d.ts b/types/react-widgets/lib/DropdownList.d.ts index b0aebc1de8..06ae39619b 100644 --- a/types/react-widgets/lib/DropdownList.d.ts +++ b/types/react-widgets/lib/DropdownList.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonDropdownProps} from './CommonProps'; +import { ReactWidgetsCommonDropdownProps } from './CommonProps'; interface DropdownListProps extends ReactWidgetsCommonDropdownProps { /** diff --git a/types/react-widgets/lib/Multiselect.d.ts b/types/react-widgets/lib/Multiselect.d.ts index 0b528dd14c..8f3b5591f2 100644 --- a/types/react-widgets/lib/Multiselect.d.ts +++ b/types/react-widgets/lib/Multiselect.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonDropdownProps} from './CommonProps'; +import { ReactWidgetsCommonDropdownProps } from './CommonProps'; interface MultiselectProps extends ReactWidgetsCommonDropdownProps { /** diff --git a/types/react-widgets/lib/NumberPicker.d.ts b/types/react-widgets/lib/NumberPicker.d.ts index 59f46ee3c1..0feaee5bf1 100644 --- a/types/react-widgets/lib/NumberPicker.d.ts +++ b/types/react-widgets/lib/NumberPicker.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonProps} from './CommonProps'; +import { ReactWidgetsCommonProps } from './CommonProps'; interface NumberPickerProps extends ReactWidgetsCommonProps{ /** diff --git a/types/react-widgets/lib/SelectList.d.ts b/types/react-widgets/lib/SelectList.d.ts index ca925898c6..a70f4c4de8 100644 --- a/types/react-widgets/lib/SelectList.d.ts +++ b/types/react-widgets/lib/SelectList.d.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import {ReactWidgetsCommonProps} from './CommonProps'; +import { ReactWidgetsCommonProps } from './CommonProps'; interface SelectListProps extends ReactWidgetsCommonProps{ /** diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index 8d76f3084c..e29d62cb0d 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; export interface UncontrolledProps { className?: string; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index 4f88f48025..51f72e39d3 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { color?: string; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index e66c672a64..54f581288c 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: string; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index 66e56776be..0277305b21 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index c0181c6374..be4d1c50d6 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { outline?: boolean; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index ddabdb88d1..d807ea33cf 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index 3a33287f14..fea31dd5d5 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index 28acb6cbaf..0dbde7f879 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts index 6b93fcafce..0aa31a63a7 100644 --- a/types/reactstrap/lib/CardBlock.d.ts +++ b/types/reactstrap/lib/CardBlock.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index 12c0507d5a..0cc1a80a1a 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index 6f3076577d..1a5882aa54 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index ab5434ae9c..0956cb06c9 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index d258e08615..5c0a0a1ab1 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index 01e60e345d..f063057c92 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index 6fa732ebca..1c3fee274b 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index 0d366bc396..05519847b2 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 6c759033d7..62efc4efc6 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index 923339aecd..bfacd4e794 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index effb2b81ad..13177fba67 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index 61199b455c..2843800a4e 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Collapse.d.ts b/types/reactstrap/lib/Collapse.d.ts index d072e8fb46..50160bbcf6 100644 --- a/types/reactstrap/lib/Collapse.d.ts +++ b/types/reactstrap/lib/Collapse.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { isOpen?: boolean; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index a7e02b2a72..f49951ba26 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 7ad85570b1..19d1500cbe 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -1,6 +1,6 @@ /// -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; export interface UncontrolledProps { isOpen?: boolean; diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index 46462984e0..6fae837041 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { disabled?: boolean; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index e0a01f109d..05e93babef 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index ac72251641..5ef49db71f 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { caret?: boolean; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index 3bac4061a7..30862d2e17 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { baseClass?: string; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index d3a4497d0e..1c10cfe54a 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { inline?: boolean; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index 3e30e323a3..7fde21b062 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: string; diff --git a/types/reactstrap/lib/FormGroup.d.ts b/types/reactstrap/lib/FormGroup.d.ts index 800ce4ceb1..6031ff2f75 100644 --- a/types/reactstrap/lib/FormGroup.d.ts +++ b/types/reactstrap/lib/FormGroup.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { row?: boolean; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index 6bc2351582..9069be4da6 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { inline?: boolean; diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index 6177ccfce5..38a83a49f6 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; type InputType = | 'text' diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index 40bba65097..2de95edc94 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index 07a4512809..a98eb5d821 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts index 304eb660e0..fa7cb1995a 100644 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ b/types/reactstrap/lib/InputGroupButton.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index 70f0919b7f..cc1f65c956 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Label.d.ts b/types/reactstrap/lib/Label.d.ts index ab7dd820d3..eb496d90a3 100644 --- a/types/reactstrap/lib/Label.d.ts +++ b/types/reactstrap/lib/Label.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; import { ColumnProps } from './Col'; interface Intermediate extends React.LabelHTMLAttributes { diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index 4cb380922f..861c7a1d06 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index f7238ce2eb..9627f3262b 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index c8168682ab..869a6b2708 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index 394e524c3d..df263f30d8 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index 6f11450323..c5408d85d7 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { body?: boolean; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index 06261e0ac1..8ba3ef21d2 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { isOpen?: boolean; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index a32793459e..98933b2fc2 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index ad50921f92..84b3da7ec8 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index 73c95eae3e..494c9685a3 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Nav.d.ts b/types/reactstrap/lib/Nav.d.ts index 72792c29aa..c646e94304 100644 --- a/types/reactstrap/lib/Nav.d.ts +++ b/types/reactstrap/lib/Nav.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { inline?: boolean; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index ced648169d..db19f92c56 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index e9a7ea1ef8..0c90c104bb 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index 0e187426d8..f3e57535e7 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { light?: boolean; diff --git a/types/reactstrap/lib/NavbarBrand.d.ts b/types/reactstrap/lib/NavbarBrand.d.ts index 6af6777533..94239da4f8 100644 --- a/types/reactstrap/lib/NavbarBrand.d.ts +++ b/types/reactstrap/lib/NavbarBrand.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface NavbarBrand { tag?: React.ReactType; diff --git a/types/reactstrap/lib/NavbarToggler.d.ts b/types/reactstrap/lib/NavbarToggler.d.ts index 4372607830..282eeaa672 100644 --- a/types/reactstrap/lib/NavbarToggler.d.ts +++ b/types/reactstrap/lib/NavbarToggler.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index 1a7eecb356..a34401be35 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { className?: string; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index 69f9f0e286..183a7e9d84 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { className?: string; diff --git a/types/reactstrap/lib/PaginationLink.d.ts b/types/reactstrap/lib/PaginationLink.d.ts index e3429ceb7b..16e194578d 100644 --- a/types/reactstrap/lib/PaginationLink.d.ts +++ b/types/reactstrap/lib/PaginationLink.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps { 'aria-label'?: string; diff --git a/types/reactstrap/lib/Popover.d.ts b/types/reactstrap/lib/Popover.d.ts index 50d3bbd5fc..b779a33ede 100644 --- a/types/reactstrap/lib/Popover.d.ts +++ b/types/reactstrap/lib/Popover.d.ts @@ -1,6 +1,6 @@ /// -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; type Placement = 'top' diff --git a/types/reactstrap/lib/PopoverContent.d.ts b/types/reactstrap/lib/PopoverContent.d.ts index 9104824756..cac45d14cb 100644 --- a/types/reactstrap/lib/PopoverContent.d.ts +++ b/types/reactstrap/lib/PopoverContent.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/PopoverTitle.d.ts b/types/reactstrap/lib/PopoverTitle.d.ts index ea1a01f415..796de02658 100644 --- a/types/reactstrap/lib/PopoverTitle.d.ts +++ b/types/reactstrap/lib/PopoverTitle.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index b8b683f5ae..09c4304373 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { bar?: boolean; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index 5b52a3fb71..1ffbb9f7e6 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props extends React.HTMLProps< HTMLElement> { className?: string; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 69fe513818..af6feec078 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index d53961d5ff..9eead420be 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index 970282dd9b..ec8bfc43fd 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { className?: string; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index b3c7ca77ff..7dce8876f2 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -1,4 +1,4 @@ -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { color?: string; diff --git a/types/reactstrap/lib/TetherContent.d.ts b/types/reactstrap/lib/TetherContent.d.ts index e372a77f07..cbc22373e3 100644 --- a/types/reactstrap/lib/TetherContent.d.ts +++ b/types/reactstrap/lib/TetherContent.d.ts @@ -1,6 +1,6 @@ /// -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; interface Props { className?: string; diff --git a/types/reactstrap/lib/Tooltip.d.ts b/types/reactstrap/lib/Tooltip.d.ts index df8987e36d..9dba615084 100644 --- a/types/reactstrap/lib/Tooltip.d.ts +++ b/types/reactstrap/lib/Tooltip.d.ts @@ -1,6 +1,6 @@ /// -import {CSSModule} from '../index'; +import { CSSModule } from '../index'; type Placement = 'top' diff --git a/types/redlock/redlock-tests.ts b/types/redlock/redlock-tests.ts index 311103ad2d..3b2c8f25f7 100644 --- a/types/redlock/redlock-tests.ts +++ b/types/redlock/redlock-tests.ts @@ -1,7 +1,7 @@ import * as Redlock from 'redlock'; import { Callback as NodeifyCallback, Options, Lock } from 'redlock'; import * as Promise from 'bluebird'; -import {RedisClient} from 'redis'; +import { RedisClient } from 'redis'; let redlock: Redlock; let client: RedisClient; diff --git a/types/reduce-reducers/index.d.ts b/types/reduce-reducers/index.d.ts index 2b630766fc..d4bde0bc8a 100644 --- a/types/reduce-reducers/index.d.ts +++ b/types/reduce-reducers/index.d.ts @@ -3,5 +3,5 @@ // Definitions by: Huy Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {Reducer} from 'redux'; +import { Reducer } from 'redux'; export default function reduceReducer(...reducers: Array>): Reducer; diff --git a/types/redux-actions/index.d.ts b/types/redux-actions/index.d.ts index d5b825e28c..3bcd996902 100644 --- a/types/redux-actions/index.d.ts +++ b/types/redux-actions/index.d.ts @@ -119,6 +119,4 @@ export function handleActions( initialState: State ): Reducer; -export function combineActions( - ...actionTypes: Array | string> -): Array>; +export function combineActions(...actionTypes: Array | string>): string; diff --git a/types/redux-actions/redux-actions-tests.ts b/types/redux-actions/redux-actions-tests.ts index e4c51aa662..4520e489c5 100644 --- a/types/redux-actions/redux-actions-tests.ts +++ b/types/redux-actions/redux-actions-tests.ts @@ -136,6 +136,10 @@ ReduxActions.handleAction(act3, (state, action) => { ReduxActions.handleAction(ReduxActions.combineActions(act1, act3, act2), (state, action) => {}, 0); +ReduxActions.handleActions({ + [ReduxActions.combineActions(act1, act3, act2)](state, action) {} +}, 0); + /* can't do this until it lands in 2.2, HKTs ReduxActions.handleAction(act, (state, action) => { action.payload === 'hello' diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts new file mode 100644 index 0000000000..e3f5345591 --- /dev/null +++ b/types/redux-batched-subscribe/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for redux-batched-subscribe 0.1 +// Project: https://github.com/tappleby/redux-batched-subscribe +// Definitions by: Dibyo Majumdar +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { GenericStoreEnhancer } from 'redux'; + +export type NotifyFunction = () => void; +export type BatchFunction = (notify: NotifyFunction) => void; + +export function batchedSubscribe(batch: BatchFunction): GenericStoreEnhancer; diff --git a/types/redux-batched-subscribe/package.json b/types/redux-batched-subscribe/package.json new file mode 100644 index 0000000000..c4ea3b7de6 --- /dev/null +++ b/types/redux-batched-subscribe/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "redux": ">=1.0.0" + } +} diff --git a/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts b/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts new file mode 100644 index 0000000000..5bfa3e0aa6 --- /dev/null +++ b/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts @@ -0,0 +1,30 @@ +import { createStore, Store, Reducer } from "redux"; +import { batchedSubscribe, BatchFunction, NotifyFunction } from 'redux-batched-subscribe'; + +interface State { + [key: string]: any; +} + +const rootReducer: Reducer = () => ({}); + +const asyncNotify: BatchFunction = (() => { + let notifying: boolean = false; + + return (notify: NotifyFunction) => { + if (notifying) { + return; + } + + notifying = true; + setTimeout(() => { + notify(); + notifying = false; + }); + }; +})(); + +const store: Store = createStore( + rootReducer, + undefined, + batchedSubscribe(asyncNotify) +); diff --git a/types/redux-batched-subscribe/tsconfig.json b/types/redux-batched-subscribe/tsconfig.json new file mode 100644 index 0000000000..80aea65c77 --- /dev/null +++ b/types/redux-batched-subscribe/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-batched-subscribe-tests.ts" + ] +} diff --git a/types/redux-batched-subscribe/tslint.json b/types/redux-batched-subscribe/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/redux-batched-subscribe/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/redux-devtools-log-monitor/index.d.ts b/types/redux-devtools-log-monitor/index.d.ts index d3cc1b25a6..b257adec0f 100644 --- a/types/redux-devtools-log-monitor/index.d.ts +++ b/types/redux-devtools-log-monitor/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.3 import * as React from 'react' -import {ColorScheme} from 'base16' +import { ColorScheme } from 'base16' interface ILogMonitorProps { /** diff --git a/types/redux-form/v4/redux-form-tests.tsx b/types/redux-form/v4/redux-form-tests.tsx index 2c962460fa..424c87c609 100644 --- a/types/redux-form/v4/redux-form-tests.tsx +++ b/types/redux-form/v4/redux-form-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import {Component, PropTypes} from 'react'; +import { Component, PropTypes } from 'react'; import {createStore, combineReducers} from 'redux'; import {reduxForm, reducer as reduxFormReducer, ReduxFormProps} from 'redux-form'; diff --git a/types/redux-logger/redux-logger-tests.ts b/types/redux-logger/redux-logger-tests.ts index db0131b95e..3ede2b8806 100644 --- a/types/redux-logger/redux-logger-tests.ts +++ b/types/redux-logger/redux-logger-tests.ts @@ -1,5 +1,5 @@ -import {createLogger} from 'redux-logger'; +import { createLogger } from 'redux-logger'; import logger from 'redux-logger'; import { applyMiddleware, createStore } from 'redux'; diff --git a/types/redux-promise/redux-promise-tests.ts b/types/redux-promise/redux-promise-tests.ts index 39f3c9fe84..1305cd6833 100644 --- a/types/redux-promise/redux-promise-tests.ts +++ b/types/redux-promise/redux-promise-tests.ts @@ -1,4 +1,4 @@ -import {createAction} from 'redux-actions'; +import { createAction } from 'redux-actions'; import { createStore, applyMiddleware, PromiseAction } from 'redux'; import promise = require('redux-promise'); diff --git a/types/restangular/index.d.ts b/types/restangular/index.d.ts index 5d871cdd67..c32f913549 100644 --- a/types/restangular/index.d.ts +++ b/types/restangular/index.d.ts @@ -7,7 +7,7 @@ /// // Support AMD require (copying angular.d.ts approach) -// allows for import {IRequestConfig} from 'restangular' ES6 approach +// allows for import { IRequestConfig } from 'restangular' ES6 approach import * as angular from 'angular'; export = restangular; export as namespace Restangular; diff --git a/types/restify-plugins/index.d.ts b/types/restify-plugins/index.d.ts index d461358bdc..c0d8114d92 100644 --- a/types/restify-plugins/index.d.ts +++ b/types/restify-plugins/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Костя Третяк // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import {RequestHandler, Server, Request, Response, Route} from 'restify'; +import { RequestHandler, Server, Request, Response, Route } from 'restify'; import Logger = require('bunyan'); // *************** This module includes the follow pre plugins, which are intended to be used prior to the routing of a request: diff --git a/types/rheostat/rheostat-tests.tsx b/types/rheostat/rheostat-tests.tsx index 1116861943..263e287f6f 100644 --- a/types/rheostat/rheostat-tests.tsx +++ b/types/rheostat/rheostat-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import Rheostat, {Orientation, Algorithm, PublicState} from 'rheostat'; +import Rheostat, { Orientation, Algorithm, PublicState } from 'rheostat'; type Element = React.ReactElement; diff --git a/types/router5/router5-tests.ts b/types/router5/router5-tests.ts index 3e94724f54..e59f6830c8 100644 --- a/types/router5/router5-tests.ts +++ b/types/router5/router5-tests.ts @@ -1,5 +1,5 @@ -import Router5, {loggerPlugin, RouteNode, Router5 as _Router5} from 'router5'; +import Router5, {loggerPlugin, RouteNode, Router5 as _Router5 } from 'router5'; const router1: Router5 = new Router5(); const router2: Router5 = new _Router5(); diff --git a/types/rx.wamp/rx.wamp-tests.ts b/types/rx.wamp/rx.wamp-tests.ts index 16c036f0a3..6e7cb3e6ed 100644 --- a/types/rx.wamp/rx.wamp-tests.ts +++ b/types/rx.wamp/rx.wamp-tests.ts @@ -1,5 +1,5 @@ import * as autobahn from "autobahn"; -import {IWampEvent} from "rx.wamp"; +import { IWampEvent } from "rx.wamp"; function nodeJS(session: autobahn.Session) { var sessionObservable = diff --git a/types/saml20/index.d.ts b/types/saml20/index.d.ts new file mode 100644 index 0000000000..29f4361db0 --- /dev/null +++ b/types/saml20/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for saml20 0.1 +// Project: https://github.com/leandrob/saml20 +// Definitions by: Jan Petzold +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Profile { + issuer: string; + claims: any; + audience?: string; + sessionIndex?: string; // only SAML 2.0 +} + +export type ValidationOptions = ValidationOptionsWithKey | ValidationOptionsWithPrint; + +export interface ValidationOptionsWithKey { + publicKey: string; + bypassExpiration?: boolean; + audience?: any; +} + +export interface ValidationOptionsWithPrint { + thumbprint: string; + bypassExpiration?: boolean; + audience?: any; +} + +export type ParseCallback = (err: Error | null, profile: Profile, version: string) => void; + +export function parse(rawAssertion: string, cb: ParseCallback): void; +export function validate(rawAssertion: string, options: ValidationOptions, cb: ParseCallback): void; diff --git a/types/saml20/saml20-tests.ts b/types/saml20/saml20-tests.ts new file mode 100644 index 0000000000..f1afbfb13c --- /dev/null +++ b/types/saml20/saml20-tests.ts @@ -0,0 +1,4 @@ +import * as saml from "saml20"; + +saml.validate('', { publicKey: '', audience: '', bypassExpiration: false }, (err: Error, profile: saml.Profile) => { }); // $ExpectType void +saml.parse('', (err: Error, profile: saml.Profile) => { }); // $ExpectType void diff --git a/types/saml20/tsconfig.json b/types/saml20/tsconfig.json new file mode 100644 index 0000000000..e1cc76eb6c --- /dev/null +++ b/types/saml20/tsconfig.json @@ -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", + "saml20-tests.ts" + ] +} \ No newline at end of file diff --git a/types/saml20/tslint.json b/types/saml20/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/saml20/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/saywhen/index.d.ts b/types/saywhen/index.d.ts new file mode 100644 index 0000000000..e799ae0ca2 --- /dev/null +++ b/types/saywhen/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for saywhen 1.1 +// Project: https://github.com/pushtechnology/saywhen +// Definitions by: Sean Sobey +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +type Func = (...args: any[]) => any; + +declare function when(spy: T & jasmine.Spy): CallHandler; + +declare namespace when { + function captor(val?: T): MatcherProxy; + + function noConflict(): void; + + function is(val: T): boolean; +} + +interface CallHandler { + readonly isCalled: Proxy; + isCalledWith(...args: any[]): Proxy; +} + +interface Proxy { + then(fn: T): Proxy; + thenReturn(val: any): Proxy; + thenThrow(err: Error): Proxy; +} + +interface MatcherProxy { + (arg: T): boolean; + readonly latest: T; + values(): T[]; +} + +export = when; diff --git a/types/saywhen/saywhen-tests.ts b/types/saywhen/saywhen-tests.ts new file mode 100644 index 0000000000..a1a02d6178 --- /dev/null +++ b/types/saywhen/saywhen-tests.ts @@ -0,0 +1,8 @@ +import * as when from 'saywhen'; + +when(jasmine.createSpy('test')); // $ExpectType CallHandler +when(jasmine.createSpy('test')).isCalled; // $ExpectType Proxy + +when.captor(); // $ExpectType MatcherProxy<{}> +when.captor(jasmine.any(Number)); // $ExpectType MatcherProxy +when.noConflict(); // $ExpectType void diff --git a/types/saywhen/tsconfig.json b/types/saywhen/tsconfig.json new file mode 100644 index 0000000000..650156cc12 --- /dev/null +++ b/types/saywhen/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "alwaysStrict": true, + "forceConsistentCasingInFileNames": true, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedParameters": false, + "noUnusedLocals": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true + }, + "files": [ + "index.d.ts", + "saywhen-tests.ts" + ] +} \ No newline at end of file diff --git a/types/saywhen/tslint.json b/types/saywhen/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/saywhen/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/scalike/scalike-tests.ts b/types/scalike/scalike-tests.ts index f95bb91a9c..6f393baf77 100644 --- a/types/scalike/scalike-tests.ts +++ b/types/scalike/scalike-tests.ts @@ -1,6 +1,6 @@ -import {Optional, Some, None, Try, Right, Left, Either, Future} from "scalike"; +import { Optional, Some, None, Try, Right, Left, Either, Future } from "scalike"; // Optional Optional(1).map(x => x + 1); // Some(2) diff --git a/types/semantic-ui-api/global.d.ts b/types/semantic-ui-api/global.d.ts index a9799bad44..b0cd596798 100644 --- a/types/semantic-ui-api/global.d.ts +++ b/types/semantic-ui-api/global.d.ts @@ -110,7 +110,8 @@ declare namespace SemanticUI { type ApiSettings = ApiSettings.Param; namespace ApiSettings { - type Param = (Pick<_Impl, 'on'> | + type Param = (Pick<_Impl, 'api'> | + Pick<_Impl, 'on'> | Pick<_Impl, 'cache'> | Pick<_Impl, 'stateContext'> | Pick<_Impl, 'encodeParameters'> | @@ -156,6 +157,10 @@ declare namespace SemanticUI { Partial>; interface _Impl { + api: { + [action: string]: string; + }; + // region Behavior /** @@ -270,7 +275,7 @@ declare namespace SemanticUI { /** * Method for transmitting request to server */ - method: 'post' | 'get'; + method: 'post' | 'get' | 'put' | 'delete' | 'head' | 'options' | 'patch'; /** * Expected data type of response */ diff --git a/types/semantic-ui-api/semantic-ui-api-tests.ts b/types/semantic-ui-api/semantic-ui-api-tests.ts index ca8107d8ec..d94b02cfb8 100644 --- a/types/semantic-ui-api/semantic-ui-api-tests.ts +++ b/types/semantic-ui-api/semantic-ui-api-tests.ts @@ -140,6 +140,40 @@ function test_api() { $(selector).api({ foo: 'bar' }); // $ExpectError } +function creating_an_api() { + function required_parameters() { + /* Two required variables */ + $.fn.api.settings.api = { + 'get followers': '/followers/{id}?results={count}', + }; + } + + function optional_parameters() { + /* One required, one optional variable */ + $.fn.api.settings.api = { + 'get followers': '/followers/{id}/{/sort}', + }; + } + + function creating_your_api() { + /* Define API endpoints once globally */ + $.fn.api.settings.api = { + 'get followers': '/followers/{id}?results={count}', + 'create user': '/create', + 'add user': '/add/{id}', + 'follow user': '/follow/{id}', + search: '/search/?query={value}' + }; + } + + function using_urls() { + $('.search.button') + .api({ + url: 'http://www.google.com?q={value}' + }); + } +} + import api = require('semantic-ui-api'); function test_module() { diff --git a/types/semantic-ui-form/global.d.ts b/types/semantic-ui-form/global.d.ts index 3f8b3977e9..0bc8bf9b66 100644 --- a/types/semantic-ui-form/global.d.ts +++ b/types/semantic-ui-form/global.d.ts @@ -14,6 +14,43 @@ declare namespace SemanticUI { * Returns true/false whether a form passes its validation rules */ (behavior: 'is valid'): boolean; + /** + * Adds rule to existing rules for field + * @since 2.2.11 + */ + (behavior: 'add rule', field: string, rules: string | string[] | Form.Rules): JQuery; + /** + * Adds rule to existing rules for field + * @since 2.2.11 + */ + (behavior: 'add field', field: string, rules: string | string[] | Form.Rules): JQuery; + /** + * Adds fields object to existing fields + * @since 2.2.11 + */ + (behavior: 'add fields', fields: Form.Fields): JQuery; + /** + * Removes specific rule from field leaving other rules + * @since 2.2.11 + */ + (behavior: 'remove rule', field: string, rule: Form.Rule): JQuery; + /** + * Remove all validation for a field + * @since 2.2.11 + */ + (behavior: 'remove field', field: string): JQuery; + /** + * @since 2.2.11 + */ + (behavior: 'remove rules', fields: string | string[], rules: Form.Rule[]): JQuery; + /** + * @since 2.2.11 + */ + (behavior: 'remove fields', fields: string[]): JQuery; + /** + * Adds error prompt to the field with the given identifier + */ + (behavior: 'add prompt', identifier: string, errors: string | string[]): JQuery; /** * Validates form and calls onSuccess or onFailure */ @@ -58,7 +95,7 @@ declare namespace SemanticUI { (behavior: 'setting', name: K, value?: undefined): FormSettings._Impl[K]; (behavior: 'setting', name: K, value: FormSettings._Impl[K]): JQuery; (behavior: 'setting', value: FormSettings): JQuery; - (settings?: FormSettings): JQuery; + (settings?: FormSettings | Form.Fields): JQuery; } /** @@ -96,6 +133,10 @@ declare namespace SemanticUI { Partial>; interface _Impl { + defaults: { + [name: string]: Form.Field; + }; + // region Form Settings /** @@ -255,6 +296,7 @@ declare namespace SemanticUI { namespace Form { interface Field { identifier: string; + optional?: boolean; rules: Rule[]; } @@ -263,6 +305,14 @@ declare namespace SemanticUI { prompt: string; } + interface Fields { + [name: string]: string | string[]; + } + + interface Rules { + rules: Rule[]; + } + type TextSettings = TextSettings.Param; namespace TextSettings { diff --git a/types/semantic-ui-form/semantic-ui-form-tests.ts b/types/semantic-ui-form/semantic-ui-form-tests.ts index 56293fc5b4..76b9b95968 100644 --- a/types/semantic-ui-form/semantic-ui-form-tests.ts +++ b/types/semantic-ui-form/semantic-ui-form-tests.ts @@ -1,3 +1,5 @@ +/* tslint:disable:only-arrow-functions */ + function test_form_static() { $.fn.form.settings.error!.method = 'method'; $.fn.form.settings.namespace = 'namespace'; @@ -12,6 +14,48 @@ function test_form() { const selector = '.ui.form'; $(selector).form('submit'); // $ExpectType JQuery $(selector).form('is valid'); // $ExpectType boolean + $(selector).form('add rule', 'field', 'rule'); // $ExpectType JQuery + $(selector).form('add rule', 'field', ['rule1', 'rule2']); // $ExpectType JQuery + // $ExpectType JQuery + $(selector).form('add rule', 'field', { + rules: [{ + type: 'type', + prompt: 'prompt' + }] + }); + $(selector).form('add field', 'field', 'rule'); // $ExpectType JQuery + $(selector).form('add field', 'field', ['rule1', 'rule2']); // $ExpectType JQuery + // $ExpectType JQuery + $(selector).form('add field', 'field', { + rules: [{ + type: 'type', + prompt: 'prompt' + }] + }); + // $ExpectType JQuery + $(selector).form('add fields', { + field1: 'rule', + field2: ['rule1', 'rule2'] + }); + // $ExpectType JQuery + $(selector).form('remove rule', 'field', { + type: 'type', + prompt: 'prompt' + }); + $(selector).form('remove field', 'field'); // $ExpectType JQuery + // $ExpectType JQuery + $(selector).form('remove rules', 'field', [{ + type: 'type', + prompt: 'prompt' + }]); + // $ExpectType JQuery + $(selector).form('remove rules', ['field1', 'field2'], [{ + type: 'type', + prompt: 'prompt' + }]); + $(selector).form('remove fields', ['field1', 'field2']); // $ExpectType JQuery + $(selector).form('add prompt', 'identifier', 'error'); // $ExpectType JQuery + $(selector).form('add prompt', 'identifier', ['error1', 'error2']); // $ExpectType JQuery $(selector).form('validate form'); // $ExpectType JQuery $(selector).form('get change event') === 'change event'; $(selector).form('get field', 'id'); // $ExpectType JQuery @@ -158,7 +202,70 @@ function test_form() { $(selector).form(); // $ExpectType JQuery $(selector).form('foo'); // $ExpectError - $(selector).form({ foo: 'bar' }); // $ExpectError + $(selector).form({ foo: 1 }); // $ExpectError +} + +function adding_rules_programmatically() { + { + // lets only validate username to start + $('.add.example .ui.form') + .form({ + username: ['empty', 'minLength[5]'] + }); + } + { + // lets toggle some validation based on button + $('.add.example .ui.positive.button') + .on('click', function() { + $('.add.example .ui.form') + // adding longform + .form('add rule', 'gender', { + rules: [ + { + type: 'empty', + prompt: 'Entering your gender is necessary' + } + ] + }) + // adding shorthand + .form('add rule', 'password', ['empty', 'minLength[5]']); + }); + } + { + $('.add.example .ui.negative.button') + .on('click', function() { + $('.add.example .ui.form') + // removing multiple at once + .form('remove fields', ['gender', 'password']); + }); + } +} + +function setting_site_defaults() { + { + $.fn.form.settings.defaults = { + email: { + identifier: 'email', + rules: [ + { + type: 'email', + prompt: 'Please enter a valid e-mail' + } + ] + }, + // this form doesn't have a cc email but it will not produce an error + ccEmail: { + identifier: 'cc-email', + optional: true, + rules: [ + { + type: 'email', + prompt: 'Please enter a valid second e-mail' + } + ] + }, + }; + } } import form = require('semantic-ui-form'); diff --git a/types/semantic-ui-modal/global.d.ts b/types/semantic-ui-modal/global.d.ts index 2e6efc4e1d..4a3d0ca57a 100644 --- a/types/semantic-ui-modal/global.d.ts +++ b/types/semantic-ui-modal/global.d.ts @@ -131,7 +131,7 @@ declare namespace SemanticUI { */ keyboardShortcuts: boolean; /** - * A vertical offset to allow for content outside of modal, for example a close button, to be centered. + * A vertical offset to allow for content outside of modal, for example a close button, to be centered. * * @default 0 */ diff --git a/types/semantic-ui-popup/global.d.ts b/types/semantic-ui-popup/global.d.ts index f9504e1780..185acb1053 100644 --- a/types/semantic-ui-popup/global.d.ts +++ b/types/semantic-ui-popup/global.d.ts @@ -50,6 +50,18 @@ declare namespace SemanticUI { * Repositions a popup */ (behavior: 'set position', position: string): JQuery; + /** + * @since 2.2.11 + */ + (behavior: 'bind clickaway'): JQuery; + /** + * @since 2.2.11 + */ + (behavior: 'bind touch close'): JQuery; + /** + * @since 2.2.11 + */ + (behavior: 'bind close on scroll'): JQuery; /** * Removes popup from the page and removes all events */ @@ -471,7 +483,8 @@ declare namespace SemanticUI { type Param = (Pick<_Impl, 'loading'> | Pick<_Impl, 'popup'> | Pick<_Impl, 'position'> | - Pick<_Impl, 'visible'>) & + Pick<_Impl, 'visible'> | + Pick<_Impl, 'popupVisible'>) & Partial>; interface _Impl { @@ -491,6 +504,10 @@ declare namespace SemanticUI { * @default 'visible' */ visible: string; + /** + * @since 2.2.11 + */ + popupVisible: string; } } diff --git a/types/semantic-ui-popup/semantic-ui-popup-tests.ts b/types/semantic-ui-popup/semantic-ui-popup-tests.ts index 9b00a9dba8..d8e852ef6c 100644 --- a/types/semantic-ui-popup/semantic-ui-popup-tests.ts +++ b/types/semantic-ui-popup/semantic-ui-popup-tests.ts @@ -20,6 +20,9 @@ function test_popup() { $(selector).popup('is hidden'); // $ExpectType boolean $(selector).popup('exists'); // $ExpectType boolean $(selector).popup('reposition'); // $ExpectType JQuery + $(selector).popup('bind clickaway'); // $ExpectType JQuery + $(selector).popup('bind touch close'); // $ExpectType JQuery + $(selector).popup('bind close on scroll'); // $ExpectType JQuery $(selector).popup('set position', 'position'); // $ExpectType JQuery $(selector).popup('destroy'); // $ExpectType JQuery $(selector).popup('setting', 'debug', undefined); // $ExpectType boolean @@ -116,7 +119,8 @@ function test_popup() { loading: 'loading', popup: 'popup', position: 'top', - visible: 'visible' + visible: 'visible', + popupVisible: 'popupVisible' }, error: { invalidPosition: 'invalidPosition', diff --git a/types/semantic-ui-sticky/global.d.ts b/types/semantic-ui-sticky/global.d.ts index 220e57a011..4a8496468d 100644 --- a/types/semantic-ui-sticky/global.d.ts +++ b/types/semantic-ui-sticky/global.d.ts @@ -24,6 +24,7 @@ declare namespace SemanticUI { namespace StickySettings { type Param = (Pick<_Impl, 'pushing'> | + Pick<_Impl, 'setSize'> | Pick<_Impl, 'jitter'> | Pick<_Impl, 'observeChanges'> | Pick<_Impl, 'context'> | @@ -55,6 +56,14 @@ declare namespace SemanticUI { * @default false */ pushing: boolean; + /** + * Sets size of fixed content to match its width before fixing to screen dynamically. + * This is used because fixed may display block or 100% width content differently than it appears before sticking. + * + * @default true + * @since 2.2.11 + */ + setSize: boolean; /** * Sticky container height will only be set if the difference between heights of container and context is larger than this jitter value. * diff --git a/types/semantic-ui-sticky/semantic-ui-sticky-tests.ts b/types/semantic-ui-sticky/semantic-ui-sticky-tests.ts index fefad8870a..8884b2c714 100644 --- a/types/semantic-ui-sticky/semantic-ui-sticky-tests.ts +++ b/types/semantic-ui-sticky/semantic-ui-sticky-tests.ts @@ -27,6 +27,7 @@ function test_sticky() { // $ExpectType JQuery $(selector).sticky({ pushing: false, + setSize: false, jitter: 4, observeChanges: true, context: $(), diff --git a/types/sinon-express-mock/sinon-express-mock-tests.ts b/types/sinon-express-mock/sinon-express-mock-tests.ts index 8e5c61a6b9..c48259b22d 100644 --- a/types/sinon-express-mock/sinon-express-mock-tests.ts +++ b/types/sinon-express-mock/sinon-express-mock-tests.ts @@ -1,5 +1,5 @@ import * as Sinon from "sinon"; -import {mockReq, mockRes} from "sinon-express-mock"; +import { mockReq, mockRes } from "sinon-express-mock"; const req = mockReq({}); const acceptStub: Sinon.SinonStub = req.accepts(); diff --git a/types/slack-winston/index.d.ts b/types/slack-winston/index.d.ts new file mode 100644 index 0000000000..b6f07788ad --- /dev/null +++ b/types/slack-winston/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for slack-winston 0.0 +// Project: https://github.com/niftylettuce/slack-winston +// Definitions by: Elliot Blackburn +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as winston from 'winston'; + +export interface SlackTransportOptions extends winston.WinstonModuleTransportOptions { + domain: string; + token: string; + webhook_url: string; + channel: string; + + username?: string; + icon_emoji?: string; + message?: string; + queueDelay?: number; +} + +export class Slack extends winston.Transport implements winston.TransportInstance { + constructor(options?: SlackTransportOptions); +} diff --git a/types/slack-winston/slack-winston-tests.ts b/types/slack-winston/slack-winston-tests.ts new file mode 100644 index 0000000000..c12071c07e --- /dev/null +++ b/types/slack-winston/slack-winston-tests.ts @@ -0,0 +1,13 @@ +import { Slack, SlackTransportOptions } from 'slack-winston'; + +const slackOptions: SlackTransportOptions = { + domain: "abc", + token: "abc", + webhook_url: "abc", + channel: "abc", + username: "abc", + icon_emoji: ":sparkles:", + level: 'alert', +}; + +const slackTransport = new Slack(slackOptions); diff --git a/types/slack-winston/tsconfig.json b/types/slack-winston/tsconfig.json new file mode 100644 index 0000000000..a45cbf2dc2 --- /dev/null +++ b/types/slack-winston/tsconfig.json @@ -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", + "slack-winston-tests.ts" + ] +} diff --git a/types/slack-winston/tslint.json b/types/slack-winston/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/slack-winston/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/snoowrap/dist/objects/Comment.d.ts b/types/snoowrap/dist/objects/Comment.d.ts new file mode 100644 index 0000000000..a7f5afe30d --- /dev/null +++ b/types/snoowrap/dist/objects/Comment.d.ts @@ -0,0 +1,20 @@ +import Listing from './Listing'; +import RedditUser from './RedditUser'; +import Subreddit from './Subreddit'; +import VoteableContent from './VoteableContent'; + +export default class Comment extends VoteableContent { + approved: boolean; + body_html: string; + body: string; + collapsed_reason: any; // ? + collapsed: boolean; + controversiality: number; + ignore_reports: boolean; + link_id: string; + parent_id: string; + removed: boolean; + replies: Listing; + score_hidden: boolean; + spam: boolean; +} diff --git a/types/snoowrap/dist/objects/Listing.d.ts b/types/snoowrap/dist/objects/Listing.d.ts new file mode 100644 index 0000000000..7c54ba92d5 --- /dev/null +++ b/types/snoowrap/dist/objects/Listing.d.ts @@ -0,0 +1,26 @@ +import * as Snoowrap from 'snoowrap'; + +export default class Listing extends Array { + constructor(options: any, _r: Snoowrap); + isFinished: boolean; + is_finished: boolean; + fetchMore(options: FetchMoreOptions): Listing; + fetchAll(options?: FetchMoreOptions): Listing; + /* @deprecated */ fetchUntil(options?: FetchMoreOptions): Listing; + toJSON(): T[]; +} + +export interface ListingOptions { + limit?: string; + after?: string; + before?: string; + show?: string; + count?: number; +} + +interface FetchMoreOptions { + amount: number; + skipReplies?: boolean; + skip_replies?: boolean; + append?: boolean; +} diff --git a/types/snoowrap/dist/objects/LiveThread.d.ts b/types/snoowrap/dist/objects/LiveThread.d.ts new file mode 100644 index 0000000000..ba34886fbb --- /dev/null +++ b/types/snoowrap/dist/objects/LiveThread.d.ts @@ -0,0 +1,81 @@ +/// + +import * as EventEmitter from 'events'; +import Listing, { ListingOptions } from './Listing'; +import RedditContent from './RedditContent'; +import RedditUser from './RedditUser'; +import Submission from './Submission'; + +export default class LiveThread extends RedditContent { + description_html: string; + description: string; + nsfw: boolean; + resources_html: string; + resources: string; + state: string; + stream: EventEmitter; + title: string; + viewer_count_fuzzed: number | null; + viewer_count: number | null; + websocket_url: string | null; + + acceptContributorInvite(): Promise; + addUpdate(body: string): Promise; + closeStream(): void; + closeThread(): Promise; + deleteUpdate(options: { id: string; }): Promise; + editSettings(options: LiveThreadSettings): Promise; + getContributors(): Promise; + getDiscussions(options?: ListingOptions): Listing; + getRecentUpdates(options?: ListingOptions): Listing; + inviteContributor(options: { name: string; permissions: Permissions[]}): Promise; + leaveContributor(): Promise; + removeContributor(options: { name: string; }): Promise; + report(options: { reason: ReportReason; }): Promise; + revokeContributorInvite(options: { name: string; }): Promise; + setContributorPermissions(options: { + name: string; + permissions: Permissions[]; + }): Promise; + strikeUpdate(options: { id: string; }): Promise; +} + +type Permissions = 'update' | 'edit' | 'manage'; +type ReportReason = 'spam' | 'vote-manipulation' | 'personal-information' | 'sexualizing-minors' | 'site-breaking'; + +export interface LiveThreadSettings { + title: string; + description?: string; + resources?: string; + nsfw?: boolean; +} + +interface LiveUpdate { + body: string; + name: string; + embeds: Embed[]; + mobile_embeds: MobileEmbed[]; + author: RedditUser; + created: number; + created_utc: number; + body_html: string; + stricken: boolean; + id: string; +} + +interface Embed { + url: string; + width: number; + height: number; +} + +interface MobileEmbed extends Embed { + provider_url: string; + original_url: string; + version: string; + provider_name: string; + type: string; + thumbnail_url: string; + thumbnail_height: number; + thumbnail_width: number; +} diff --git a/types/snoowrap/dist/objects/MultiReddit.d.ts b/types/snoowrap/dist/objects/MultiReddit.d.ts new file mode 100644 index 0000000000..88dca3c9c8 --- /dev/null +++ b/types/snoowrap/dist/objects/MultiReddit.d.ts @@ -0,0 +1,42 @@ +import RedditUser from './RedditUser'; +import RedditContent from './RedditContent'; +import Subreddit from './Subreddit'; + +export default class MultiReddit extends RedditContent { + can_edit: boolean; + copied_from: string | null; + curator: RedditUser; + description_html: string; + description_md: string; + display_name: string; + icon_name: MultiRedditIcon; + icon_url: string | null; + key_color: string; + path: string; + subreddits: Subreddit[]; + visibility: MultiRedditVisibility; + weighting_schema: MultiRedditWeightingSchema; + + addSubreddit(sub: Subreddit | string): Promise; + copy(options: { newName: string; }): Promise; + delete(): Promise; + edit(options: MultiRedditProperties): Promise; + removeSubreddit(sub: Subreddit | string): Promise; + rename(options: { newName: string; }): Promise; +} + +export interface MultiRedditProperties { + name?: string; + description?: string; + visibility?: MultiRedditVisibility; + icon_name?: MultiRedditIcon; + key_color?: string; + weighting_scheme?: MultiRedditWeightingSchema; +} + +type MultiRedditWeightingSchema = 'classic' | 'fresh'; +type MultiRedditVisibility = 'private' | 'public' | 'hidden'; +type MultiRedditIcon = 'art and design' | 'ask' | 'books' | 'business' | 'cars' | 'comics' | 'cute animals' | + 'diy' | 'entertainment' | 'food and drink' | 'funny' | 'games' | 'grooming' | 'health' | 'life advice' | + 'military' | 'models pinup' | 'music' | 'news' | 'philosophy' | 'pictures and gifs' | 'science' | 'shopping' | + 'sports' | 'style' | 'tech' | 'travel' | 'unusual stories' | 'video'; diff --git a/types/snoowrap/dist/objects/PrivateMessage.d.ts b/types/snoowrap/dist/objects/PrivateMessage.d.ts new file mode 100644 index 0000000000..0150bbec34 --- /dev/null +++ b/types/snoowrap/dist/objects/PrivateMessage.d.ts @@ -0,0 +1,31 @@ +import Listing from './Listing'; +import RedditUser from './RedditUser'; +import ReplyableContent from './ReplyableContent'; +import Subreddit from './Subreddit'; + +export default class PrivateMessage extends ReplyableContent { + author: RedditUser; + body_html: string; + body: string; + context: string; + dest: string; + distinguished: string | null; + first_message_name: string; + first_message: number; + likes: any; // ? + new: boolean; + num_comments: number; + parent_id: string; + replies: Listing; + score: number; + subject: string; + subreddit_name_prefixed: string; + subreddit: Subreddit; + was_comment: boolean; + + deleteFromInbox(): Promise; + markAsRead(): Promise; + markAsUnread(): Promise; + muteAuthor(): Promise; + unmuteAuthor(): Promise; +} diff --git a/types/snoowrap/dist/objects/RedditContent.d.ts b/types/snoowrap/dist/objects/RedditContent.d.ts new file mode 100644 index 0000000000..357226e57f --- /dev/null +++ b/types/snoowrap/dist/objects/RedditContent.d.ts @@ -0,0 +1,13 @@ +import * as Snoowrap from 'snoowrap'; + +export default class RedditContent { + created_utc: number; + created: number; + id: string; + name: string; + + constructor(options: any, _r: Snoowrap, _hasFetched: boolean); + fetch(): Promise; + refresh(): Promise; + toJSON(): T; +} diff --git a/types/snoowrap/dist/objects/RedditUser.d.ts b/types/snoowrap/dist/objects/RedditUser.d.ts new file mode 100644 index 0000000000..b9fc512c0c --- /dev/null +++ b/types/snoowrap/dist/objects/RedditUser.d.ts @@ -0,0 +1,122 @@ +import Comment from './Comment'; +import Listing from './Listing'; +import MultiReddit from './MultiReddit'; +import RedditContent from './RedditContent'; +import Submission from './Submission'; +import Subreddit from './Subreddit'; + +export default class RedditUser extends RedditContent { + comment_karma: number; + features?: Features; // this seems to only be returned for your own user + gold_creddits: number; + gold_expiration: number | null; + has_mail: boolean; + has_mod_mail: boolean; + has_subscribed: boolean; + has_verified_email: boolean; + hide_from_robots: boolean; + in_beta: boolean; + inbox_count: number; + is_employee: boolean; + is_friend: boolean; + is_gold: boolean; + is_mod: boolean; + is_sponsor: boolean; + is_suspended: boolean; + link_karma: number; + modhash: string | null; + new_modmail_exists: boolean; + over_18: boolean; + pref_no_profanity: boolean; + pref_show_snoovatar: boolean; + pref_top_karma_subreddits: any; // ? + subreddit: Subreddit | null; + suspension_expiration_utc: number | null; + verified: boolean; + + assignFlair(options: any): Promise; + friend(options: any): Promise; + getComments(options?: any): Listing; + getDownvotedContent(options?: any): Listing; + getFriendInformation(): Promise; + getGildedContent(options?: any): Listing; + getHiddenContent(options?: any): Listing; + getMultireddit(name: string): MultiReddit; + getMultireddits(): Promise; + getOverview(options?: any): Listing; + getSavedContent(options?: any): Listing; + getSubmissions(options?: any): Listing; + getTrophies(): Promise; + getUpvotedContent(options?: any): Listing; + giveGold(months: string): Promise; + unfriend(): Promise; +} + +interface Features { + do_not_track: boolean; + show_amp_link: boolean; + live_happening_now: boolean; + adserver_reporting: boolean; + geopopular: boolean; + legacy_search_pref: boolean; + listing_service_rampup: boolean; + mobile_web_targeting: boolean; + default_srs_holdout: ExperimentFeature; + geopopular_ie: ExperimentFeature; + users_listing: boolean; + show_user_sr_name: boolean; + whitelisted_pms: boolean; + sticky_comments: boolean; + upgrade_cookies: boolean; + ads_prefs: boolean; + new_report_flow: boolean; + block_user_by_report: boolean; + ads_auto_refund: boolean; + orangereds_as_emails: boolean; + mweb_xpromo_modal_listing_click_daily_dismissible_ios: boolean; + adzerk_do_not_track: boolean; + expando_events: boolean; + eu_cookie_policy: boolean; + utm_comment_links: boolean; + force_https: boolean; + activity_service_write: boolean; + pokemongo_content: ExperimentFeature; + post_to_profile_beta: boolean; + reddituploads_redirect: boolean; + outbound_clicktracking: boolean; + new_loggedin_cache_policy: boolean; + inbox_push: boolean; + https_redirect: boolean; + search_dark_traffic: boolean; + mweb_xpromo_interstitial_comments_ios: boolean; + live_orangereds: boolean; + programmatic_ads: boolean; + give_hsts_grants: boolean; + pause_ads: boolean; + show_recommended_link: boolean; + mweb_xpromo_interstitial_comments_android: boolean; + ads_auction: boolean; + screenview_events: boolean; + new_report_dialog: boolean; + moat_tracking: boolean; + subreddit_rules: boolean; + mobile_settings: boolean; + adzerk_reporting_2: boolean; + mobile_native_banner: boolean; + ads_auto_extend: boolean; + interest_targeting: boolean; + post_embed: boolean; + seo_comments_page_holdout: ExperimentFeature; + scroll_events: boolean; + mweb_xpromo_modal_listing_click_daily_dismissible_android: boolean; + '302_to_canonicals': boolean; + activity_service_read: boolean; + adblock_test: boolean; + geopopular_in: ExperimentFeature; +} + +interface ExperimentFeature { + owner: string; + variant: string; + experiment_id: number; +} diff --git a/types/snoowrap/dist/objects/ReplyableContent.d.ts b/types/snoowrap/dist/objects/ReplyableContent.d.ts new file mode 100644 index 0000000000..88b9d36ee0 --- /dev/null +++ b/types/snoowrap/dist/objects/ReplyableContent.d.ts @@ -0,0 +1,11 @@ +import RedditContent from './RedditContent'; + +export default class ReplyableContent extends RedditContent { + approve(): Promise; + blockAuthor(): Promise; + ignoreReports(): Promise; + remove(options?: { spam?: boolean }): Promise; + reply(text: string): Promise>; + report(options?: { reason?: string }): Promise; + unignoreReports(): Promise; +} diff --git a/types/snoowrap/dist/objects/Submission.d.ts b/types/snoowrap/dist/objects/Submission.d.ts new file mode 100644 index 0000000000..397799b88e --- /dev/null +++ b/types/snoowrap/dist/objects/Submission.d.ts @@ -0,0 +1,75 @@ +import { Sort } from 'snoowrap'; +import Comment from './Comment'; +import Listing, { ListingOptions } from './Listing'; +import RedditUser from './RedditUser'; +import Subreddit, { FlairTemplate } from './Subreddit'; +import VoteableContent from './VoteableContent'; + +export default class Submission extends VoteableContent { + brand_safe: boolean; + clicked: boolean; + comments: Listing; + domain: string; + hidden: boolean; + hide_score: boolean; + is_self: boolean; + is_video: boolean; + link_flair_css_class: string | null; + link_flair_text: string | null; + locked: boolean; + media_embed: any; // ? + media: any; // ? + num_comments: number; + over_18: boolean; + permalink: string; + post_hint: string; + preview: { enabled: boolean; images: ImagePreview[] }; + quarantine: boolean; + removal_reason: string | null; + secure_media_embed: any; // ? + secure_media: any; // ? + selftext_html: string; + selftext: string; + spoiler: boolean; + suggested_sort: Sort; + thumbnail_height: number | null; + thumbnail: string; + title: string; + upvote_ratio: number; + url: string; + view_count: number | null; + visited: boolean; + + assignFlair(options: { text: string; cssClass: string; }): Promise; + disableContestMode(): Promise; + enableContestMode(): Promise; + getDuplicates(options?: ListingOptions): Listing; + getLinkFlairTemplates(): Promise; + /* @deprecated */ getRelated(options?: ListingOptions): Submission; + hide(): Promise; + lock(): Promise; + markAsRead(): Promise; + markNsfw(): Promise; + markSpoiler(): Promise; + selectFlair(options: { flair_template_id: string; text?: string; }): Promise; + setSuggestedSort(sort: Sort): Promise; + sticky(options?: { num?: number }): Promise; + unhide(): Promise; + unlock(): Promise; + unmarkNsfw(): Promise; + unmarkSpoiler(): Promise; + unsticky(): Promise; +} + +interface ImagePreviewSource { + url: string; + width: number; + height: number; +} + +interface ImagePreview { + source: ImagePreviewSource; + resolutions: ImagePreviewSource[]; + variants: any; // ? + id: string; +} diff --git a/types/snoowrap/dist/objects/Subreddit.d.ts b/types/snoowrap/dist/objects/Subreddit.d.ts new file mode 100644 index 0000000000..6864b15b59 --- /dev/null +++ b/types/snoowrap/dist/objects/Subreddit.d.ts @@ -0,0 +1,280 @@ +import { Sort, ModAction, SubmitSelfPostOptions, SubmitLinkOptions, BaseSearchOptions } from 'snoowrap'; +import Comment from './Comment'; +import Listing, { ListingOptions } from './Listing'; +import PrivateMessage from './PrivateMessage'; +import RedditContent from './RedditContent'; +import RedditUser from './RedditUser'; +import Submission from './Submission'; +import WikiPage, { WikiPageRevision } from './WikiPage'; + +export default class Subreddit extends RedditContent { + accounts_active_is_fuzzed: boolean; + accounts_active: number; + active_user_count: number; + advertiser_category: string | null; + allow_images: boolean; + banner_img: string; + banner_size: [number, number] | null; + collapse_deleted_comments: boolean; + comment_score_hide_mins: number; + description_html: string; + description: string; + display_name_prefixed: string; + display_name: string; + header_img: string; + header_size: [number, number] | null; + header_title: string | null; + hide_ads: boolean; + icon_img: string; + icon_size: [number, number] | null; + key_color: string; + lang: string; + over18: boolean; + public_description_html: string; + public_description: string; + public_traffic: boolean; + quarantine: boolean; + show_media_preview: boolean; + show_media: boolean; + spoilers_enabled: boolean; + submission_type: LinkType; + submit_link_label: string | null; + submit_text_html: string; + submit_text_label: string | null; + submit_text: string; + subreddit_type: SubredditType; + subscribers: number; + suggested_comment_sort: Sort | null; + title: string; + url: string; + user_is_banned: boolean; + user_is_contributor: boolean; + user_is_moderator: boolean; + user_is_muted: boolean; + user_is_subscriber: boolean; + user_sr_theme_enabled: boolean; + whitelist_status: string; + wiki_enabled: boolean; + + acceptModeratorInvite(): Promise; + addContributor(options: { name: string; }): Promise; + addWikiContributor(options: { name: string; }): Promise; + banUser(options: BanOptions): Promise; + configureFlair(options: FlairConfig): Promise; + createLinkFlairTemplate(options: FlairParams): Promise; + createUserFlairTemplate(options: FlairParams): Promise; + deleteAllLinkFlairTemplates(): Promise; + deleteAllUserFlairTemplates(): Promise; + deleteBanner(): Promise; + deleteFlairTemplate(options: { flair_template_id: string; }): Promise; + deleteHeader(): Promise; + deleteIcon(): Promise; + deleteImage(options: { imageName: string; }): Promise; + deleteUserFlair(name: string): Promise; + editSettings(options: SubredditSettings): Promise; + getBannedUsers(options?: ListingOptions & { name?: string }): Listing; + getContributors(options?: ListingOptions & { name?: string }): Listing; + getControversial(options?: ListingOptions & { time?: string }): Listing; + getEdited(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getHot(options?: ListingOptions): Listing; + getLinkFlairTemplates(linkId: string): Promise; + getModerationLog(opts?: ListingOptions & { mods?: string[]; type?: ModActionType}): Listing; + getModerators(options?: ListingOptions & { name?: string }): RedditUser[]; + getModmail(options?: ListingOptions): Listing; + getModqueue(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getMutedUsers(options?: ListingOptions & { name?: string }): Listing; + getMyFlair(): Promise; + getNew(options?: ListingOptions): Listing; + getNewComments(options?: ListingOptions): Listing; + getRandomSubmission(): Promise; + getRecommendedSubreddits(options?: { omit?: string[]; }): Promise; + getReports(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getRising(options?: ListingOptions): Listing; + getRules(): Promise<{ rules: Rule[]; site_rules: string[] }>; + getSettings(): Promise; + getSpam(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getSticky(options?: { num?: number }): Promise; + getStylesheet(): Promise; + getSubmitText(): Promise; + getTop(options?: ListingOptions & { time?: Timespan }): Listing; + getUnmoderated(options?: ListingOptions & { only?: 'links' | 'comments' }): Listing; + getUserFlair(name: string): Promise; + getUserFlairList(options?: ListingOptions & { name?: string; }): Listing; + getUserFlairTemplates(): Promise; + getWikiBannedUsers(options?: ListingOptions & { name?: string }): Listing; + getWikiContributors(options?: ListingOptions & { name?: string }): Listing; + getWikiPage(name: string): WikiPage; + getWikiPages(): Promise; + getWikiRevisions(options?: ListingOptions): Listing; + hideMyFlair(): Promise; + inviteModerator(options: { name: string; permissions?: ModeratorPermission[]; }): Promise; + leaveContributor(): Promise; + leaveModerator(): Promise; + muteUser(options: { name: string; }): Promise; + removeContributor(options: { name: string; }): Promise; + removeModerator(options: { name: string; }): Promise; + removeWikiContributor(options: { name: string; }): Promise; + revokeModeratorInvite(options: { name: string; }): Promise; + search(options: BaseSearchOptions): Listing; + selectMyFlair(options: { flair_template_id: string; text?: string; }): Promise; + setModeratorPermissions(options: { name: string; permissions: ModeratorPermission; }): Promise; + setMultipleUserFlairs(flairs: Array<{ + name: string; + text: string; + cssClass: string; + }>): Promise; + showMyFlair(): Promise; + submitLink(options: SubmitLinkOptions): Promise; + submitSelfPost(options: SubmitSelfPostOptions): Promise; + subscribe(): Promise; + unbanUser(options: { name: string; }): Promise; + unmuteUser(options: { name: string; }): Promise; + unsubscribe(): Promise; + unwikibanUser(options: { name: string; }): Promise; + updateStylesheet(options: { css: string; reason?: string; }): Promise; + uploadBannerImage(options: ImageUploadOptions): Promise; + uploadHeaderImage(options: ImageUploadOptions): Promise; + uploadIcon(options: ImageUploadOptions): Promise; + uploadStylesheetImage(options: ImageUploadOptions & { name: string; }): Promise; + wikibanUser(options: { name: string; }): Promise; +} + +// this is per-flair +interface FlairParams { + text: string; + cssClass?: string; + textEditable?: boolean; +} + +// this is for the entire subreddit +interface FlairConfig { + userFlairEnabled: boolean; + userFlairPosition: 'left' | 'right'; + userFlairSelfAssignEnabled: boolean; + linkFlairPosition: 'left' | 'right'; + linkFlairSelfAssignEnabled: boolean; +} + +export interface FlairTemplate { + flair_css_class: string; + flair_template_id: string; + flair_text_editable: string; + flair_position: string; + flair_text: string; +} + +interface UserFlair { + flair_css_class: string; + user: string; + flair_text: string; +} + +interface UserDetails { + date: number; + name: string; + id: string; +} +type BannedUser = UserDetails & { note: string; }; +type MutedUser = UserDetails; +type Contributor = UserDetails; + +type SubredditType = 'public' | 'private' | 'restricted' | 'gold_restricted' | 'gold_only' | 'archived' | 'employees_only'; +type LinkType = 'any' | 'link' | 'self'; + +type SpamLevel = 'low' | 'high' | 'all'; +export interface SubredditSettings { + name: string; + title: string; + public_description: string; + description: string; + submit_text?: string; + hide_ads?: boolean; + lang?: string; + type?: SubredditType; + link_type?: LinkType; + submit_link_label?: string; + submit_text_label?: string; + wikimode?: 'modonly' | 'anyone' | 'disabled'; + wiki_edit_karma?: number; + wiki_edit_age?: number; + spam_links?: SpamLevel; + spam_selfposts?: SpamLevel; + spam_comments?: SpamLevel; + over_18?: boolean; + allow_top?: boolean; + show_media?: boolean; + exclude_banned_modqueue?: boolean; + public_traffic?: boolean; + collapse_deleted_comments?: boolean; + suggested_comment_sort?: Sort; // TODO rename AvailableSorts? + spoilers_enabled?: boolean; +} + +interface ImageUploadOptions { + file: string | ReadableStream; + imageType?: string; +} + +interface Rule { + kind: string; + short_name: string; + description: string; + violation_reason: string; + created_utc: string; + priority: number; + description_html: string; +} + +type ModeratorPermission = 'wiki' | 'posts' | 'access' | 'mail' | 'config' | 'flair'; + +interface BanOptions { + name: string; + banMessage?: string; + banReason?: string; + duration?: number; + banNote?: string; +} + +type Timespan = 'hour' | 'day' | 'week' | 'month' | 'year' | 'all'; + +export type ModActionType = 'banuser' | + 'unbanuser' | + 'removelink' | + 'approvelink' | + 'removecomment' | + 'approvecomment' | + 'addmoderator' | + 'invitemoderator' | + 'uninvitemoderator' | + 'acceptmoderatorinvite' | + 'removemoderator' | + 'addcontributor' | + 'removecontributor' | + 'editsettings' | + 'editflair' | + 'distinguish' | + 'marknsfw' | + 'wikibanned' | + 'wikicontributor' | + 'wikiunbanned' | + 'wikipagelisted' | + 'removewikicontributor' | + 'wikirevise' | + 'wikipermlevel' | + 'ignorereports' | + 'unignorereports' | + 'setpermissions' | + 'setsuggestedsort' | + 'sticky' | + 'unsticky' | + 'setcontestmode' | + 'unsetcontestmode' | + 'lock' | + 'unlock' | + 'muteuser' | + 'unmuteuser' | + 'createrule' | + 'editrule' | + 'deleterule' | + 'spoiler' | + 'unspoiler'; diff --git a/types/snoowrap/dist/objects/VoteableContent.d.ts b/types/snoowrap/dist/objects/VoteableContent.d.ts new file mode 100644 index 0000000000..704397b49a --- /dev/null +++ b/types/snoowrap/dist/objects/VoteableContent.d.ts @@ -0,0 +1,46 @@ +import RedditUser from './RedditUser'; +import ReplyableContent from './ReplyableContent'; +import Subreddit from './Subreddit'; + +export default class VoteableContent extends ReplyableContent { + approved_at_utc: number | null; + approved_by: RedditUser | null; + archived: boolean; + author_flair_css_class: string | null; + author_flair_text: string | null; + author: RedditUser; + banned_at_utc: number | null; + banned_by: RedditUser | null; + can_gild: boolean; + can_mod_post: boolean; + distinguished: string | null; + downs: number; + edited: number | boolean; + gilded: number; + likes: any; // ? + mod_reports: string[]; + num_reports: number; + report_reasons: string[]; + saved: boolean; + score: number; + stickied: boolean; + subreddit_name_prefixed: string; + subreddit_type: string; + subreddit: Subreddit; + ups: number; + user_reports: string[]; + + delete(): Promise; + disableInboxReplies(): Promise; + distinguish(options?: { status?: boolean | string; sticky?: boolean; }): Promise; + downvote(): Promise; + edit(updatedText: string): Promise; + enableInboxReplies(): Promise; + expandReplies(options?: { limit?: number; depth?: number; }): Promise; + gild(): Promise; + save(): Promise; + undistinguish(): Promise; + unsave(): Promise; + unvote(): Promise; + upvote(): Promise; +} diff --git a/types/snoowrap/dist/objects/WikiPage.d.ts b/types/snoowrap/dist/objects/WikiPage.d.ts new file mode 100644 index 0000000000..ab9de1bdf6 --- /dev/null +++ b/types/snoowrap/dist/objects/WikiPage.d.ts @@ -0,0 +1,41 @@ +import Listing, { ListingOptions } from './Listing'; +import RedditContent from './RedditContent'; +import RedditUser from './RedditUser'; +import Submission from './Submission'; + +export default class WikiPage extends RedditContent { + content_html: string; + content_md: string; + may_revise: boolean; + revision_by: RedditUser; + revision_date: number; + + addEditor(options: { name: string; }): Promise; + edit(options: EditOptions): Promise; + editSettings(options: Settings): Promise; + getDiscussions(options?: ListingOptions): Listing; + getRevisions(options?: ListingOptions): Listing; + getSettings(): Promise; + hideRevision(options: { id: string; }): Promise; + removeEditor(options: { name: string; }): Promise; + revert(options: { id: string; }): Promise; +} + +interface Settings { + listed: boolean; + permissionLevel: 0 | 1 | 2; +} + +interface EditOptions { + text: string; + reason?: string; + perviousRevision?: string; +} + +export interface WikiPageRevision { + timestamp: number; + reason: string; + page: string; + id: string; + author: RedditUser; +} diff --git a/types/snoowrap/dist/objects/index.d.ts b/types/snoowrap/dist/objects/index.d.ts new file mode 100644 index 0000000000..b2eaf33a32 --- /dev/null +++ b/types/snoowrap/dist/objects/index.d.ts @@ -0,0 +1,12 @@ +export { default as Comment } from './Comment'; +export { default as Listing, ListingOptions } from './Listing'; +export { default as LiveThread, LiveThreadSettings } from './LiveThread'; +export { default as MultiReddit, MultiRedditProperties } from './MultiReddit'; +export { default as PrivateMessage } from './PrivateMessage'; +export { default as RedditContent } from './RedditContent'; +export { default as RedditUser } from './RedditUser'; +export { default as ReplyableContent } from './ReplyableContent'; +export { default as Submission } from './Submission'; +export { default as Subreddit, SubredditSettings } from './Subreddit'; +export { default as VoteableContent } from './VoteableContent'; +export { default as WikiPage } from './WikiPage'; diff --git a/types/snoowrap/index.d.ts b/types/snoowrap/index.d.ts new file mode 100644 index 0000000000..05dfc821fd --- /dev/null +++ b/types/snoowrap/index.d.ts @@ -0,0 +1,230 @@ +// Type definitions for snoowrap 1.14 +// Project: https://github.com/not-an-aardvark/snoowrap +// Definitions by: Vito Samson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { CoreOptions as RequestOptions } from 'request'; + +import { + Comment as _Comment, + Listing as _Listing, + ListingOptions, + LiveThread as _LiveThread, + LiveThreadSettings, + MultiReddit as _MultiReddit, + MultiRedditProperties, + PrivateMessage as _PrivateMessage, + RedditContent as _RedditContent, + RedditUser as _RedditUser, + ReplyableContent as _ReplyableContent, + Submission as _Submission, + Subreddit as _Subreddit, + SubredditSettings, + VoteableContent as _VoteableContent, + WikiPage as _WikiPage, +} from './dist/objects'; + +export = Snoowrap; + +declare class Snoowrap { + static getAuthUrl(options: Snoowrap.AuthUrlOptions): string; + static fromAuthCode(options: Snoowrap.AuthCodeOptions): Snoowrap; + static noConflict(): typeof Snoowrap; + + accessToken: string; + clientId: string; + clientSecret: string; + password: string; + ratelimitExpiration: number; + ratelimitRemaining: number; + refreshToken: string; + scope: string[]; + tokenExpiration: number; + userAgent: string; + username: string; + + constructor(options: Snoowrap.SnoowrapOptions); + checkCaptchaRequirement(): Promise; + checkUsernameAvailability(name: string): Promise; + composeMessage(options: Snoowrap.ComposeMessageParams): Promise; + config(opts: Snoowrap.ConfigOptions): Snoowrap.ConfigOptions; + createLivethread(options: LiveThreadSettings): Promise<_LiveThread>; + createMultireddit(options: MultiRedditProperties & { name: string; subreddits: _Subreddit[] | string[]}): Promise<_MultiReddit>; + createSubreddit(options: SubredditSettings): Promise<_Subreddit>; + credentialedClientRequest(options?: RequestOptions): Promise; + getBlockedUsers(): Promise<_RedditUser[]>; + getCaptchaImage(identifier: string): Promise; + getComment(commentId: string): _Comment; + getContributorSubreddits(options?: ListingOptions): _Listing<_Subreddit>; + getControversial(subredditName?: string, options?: ListingOptions): _Listing<_Submission>; + getDefaultSubreddits(options?: ListingOptions): _Listing<_Subreddit>; + getFriends(): Promise<_RedditUser[]>; + getGoldSubreddits(options?: ListingOptions): _Listing<_Subreddit>; + getHot(subredditName?: string, options?: ListingOptions): _Listing<_Submission>; + getInbox(options?: { filter?: string }): _Listing<_PrivateMessage | Comment>; + getKarma(): Promise>; + getLivethread(threadId: string): _LiveThread; + getMe(): _RedditUser; + getMessage(messageId: string): _PrivateMessage; + getModeratedSubreddits(options?: ListingOptions): _Listing<_Subreddit>; + getModmail(options?: ListingOptions): _Listing<_PrivateMessage>; + getMyMultireddits(): Promise<_MultiReddit[]>; + getMyTrophies(): Promise; + getNew(subredditName?: string, options?: ListingOptions): _Listing<_Submission>; + getNewCaptchaIdentifier(): Promise; + getNewComments(subredditName?: string, options?: ListingOptions): _Listing; + getNewSubreddits(options?: ListingOptions): _Listing<_Subreddit>; + getOauthScopeList(): Promise<{ [key: string]: { description: string; id: string; name: string } }>; + getPopularSubreddit(options?: ListingOptions): _Listing<_Subreddit>; + getPreferences(): Promise; + getRandomSubmission(subredditName?: string): _Submission; + getRising(subredditName?: string, options?: ListingOptions): _Listing<_Submission>; + getSavedCategories(): Promise; + getSentMessages(options?: ListingOptions): _Listing<_PrivateMessage>; + getStickiedLivethread(): Promise<_LiveThread | undefined>; + getSubmission(submissionId: string): _Submission; + getSubreddit(displayName: string): _Subreddit; + getSubscriptions(options?: ListingOptions): _Listing<_Subreddit>; + getTop(subredditName?: string, options?: ListingOptions): _Listing<_Submission>; + getUnreadMessages(options?: ListingOptions): _Listing<_PrivateMessage>; + getUser(name: string): _RedditUser; + markAsVisited(links: _Submission[]): Promise; + markMessagesAsRead(messages: _PrivateMessage[] | string[]): Promise; + markMessagesAsUnread(messages: _PrivateMessage[] | string[]): Promise; + oauthRequest(options: RequestOptions): Promise; + rawRequest(options: RequestOptions): Promise; + readAllMessages(): Promise; + revokeRefreshToken(): Promise; + search(options: Snoowrap.SearchOptions): _Listing<_Submission>; + searchSubredditNames(options: { query: string; exact?: boolean; includeNsfw?: boolean; }): Promise; + searchSubreddits(options: ListingOptions & { query: string }): _Listing<_Subreddit>; + searchSubredditTopics(options: { filter: string; }): Promise<_Subreddit[]>; + submitLink(options: Snoowrap.SubmitLinkOptions): Promise<_Submission>; + submitSelfpost(options: Snoowrap.SubmitSelfPostOptions): Promise<_Submission>; + unauthenticatedRequest(options: RequestOptions): Promise; // options: https://www.npmjs.com/package/request + updateAccessToken(): Promise; + updatePreferences(updatedPreferences: any): Promise; +} + +declare namespace Snoowrap { + export interface SnoowrapOptions { + userAgent: string; + clientId?: string; + clientSecret?: string; + username?: string; + password?: string; + refreshToken?: string; + accessToken?: string; + } + + export interface ConfigOptions { + endpointDomain?: string; + requestDelay?: number; + requestTimeout?: number; + continueAfterRatelimitError?: boolean; + retryErrorCodes?: number[]; + maxRetryAttempts?: number; + warnings?: boolean; + debug?: boolean; + proxies?: boolean; + } + + export interface AuthUrlOptions { + clientId: string; + scope: string[]; + redirectUri: string; + permanent?: boolean; // defaults to true + state?: string; + endpointDomain?: string; + } + + export interface AuthCodeOptions { + code: string; + userAgent: string; + clientId: string; + clientSecret?: string; + redirectUri: string; + endpointDomain?: string; + } + + export type Sort = 'confidence' | 'top' | 'new' | 'controversial' | 'old' | 'random' | 'qa'; + + export interface ModAction extends RedditContent { + target_body: string; + mod_id36: string; + created_utc: number; + subreddit: Subreddit; + target_title: string | null; + target_permalink: string; + subreddit_name_prefixed: string; + details: string | null; + action: string; + target_author: string; + target_fullname: string; + sr_id36: string; + id: string; + mod: string; + description: string | null; + } + + export interface SubmitSelfPostOptions { + text?: string; + subredditName: string; + title: string; + sendReplies?: boolean; + captchaIden?: string; + captchaResponse?: string; + } + + export interface SubmitLinkOptions { + url: string; + resubmit?: boolean; + } + + export interface ComposeMessageParams { + to: RedditUser | Subreddit | string; + subject: string; + text: string; + fromSubreddit?: Subreddit | string; + captchaIden?: string; + captchaResponse?: string; + } + + export interface BaseSearchOptions { + query: string; + time?: 'hour' | 'day' | 'week' | 'month' | 'year' | 'all'; + sort?: 'relevance' | 'hot' | 'top' | 'new' | 'comments'; + syntax?: 'cloudsearch' | 'lucene' | 'plain'; + } + + export interface SearchOptions extends BaseSearchOptions { + subreddit?: Subreddit | string; + restrictSr?: boolean; + } + + export interface Trophy { + icon_70: string; + icon_40: string; + name: string; + url: string; + award_id: string; + id: string; + description: string; + } + + export { + _Comment as Comment, + _Listing as Listing, + _LiveThread as LiveThread, + _MultiReddit as MultiReddit, + _PrivateMessage as PrivateMessage, + _RedditContent as RedditContent, + _RedditUser as RedditUser, + _ReplyableContent as ReplyableContent, + _Submission as Submission, + _Subreddit as Subreddit, + _VoteableContent as VoteableContent, + _WikiPage as WikiPage, + }; +} diff --git a/types/snoowrap/snoowrap-tests.ts b/types/snoowrap/snoowrap-tests.ts new file mode 100644 index 0000000000..7c0588372c --- /dev/null +++ b/types/snoowrap/snoowrap-tests.ts @@ -0,0 +1,47 @@ +import * as Snoowrap from 'snoowrap'; +import { + Comment, + LiveThread, + MultiReddit, + PrivateMessage, + RedditUser, + Submission, + Subreddit, + WikiPage, +} from 'snoowrap'; + +const r = new Snoowrap({ + userAgent: 'foo', +}); + +export function comment(id: string): Comment { + return r.getComment(id); +} + +export function liveThread(id: string): LiveThread { + return r.getLivethread(id); +} + +export function multireddits(username: string): Promise { + return r.getUser(username).getMultireddits(); +} + +export function pm(id: string): PrivateMessage { + return r.getMessage(id); +} + +export function user(username: string): RedditUser { + return r.getUser(username); +} + +export function submission(id: string): Promise { + return r.getSubmission(id).fetch(); +} + +export function subreddit(name: string): Subreddit { + return r.getSubreddit(name); +} + +export function wiki(subreddit: string, page: string): WikiPage { + return r.getSubreddit(subreddit).getWikiPage(page); +} diff --git a/types/snoowrap/tsconfig.json b/types/snoowrap/tsconfig.json new file mode 100644 index 0000000000..d3e20c2063 --- /dev/null +++ b/types/snoowrap/tsconfig.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "noUnusedLocals": true + }, + "files": [ + "index.d.ts", + "dist/objects/Comment.d.ts", + "dist/objects/index.d.ts", + "dist/objects/Listing.d.ts", + "dist/objects/LiveThread.d.ts", + "dist/objects/MultiReddit.d.ts", + "dist/objects/PrivateMessage.d.ts", + "dist/objects/RedditContent.d.ts", + "dist/objects/RedditUser.d.ts", + "dist/objects/ReplyableContent.d.ts", + "dist/objects/Submission.d.ts", + "dist/objects/Subreddit.d.ts", + "dist/objects/VoteableContent.d.ts", + "dist/objects/WikiPage.d.ts", + "snoowrap-tests.ts" + ] +} diff --git a/types/snoowrap/tslint.json b/types/snoowrap/tslint.json new file mode 100644 index 0000000000..99ea174f67 --- /dev/null +++ b/types/snoowrap/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "strict-export-declare-modifiers": false + } +} diff --git a/types/stream-meter/index.d.ts b/types/stream-meter/index.d.ts index 37d5f315c6..ed095c6320 100644 --- a/types/stream-meter/index.d.ts +++ b/types/stream-meter/index.d.ts @@ -5,7 +5,7 @@ /// -import {Transform} from 'stream'; +import { Transform } from 'stream'; declare function m(maxBytes?: number): m.StreamMeter; diff --git a/types/supercluster/supercluster-tests.ts b/types/supercluster/supercluster-tests.ts index 267d2df4fd..36993be0c2 100644 --- a/types/supercluster/supercluster-tests.ts +++ b/types/supercluster/supercluster-tests.ts @@ -1,5 +1,5 @@ import * as supercluster from 'supercluster'; -import {Point} from 'supercluster'; +import { Point } from 'supercluster'; const point1: Point = { type: 'Feature', diff --git a/types/swagger-express-middleware/index.d.ts b/types/swagger-express-middleware/index.d.ts index a782fee0d1..f6449f8485 100644 --- a/types/swagger-express-middleware/index.d.ts +++ b/types/swagger-express-middleware/index.d.ts @@ -29,7 +29,7 @@ app.listen(8000, function () { /// declare module "swagger-express-middleware" { - import {Application, Router, RequestHandler, Request, Response} from "express"; + import { Application, Router, RequestHandler, Request, Response } from "express"; let s: s.SwaggerMiddlewareConstructor; diff --git a/types/swagger-parser/swagger-parser-tests.ts b/types/swagger-parser/swagger-parser-tests.ts index f880c801b2..2fee32a9fa 100644 --- a/types/swagger-parser/swagger-parser-tests.ts +++ b/types/swagger-parser/swagger-parser-tests.ts @@ -1,5 +1,5 @@ import parser = require("swagger-parser"); -import { Spec as Swagger } from '../swagger-schema-official'; +import { Spec as Swagger } from "swagger-schema-official"; const swaggerMock: Swagger = { swagger: '', @@ -8,7 +8,7 @@ const swaggerMock: Swagger = { version: '' }, paths: { '': {} } -} +}; // Without callback which returns a promise parser.parse("test.yaml").then((file) => { diff --git a/types/switchery/switchery-tests.ts b/types/switchery/switchery-tests.ts index b1894ef2db..56a637fc50 100644 --- a/types/switchery/switchery-tests.ts +++ b/types/switchery/switchery-tests.ts @@ -1,7 +1,7 @@ // // Examples from https://github.com/abpetkov/switchery // -import {default as Switchery} from "switchery"; +import { default as Switchery } from "switchery"; function multipleSwitches() { diff --git a/types/three/three-ddsloader.d.ts b/types/three/three-ddsloader.d.ts index 8d8f85bd0e..0eff951f82 100644 --- a/types/three/three-ddsloader.d.ts +++ b/types/three/three-ddsloader.d.ts @@ -1,6 +1,6 @@ // https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js -import {CompressedPixelFormat, CompressedTextureLoader} from "./three-core"; +import { CompressedPixelFormat, CompressedTextureLoader } from "./three-core"; export interface Dds { mipmaps: ImageData[], diff --git a/types/three/three-examples.d.ts b/types/three/three-examples.d.ts index 67efcc566a..c08773fdf4 100644 --- a/types/three/three-examples.d.ts +++ b/types/three/three-examples.d.ts @@ -1,6 +1,6 @@ // Things from three.js/examples/ that do not (yet) have their own file -import {EventDispatcher, Shader} from "./three-core"; +import { EventDispatcher, Shader } from "./three-core"; export var AWDLoader: any; export var OBJLoader2: any; diff --git a/types/three/three-fbxloader.d.ts b/types/three/three-fbxloader.d.ts index 7a77ea67f5..5175a6683f 100644 --- a/types/three/three-fbxloader.d.ts +++ b/types/three/three-fbxloader.d.ts @@ -1,6 +1,6 @@ // https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/FBXLoader.js -import {LoadingManager} from "./three-core"; +import { LoadingManager } from "./three-core"; import {Group} from "./three-core"; export class FBXLoader { diff --git a/types/three/three-mtlloader.d.ts b/types/three/three-mtlloader.d.ts index dce5b12a17..33b4822432 100644 --- a/types/three/three-mtlloader.d.ts +++ b/types/three/three-mtlloader.d.ts @@ -1,7 +1,7 @@ // https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/MTLLoader.js -import {Material} from "./three-core"; +import { Material } from "./three-core"; import {LoadingManager} from "./three-core"; import {EventDispatcher} from "./three-core"; import {BufferGeometry} from "./three-core"; diff --git a/types/three/three-objloader.d.ts b/types/three/three-objloader.d.ts index 62403eeebb..8fd32c1e69 100644 --- a/types/three/three-objloader.d.ts +++ b/types/three/three-objloader.d.ts @@ -1,6 +1,6 @@ // https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/OBJLoader.js -import {Material} from "./three-core"; +import { Material } from "./three-core"; import {LoadingManager} from "./three-core"; import {Group} from "./three-core"; import {MaterialCreator} from "./three-mtlloader"; diff --git a/types/universal-router/universal-router-tests.ts b/types/universal-router/universal-router-tests.ts index 1d20af187e..ea6853e2cf 100644 --- a/types/universal-router/universal-router-tests.ts +++ b/types/universal-router/universal-router-tests.ts @@ -1,4 +1,4 @@ -import {ActionContext, Params, resolve } from "universal-router"; +import { ActionContext, Params, resolve } from "universal-router"; // Test 1 const routes1 = [ diff --git a/types/uws/uws-tests.ts b/types/uws/uws-tests.ts index 5d0b2ed3c6..76b60f335a 100644 --- a/types/uws/uws-tests.ts +++ b/types/uws/uws-tests.ts @@ -1,5 +1,5 @@ import * as WebSocket from 'uws'; -import {Buffer} from 'buffer'; +import { Buffer } from 'buffer'; import * as http from'http'; import * as https from'https'; import * as fs from'fs'; diff --git a/types/vec3/vec3-tests.ts b/types/vec3/vec3-tests.ts index e3bd46c4be..2a9c13adc9 100644 --- a/types/vec3/vec3-tests.ts +++ b/types/vec3/vec3-tests.ts @@ -1,3 +1,3 @@ -import {Vec3} from "vec3"; +import { Vec3 } from "vec3"; let myVector: Vec3 = new Vec3(10, 10, 10); console.log(myVector.toString()); \ No newline at end of file diff --git a/types/viewability-helper/viewability-helper-tests.ts b/types/viewability-helper/viewability-helper-tests.ts index b8b43102b4..cd2548f001 100644 --- a/types/viewability-helper/viewability-helper-tests.ts +++ b/types/viewability-helper/viewability-helper-tests.ts @@ -1,6 +1,6 @@ // Tests for ViewabilityHelper API -import {ViewabilityHelper, Options} from 'viewability-helper'; +import { ViewabilityHelper, Options } from 'viewability-helper'; let d: Element = document.createElement('DIV'); let vh: ViewabilityHelper = new ViewabilityHelper(d, () => {}); diff --git a/types/viewerjs/index.d.ts b/types/viewerjs/index.d.ts new file mode 100644 index 0000000000..9531447b09 --- /dev/null +++ b/types/viewerjs/index.d.ts @@ -0,0 +1,371 @@ +// Type definitions for viewerjs 0.7 +// Project: https://fengyuanchen.github.io/viewerjs +// Definitions by: LRH3321 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace Viewer { + type ImageSourceDelegate = (image: HTMLImageElement) => string; + + type ViewerMethod = () => void; + + /** + * Options + * @see {@link https://github.com/fengyuanchen/viewerjs#options} + */ + interface ViewerOption { + /** + * Enable inline mode. + * @default false + */ + inline?: boolean; + + /** + * Show the button on the top-right of the viewer. + * @default true + */ + button?: boolean; + + /** + * Specify the visibility of the navbar. + * - `0` or `false`: hide the navbar + * - `1` or `true`: show the navbar + * - `2`: show the navbar only when screen width great then 768 pixels + * - `3`: show the navbar only when screen width great then 992 pixels + * - `4`: show the navbar only when screen width great then 1200 pixels + * @default true + */ + navbar?: boolean | number; + + /** + * Specify the visibility of the title (the current image's name and dimensions). + * `0` or `false`: hide the title + * `1` or `true`: show the title + * `2`: show the title only when screen width great then 768 pixels + * `3`: show the title only when screen width great then 992 pixels + * `4`: show the title only when screen width great then 1200 pixels + * @default true + * @description The name comes from the `alt` attribute of an image element or the image name parsed from URL. + */ + title?: boolean | number; + + /** + * Specify the visibility of the toolbar. + * - `0` or `false`: hide the toolbar + * - `1` or `true`: show the toolbar + * - `2`: show the toolbar only when screen width great then 768 pixels + * - `3`: show the toolbar only when screen width great then 992 pixels + * - `4`: show the toolbar only when screen width great then 1200 pixels + * @default true + */ + toolbar?: boolean | number; + + /** + * Show the tooltip with image ratio (percentage) when zoom in or zoom out + * @default true + */ + tooltip?: boolean; + + /** + * Enable to move the image. + * @default true + */ + movable?: boolean; + + /** + * Enable to zoom the image. + * @default true + */ + zoomable?: boolean; + + /** + * Enable to rotate the image. + * @default true + */ + rotatable?: boolean; + + /** + * Enable to scale the image. + * @default true + */ + scalable?: boolean; + + /** + * Enable CSS3 Transition for some special elements. + * @default true + */ + transition?: boolean; + + /** + * Enable to request full screen when play. + * @default true + * @description Requires the browser supports + * @see {@link http://caniuse.com/fullscreen} + */ + fullscreen?: boolean; + + /** + * Enable keyboard support. + * @default true + */ + keyboard?: boolean; + + /** + * Define interval of each image when playing. + * @default 5000 + */ + interval?: number; + + /** + * Define the minimum width of the viewer. + * @default 200 + * @description Only available in inline mode (set the `inline` option to `true`). + */ + minWidth?: number; + + /** + * Define the minimum height of the viewer. + * @default 100 + * @description Only available in inline mode (set the `inline` option to `true`). + */ + minHeight?: number; + + /** + * Define the ratio when zoom the image by wheeling mouse. + * @default 0.1 + */ + zoomRatio?: number; + + /** + * Define the min ratio of the image when zoom out. + * @default 0.01 + */ + minZoomRatio?: number; + + /** + * Define the max ratio of the image when zoom in. + * @default 100 + */ + maxZoomRatio?: number; + + /** + * Define the CSS `z-index` value of viewer in modal mode. + * @default 2015 + */ + zIndex?: number; + + /** + * Define the CSS `z-index` value of viewer in inline mode. + * @default 0 + */ + zIndexInline?: number; + + /** + * Define where to get the original image URL for viewing. + * @default 'src' + * @description If it is a string, it should be one of the attributes of each image element. + * @description If it is a function, it will be called on each image and should return a valid image URL. + */ + url?: string | ImageSourceDelegate; + + /** + * A shortcut of the `ready` event. + * @default null + */ + ready?: ViewerMethod | null; + + /** + * A shortcut of the `show` event. + * @default null + */ + show?: ViewerMethod | null; + + /** + * A shortcut of the `shown` event. + * @default null + */ + shown?: ViewerMethod | null; + + /** + * A shortcut of the `hide` event. + * @default null + */ + hide?: ViewerMethod | null; + + /** + * A shortcut of the `hidden` event. + * @default null + */ + hidden?: ViewerMethod | null; + + /** + * A shortcut of the `view` event. + * @default null + */ + view?: ViewerMethod | null; + + /** + * A shortcut of the `viewed` event. + * @default null + */ + viewed?: ViewerMethod | null; + } + + /** + * Change the global default options. + * @param options + */ + function setDefaults(options: Viewer.ViewerOption): void; + + /** + * If you have to use other viewer with the same namespace, just call the `Viewer.noConflict` static method to revert to it. + */ + function noConflict(): void; +} + +/** * JavaScript image viewer. + * @see {@link https://github.com/fengyuanchen/viewerjs} + */ +declare class Viewer { + constructor(element: Element, options?: Viewer.ViewerOption); + + /** + * Show the viewer. + * @description Only available in modal mode. + */ + show(): void; + + /** + * hide the viewer. + * @description Only available in modal mode. + */ + hide(): void; + + /** + * View one of the images with image's index. + * @param index The index of the image for viewing. Default: `0`. + */ + view(index?: number): void; + + /** + * View the previous image. + */ + prev(): void; + + /** + * View the next image. + */ + next(): void; + + /** + * Move the image with relative offsets. + * @param offsetX Moving size (px) in the horizontal direction + * @param offsetY Moving size (px) in the vertical direction. If not present, its default value is `offsetX` + */ + move(offsetX: number, offsetY?: number): void; + + /** + * Move the image to an absolute point. + * @param x The `left` value of the image + * @param y The `top` value of the image. If not present, its default value is `x`. + */ + moveTo(x: number, y?: number): void; + + /** + * Zoom the image with a relative ratio + * @param ratio Zoom in: requires a positive number (ratio > 0). Zoom out: requires a negative number (ratio < 0) + * @param hasTooltip Show tooltip. Default: `false` + */ + zoom(ratio: number, hasTooltip?: boolean): void; + + /** + * Zoom the image to an absolute ratio. + * @param ratio Requires a positive number (ratio > 0) + * @param hasTooltip Show tooltip. Default: `false` + */ + zoomTo(ratio: number, hasTooltip?: boolean): void; + + /** + * Rotate the image with a relative degree. + * @param degree Rotate right: requires a positive number (degree > 0). Rotate left: requires a negative number (degree < 0) + */ + rotate(degree: number): void; + + /** + * Rotate the image to an absolute degree. + * @param degree + */ + rotateTo(degree: number): void; + + /** + * Scale the image. + * @param scaleX The scaling factor to apply on the abscissa of the image. When equal to `1` it does nothing. + * @param scaleY The scaling factor to apply on the ordinate of the image. If not present, its default value is `scaleX`. + */ + scale(scaleX: number, scaleY?: number): void; + + /** + * Scale the abscissa of the image. + * @param scaleX The scaling factor to apply on the abscissa of the image. When equal to `1` it does nothing. + */ + scaleX(scaleX: number): void; + + /** + * Scale the ordinate of the image. + * @param scaleY The scaling factor to apply on the abscissa of the image. When equal to `1` it does nothing. + */ + scaleY(scaleY: number): void; + + /** + * Play the images. + */ + play(): void; + + /** + * Stop play. + */ + stop(): void; + + /** + * Enter modal mode. + * @description Only available in inline mode. + */ + full(): void; + + /** + * Exit modal mode. + * @description Only available in inline mode. + */ + exit(): void; + + /** + * Show the current ratio of the image with percentage. + * @description Requires the `tooltip` option set to `true`. + */ + tooltip(): void; + + /** + * Toggle the image size between its natural size and initial size. + */ + toggle(): void; + + /** + * Reset the image to its initial state. + */ + reset(): void; + + /** + * Update the viewer instance when the source images changed (added, removed or sorted). + * @description If you load images dynamically (with XMLHTTPRequest), you can use this method to add the new images to the viewer instance. + */ + update(): void; + + /** + * Destroy the viewer and remove the instance. + */ + destroy(): void; +} + +/** JavaScript image viewer. + * @see {@link https://github.com/fengyuanchen/viewerjs} + */ +export = Viewer; diff --git a/types/viewerjs/tsconfig.json b/types/viewerjs/tsconfig.json new file mode 100644 index 0000000000..ca56504f32 --- /dev/null +++ b/types/viewerjs/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "allowSyntheticDefaultImports": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "viewerjs-tests.ts" + ] +} \ No newline at end of file diff --git a/types/viewerjs/tslint.json b/types/viewerjs/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/viewerjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/viewerjs/viewerjs-tests.ts b/types/viewerjs/viewerjs-tests.ts new file mode 100644 index 0000000000..43aba8aa0b --- /dev/null +++ b/types/viewerjs/viewerjs-tests.ts @@ -0,0 +1,126 @@ +import Viewer from 'viewerjs'; + +//////////////// +// Static Methods +//////////////// + +Viewer.setDefaults({}); +Viewer.noConflict(); + +//////////////// +// Constructors +//////////////// + +let pictures: Element = document.querySelector('.docs-pictures'); + +let viewer = new Viewer(pictures); +viewer = new Viewer(pictures, {}); +viewer = new Viewer( + pictures, + { + // Enable inline mode + inline: false, + + // Show the button on the top-right of the viewer + button: true, + + // Show the navbar + navbar: true, + + // Show the title + title: true, + + // Show the toolbar + toolbar: true, + + // Show the tooltip with image ratio (percentage) when zoom in or zoom out + tooltip: true, + + // Enable to move the image + movable: true, + + // Enable to zoom the image + zoomable: true, + + // Enable to rotate the image + rotatable: true, + + // Enable to scale the image + scalable: true, + + // Enable CSS3 Transition for some special elements + transition: true, + + // Enable to request fullscreen when play + fullscreen: true, + + // Enable keyboard support + keyboard: true, + + // Define interval of each image when playing + interval: 5000, + + // Min width of the viewer in inline mode + minWidth: 200, + + // Min height of the viewer in inline mode + minHeight: 100, + + // Define the ratio when zoom the image by wheeling mouse + zoomRatio: 0.1, + + // Define the min ratio of the image when zoom out + minZoomRatio: 0.01, + + // Define the max ratio of the image when zoom in + maxZoomRatio: 100, + + // Define the CSS `z-index` value of viewer in modal mode. + zIndex: 2015, + + // Define the CSS `z-index` value of viewer in inline mode. + zIndexInline: 0, + + // Define where to get the original image URL for viewing + // Type: String (an image attribute) or Function (should return an image URL) + url: 'src', + + // Event shortcuts + ready: null, + show: null, + shown: null, + hide: null, + hidden: null, + view: null, + viewed: () => { } + } +); + +//////////////// +// Methods +//////////////// + +viewer.show(); +viewer.hide(); +viewer.view(); +viewer.view(1); +viewer.move(1); +viewer.move(-1, 0); +viewer.zoom(0.1); +viewer.zoom(0.1, true); +viewer.zoomTo(0); +viewer.rotate(90); +viewer.rotateTo(0); +viewer.scale(-1); // Flip both horizontal and vertical +viewer.scale(-1, 1); // Flip horizontal +viewer.scaleX(-1); // Flip horizontal +viewer.scaleY(-1); // Flip vertical +viewer.play(); +viewer.stop(); +viewer.full(); +viewer.exit(); +viewer.tooltip(); +viewer.toggle(); +viewer.reset(); +viewer.update(); +viewer.destroy(); diff --git a/types/webpack-fail-plugin/index.d.ts b/types/webpack-fail-plugin/index.d.ts index d0436a3b89..04f037e084 100644 --- a/types/webpack-fail-plugin/index.d.ts +++ b/types/webpack-fail-plugin/index.d.ts @@ -6,7 +6,7 @@ /// declare module "webpack-fail-plugin" { - import {Plugin} from "webpack"; + import { Plugin } from "webpack"; /** * Webpack plugin that will make the process return status code 1 when it finishes with errors in single-run mode. diff --git a/types/webpack-merge/index.d.ts b/types/webpack-merge/index.d.ts index 18aaca1f36..a939a2ed53 100644 --- a/types/webpack-merge/index.d.ts +++ b/types/webpack-merge/index.d.ts @@ -6,7 +6,7 @@ /// declare module "webpack-merge" { - import {Configuration} from "webpack"; + import { Configuration } from "webpack"; interface WebpackMerge { /** diff --git a/types/webpack-merge/webpack-merge-tests.ts b/types/webpack-merge/webpack-merge-tests.ts index bc40806a23..4c9c4adca4 100644 --- a/types/webpack-merge/webpack-merge-tests.ts +++ b/types/webpack-merge/webpack-merge-tests.ts @@ -1,5 +1,5 @@ import merge = require("webpack-merge"); -import {Configuration} from "webpack"; +import { Configuration } from "webpack"; const a: Configuration = { entry: "test.js" diff --git a/types/webpack-validator/index.d.ts b/types/webpack-validator/index.d.ts index 850aadd654..4b6b260877 100644 --- a/types/webpack-validator/index.d.ts +++ b/types/webpack-validator/index.d.ts @@ -6,7 +6,7 @@ /// declare module "webpack-validator" { - import {Configuration} from "webpack"; + import { Configuration } from "webpack"; interface ValidationOptions { "no-root-files-node-modules-nameclash"?: boolean; diff --git a/types/webpack-validator/webpack-validator-tests.ts b/types/webpack-validator/webpack-validator-tests.ts index 9635ae2060..5cb729b720 100644 --- a/types/webpack-validator/webpack-validator-tests.ts +++ b/types/webpack-validator/webpack-validator-tests.ts @@ -1,4 +1,4 @@ -import {Configuration} from "webpack"; +import { Configuration } from "webpack"; import validate = require("webpack-validator"); const a: Configuration = { diff --git a/types/why-did-you-update/why-did-you-update-tests.ts b/types/why-did-you-update/why-did-you-update-tests.ts index d628e796c6..71aade524e 100644 --- a/types/why-did-you-update/why-did-you-update-tests.ts +++ b/types/why-did-you-update/why-did-you-update-tests.ts @@ -1,5 +1,5 @@ import * as React from "react"; -import {whyDidYouUpdate} from "why-did-you-update"; +import { whyDidYouUpdate } from "why-did-you-update"; whyDidYouUpdate(React); whyDidYouUpdate(React, { include: /^pure/, exclude: /^Connect/ }); diff --git a/types/winston/index.d.ts b/types/winston/index.d.ts index a189f03c22..a00c89a5b6 100644 --- a/types/winston/index.d.ts +++ b/types/winston/index.d.ts @@ -7,7 +7,7 @@ /// -import {Agent} from 'http'; +import { Agent } from 'http'; declare namespace winston { interface AbstractConfigSetLevels { diff --git a/types/wonder-commonlib/wonder-commonlib-tests.ts b/types/wonder-commonlib/wonder-commonlib-tests.ts index 852f768f01..602be32a6b 100644 --- a/types/wonder-commonlib/wonder-commonlib-tests.ts +++ b/types/wonder-commonlib/wonder-commonlib-tests.ts @@ -1,4 +1,4 @@ -import {Collection} from "wonder-commonlib/dist/es2015/Collection"; +import { Collection } from "wonder-commonlib/dist/es2015/Collection"; var list = Collection.create(); diff --git a/types/wonder-frp/wonder-frp-tests.ts b/types/wonder-frp/wonder-frp-tests.ts index ef7ea2672b..66387b193e 100644 --- a/types/wonder-frp/wonder-frp-tests.ts +++ b/types/wonder-frp/wonder-frp-tests.ts @@ -1,4 +1,4 @@ -import {fromArray} from "wonder-frp/dist/es2015/global/Operator"; +import { fromArray } from "wonder-frp/dist/es2015/global/Operator"; fromArray([1,2,3]) .subscribe(function(){ diff --git a/types/wonder.js/wonder.js-tests.ts b/types/wonder.js/wonder.js-tests.ts index eb486e6a48..7ad6abc4bc 100644 --- a/types/wonder.js/wonder.js-tests.ts +++ b/types/wonder.js/wonder.js-tests.ts @@ -1,4 +1,4 @@ -import {Director} from "wonder.js/dist/es2015/core/Director"; +import { Director } from "wonder.js/dist/es2015/core/Director"; console.log(Director.getInstance()); diff --git a/types/xmpp__jid/xmpp__jid-tests.ts b/types/xmpp__jid/xmpp__jid-tests.ts index 1652e054a7..d26ede9a15 100644 --- a/types/xmpp__jid/xmpp__jid-tests.ts +++ b/types/xmpp__jid/xmpp__jid-tests.ts @@ -1,4 +1,4 @@ -import {JID} from '@xmpp/jid'; +import { JID } from '@xmpp/jid'; /* * All return an instance of JID.JID, the new operator is optional. diff --git a/types/yeoman-test/index.d.ts b/types/yeoman-test/index.d.ts index 8d3c79ed22..9106df49c4 100644 --- a/types/yeoman-test/index.d.ts +++ b/types/yeoman-test/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import {EventEmitter} from 'events'; +import { EventEmitter } from 'events'; import Generator = require('yeoman-generator'); export interface Dictionary { diff --git a/types/zen-observable/index.d.ts b/types/zen-observable/index.d.ts index 1614c80c58..aac4535e5b 100644 --- a/types/zen-observable/index.d.ts +++ b/types/zen-observable/index.d.ts @@ -53,11 +53,12 @@ declare class Observable { reduce(callback: (previousValue: T, currentValue: T) => T, initialValue?: T): Observable; reduce(callback: (previousValue: R, currentValue: T) => R, initialValue?: R): Observable; flatMap(callback: (value: T) => ZenObservable.ObservableLike): Observable; + + static from(observable: Observable | ZenObservable.ObservableLike | ArrayLike): Observable; + static of(...items: R[]): Observable; } declare namespace Observable { - function from(observable: Observable | ZenObservable.ObservableLike | ArrayLike): Observable; - function of(...items: T[]): Observable; } export = Observable;