Merge remote-tracking branch 'upstream/master' into pusher-js-global

This commit is contained in:
Mark Florian
2017-11-10 09:41:54 +00:00
708 changed files with 20994 additions and 10504 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
language: node_js
node_js:
- node
- 8
sudo: false
+6
View File
@@ -330,6 +330,12 @@
"sourceRepoURL": "https://github.com/tdegrunt/jsonschema",
"asOfVersion": "1.1.1"
},
{
"libraryName": "jsplumb",
"typingsPackageName": "jsplumb",
"sourceRepoURL": "https://github.com/jsplumb/jsPlumb",
"asOfVersion": "2.5.7"
},
{
"libraryName": "knockout-paging",
"typingsPackageName": "knockout-paging",
+12 -17
View File
@@ -1,13 +1,13 @@
import acorn = require('acorn');
import * as ESTree from 'estree';
declare var token: acorn.Token;
declare var tokens: acorn.Token[];
declare var comment: acorn.Comment;
declare var comments: acorn.Comment[];
declare var program: ESTree.Program;
var any: any;
var string: string;
declare let token: acorn.Token;
declare let tokens: acorn.Token[];
declare let comment: acorn.Comment;
declare let comments: acorn.Comment[];
declare let program: ESTree.Program;
let any: any;
let string: string;
// acorn
string = acorn.version;
@@ -32,16 +32,12 @@ const parser = new acorn.Parser({}, 'export default ""', 0);
const node = new acorn.Node(parser, 1, 1);
class LooseParser {
constructor(input: string, options = {}) {
}
constructor(input: string, options = {}) {}
// this means you can extend LooseParser
test() {
}
test() {}
}
acorn.addLooseExports(function () {
acorn.addLooseExports(() => {
return {
type: 'Program',
sourceType: 'script',
@@ -50,7 +46,7 @@ acorn.addLooseExports(function () {
type: 'EmptyStatement'
}
]
}
};
}, LooseParser, {});
acorn.parseExpressionAt('string', 2);
@@ -63,8 +59,7 @@ acorn.isIdentifierChar(56);
acorn.getLineInfo('string', 56);
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
}
acorn.plugins['test'] = (p: acorn.Parser, config: any) => {};
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
+9 -14
View File
@@ -1,10 +1,8 @@
// Type definitions for Acorn v4.0.3
// Type definitions for Acorn 4.0
// Project: https://github.com/marijnh/acorn
// Definitions by: RReverser <https://github.com/RReverser>, e-cloud <https://github.com/e-cloud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="estree" />
export as namespace acorn;
export = acorn;
import * as ESTree from 'estree';
@@ -181,7 +179,7 @@ declare namespace acorn {
_typeof: TokenType;
_void: TokenType;
_delete: TokenType;
}
};
class TokContext {
constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void);
@@ -230,19 +228,18 @@ declare namespace acorn {
const version: string;
interface IParse {
(input: string, options?: Options): ESTree.Program;
}
// TODO: rename type.
type IParse = (input: string, options?: Options) => ESTree.Program;
const parse: IParse;
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
interface ITokenizer {
getToken() : Token,
[Symbol.iterator](): Iterator<Token>
getToken(): Token;
[Symbol.iterator](): Iterator<Token>;
}
function tokenizer(input: string, options: Options): ITokenizer;
let parse_dammit: IParse | undefined;
@@ -250,12 +247,10 @@ declare namespace acorn {
let pluginsLoose: PluginsObject | undefined;
interface ILooseParserClass {
new (input: string, options?: Options): ILooseParser
new (input: string, options?: Options): ILooseParser;
}
interface ILooseParser {
}
interface ILooseParser {}
function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void;
}
+1 -71
View File
@@ -1,79 +1,9 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
"no-unnecessary-class": false
}
}
+251 -7
View File
@@ -95,6 +95,18 @@ declare namespace algoliasearch {
* https://github.com/algolia/algoliasearch-client-js#keep-alive
*/
destroy(): void;
/**
* Add a header to be sent with all upcoming requests
*/
setExtraHeader(name: string, value: string): void;
/**
* Get the value of an extra header
*/
getExtraHeader(name: string): string;
/**
* remove an extra header for all upcoming requests
*/
unsetExtraHeader(name: string): void;
/**
* List all your indices along with their associated information (number of entries, disk size, etc.)
* @param cb(err, res)
@@ -533,6 +545,65 @@ declare namespace algoliasearch {
options: SearchSynonymOptions,
cb: (err: Error, res: any) => void
): void;
/**
* Save a rule object
* @param rule
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#save-rule---saverule
*/
saveRule(
rule: AlgoliaRule,
options: RuleOption,
cb: (err: Error, res: any) => void
): void;
/**
* Save a rule object
* @param rules
* @param options
* @param cb(err, res)
*/
batchRules(
rules: AlgoliaRule[],
options: RuleOption,
cb: (err: Error, res: any) => void
): void;
/**
* Delete a specific rule
* @param identifier
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#batch-rules---batchrules
*/
deleteRule(
identifier: string,
options: RuleOption,
cb: (err: Error, res: any) => void
): void;
/**
* Clear all rules of an index
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#clear-all-rules---clearrules
*/
clearRules(options: RuleOption, cb: (err: Error, res: any) => void): void;
/**
* Get a specific rule
* @param identifier
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#get-rule---getrule
*/
getRule(identifier: string, cb: (err: Error, res: any) => void): void;
/**
* Search a rules
* @param options
* @param cb(err, res)
* https://github.com/algolia/algoliasearch-client-js#search-rules---searchrules
*/
searchRules(
options: SearchRuleOptions,
cb: (err: Error, res: any) => void
): void;
/**
* List index user keys
* @param cb(err, res)
@@ -846,6 +917,50 @@ declare namespace algoliasearch {
* https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms
*/
searchSynonyms(options: SearchSynonymOptions): Promise<any>;
/**
* Save a rule object
* @param rule
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#save-rule---saverule
*/
saveRule(rule: AlgoliaRule, options: RuleOption): Promise<any>;
/**
* Save a rule object
* @param rules
* @param options
* return {Promise}
*/
batchRules(rules: AlgoliaRule[], options: RuleOption): Promise<any>;
/**
* Delete a specific rule
* @param identifier
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#batch-rules---batchrules
*/
deleteRule(identifier: string, options: RuleOption): Promise<any>;
/**
* Clear all query rules of an index
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#clear-all-rules---clearrules
*/
clearRules(options: RuleOption): Promise<any>;
/**
* Get a specific query rule
* @param identifier
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#get-rule---getrule
*/
getRule(identifier: string): Promise<any>;
/**
* Search for query rules
* @param options
* return {Promise}
* https://github.com/algolia/algoliasearch-client-js#search-rules---searchrules
*/
searchRules(options: SearchRuleOptions): Promise<any>;
/**
* List index user keys
* return {Promise}
@@ -1024,8 +1139,8 @@ Interface describing options available for gettings the logs
description?: string;
}
/**
* Describes option used when making operation on synonyms
*/
* Describes option used when making operation on synonyms
*/
interface SynonymOption {
/**
* You can forward all settings updates to the replicas of an index
@@ -1039,8 +1154,8 @@ Interface describing options available for gettings the logs
replaceExistingSynonyms?: boolean;
}
/**
* Describes options used when searching for synonyms
*/
* Describes options used when searching for synonyms
*/
interface SearchSynonymOptions {
/**
* The actual search query to find synonyms
@@ -1049,7 +1164,7 @@ Interface describing options available for gettings the logs
query?: string;
/**
* The page to fetch when browsing through several pages of results
* default: 100
* default: 0
* https://github.com/algolia/algoliasearch-client-js#search-synonyms---searchsynonyms
*/
page?: number;
@@ -1066,6 +1181,49 @@ Interface describing options available for gettings the logs
*/
hitsPerPage?: number;
}
/**
* Describes option used when making operation on query rules
*/
interface RuleOption {
/**
* You can forward all settings updates to the replicas of an index
* https://github.com/algolia/algoliasearch-client-js#replica-settings
*/
forwardToReplicas?: boolean;
/**
* Replace all existing query rules on the index with the content of the batch
*/
clearExistingRules?: boolean;
}
/**
* Describes options used when searching for query rules
*/
interface SearchRuleOptions {
/**
* The actual search query to find synonyms
*/
query?: string;
/**
* When specified, restricts matches to rules with a specific anchoring type.
* When omitted, all anchoring types may match.
*/
anchoring?: string;
/**
* When specified, restricts matches to contextual rules with a specific context (exact match).
* When omitted, any generic or contextual rule (with any context) may match.
*/
context?: string;
/**
* Requested page (zero-based)
* default: 0
*/
page?: number;
/**
* Number of hits per page
* default: 20
*/
hitsPerPage?: number;
}
interface AlgoliaBrowseResponse {
cursor?: string;
hits: any[];
@@ -1094,8 +1252,94 @@ Interface describing options available for gettings the logs
synonyms: string[];
}
/**
* Describes the options used when generating new api keys
*/
* Describes a query rule object
*/
interface AlgoliaRule {
/**
* ObjectID of the synonym
* https://github.com/algolia/algoliasearch-client-js#save-synonym---savesynonym
*/
objectID: string;
/**
* Condition of the rule
*/
condition: {
/**
* Query pattern
* syntax: https://www.algolia.com/doc/rest-api/query-rules/?language=php#query-pattern-syntax
*/
pattern: string;
/**
* Whether the pattern must match the beginning or the end of the query string, or both, or none.
*/
anchoring: 'is' | 'startsWith' | 'endsWith' | 'contains';
/**
* Rule context (format: [A-Za-z0-9_-]+).
* When specified, the rule is contextual and applies only when the same context is specified
* at query time (using the ruleContexts parameter).
* When absent, the rule is generic and always applies
* (provided that its other conditions are met, of course).
*/
context?: string;
};
/**
* Consequence of the rule. At least one of the following must be used:
*/
consequence: {
params?: {
/**
* When a string, it replaces the entire query string.
* When an object, describes incremental edits to be made to the query string.
*/
query?:
| string
| {
/**
* Tokens (literals or placeholders) from the query pattern
* that should be removed from the query string.
*/
remove: string[];
};
/**
* Names of facets to which automatic filtering must be applied;
* they must match the facet name of a facet value placeholder in the query pattern.
*/
automaticFacetFilters?: string[];
/**
* Same as automaticFacetFilters, but for optionalFacetFilters.
* The same syntax as query parameters can be used to specify a score: facetName<score=1>.
*/
automaticOptionalFacetFilters?: string[];
};
/**
* Objects to promote as hits. Each object must contain the following fields
*/
promote?: {
/**
* Unique identifier of the object to promote
*/
objectID: string;
/**
* Promoted rank for the object (zero-based)
*/
position: number;
}[];
/**
* Custom JSON object that will be appended to the userData array in the response.
* This object is not interpreted by the API. It is limited to 1kB of minified JSON.
*/
userData?: {};
};
/**
* This field is intended for rule management purposes,
* in particular to ease searching for rules and presenting them to human readers.
* It is not interpreted by the API.
*/
description?: string;
}
/**
* Describes the options used when generating new api keys
*/
interface AlgoliaSecuredApiOptions {
/**
* Filter the query with numeric, facet or/and tag filters
+15 -22
View File
@@ -1,23 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"algoliasearch-tests.ts"
]
}
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "algoliasearch-tests.ts"]
}
+77 -77
View File
@@ -1,79 +1,79 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: http://angularjs.org
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>, Raphael Schweizer <https://github.com/rasch>, Cody Schaaf <https://github.com/codyschaaf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3
declare var _: string;
export = _;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/nervgh/angular-file-upload
// Definitions by: Cyril Gandon <https://github.com/cyrilgandon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
import * as angular from 'angular';
+6 -2
View File
@@ -45,9 +45,9 @@ function withContainerAsString() {
});
}
// With container as jQuery element
// With container as jQuery/JQLite element
function withContainerAsJquery() {
var container: JQuery = $('body');
var container: JQuery = angular.element('body');
btfModal({
template: '<div></div>',
container: container
@@ -94,6 +94,10 @@ function callingValues() {
template: '<div></div>'
});
modal.activate().then(() => {}, () => {});
// activating with random locals
modal.activate({name: 'TestName'}).then(() => {}, () => {});
// activating with genericly typed locals
modal.activate<{name: string}>({name: 'TestName'}).then(() => {}, () => {});
modal.deactivate().then(() => {}, () => {});
var isActive: boolean = modal.active();
}
+2 -2
View File
@@ -5,7 +5,6 @@
// TypeScript Version: 2.3
/// <reference types="angular" />
/// <reference types="jquery" />
declare namespace angularModal {
@@ -28,7 +27,8 @@ declare namespace angularModal {
}
export interface AngularModal {
activate(): angular.IPromise<void>;
activate(locals?: {}): angular.IPromise<void>;
activate<T>(locals: T): angular.IPromise<void>;
deactivate(): angular.IPromise<void>;
active(): boolean;
}
+4 -1
View File
@@ -6,10 +6,13 @@
/// <reference types="angular" />
declare var _: string;
export = _;
import * as angular from 'angular';
declare module 'angular' {
export namespace a0.storage {
namespace a0.storage {
interface IStoreService extends INamespacedStoreService {
/**
* Returns a namespaced store
+1
View File
@@ -2,6 +2,7 @@
// Project: http://720kb.github.io/angular-tooltips
// Definitions by: Leonard Thieu <https://github.com/leonard-thieu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
declare const AngularTooltips: '720kb.tooltips';
export = AngularTooltips;
+50 -6
View File
@@ -707,7 +707,7 @@ class SampleDirective implements ng.IDirective {
restrict = 'A';
name = 'doh';
compile(templateElement: ng.IAugmentedJQuery) {
compile(templateElement: JQLite) {
return {
post: this.link
};
@@ -723,7 +723,7 @@ class SampleDirective implements ng.IDirective {
class SampleDirective2 implements ng.IDirective {
restrict = 'EAC';
compile(templateElement: ng.IAugmentedJQuery) {
compile(templateElement: JQLite) {
return {
pre: this.link
};
@@ -741,7 +741,7 @@ angular.module('SameplDirective', []).directive('sampleDirective', SampleDirecti
angular.module('AnotherSampleDirective', []).directive('myDirective', ['$interpolate', '$q', ($interpolate: ng.IInterpolateService, $q: ng.IQService) => {
return {
restrict: 'A',
link: (scope: ng.IScope, el: ng.IAugmentedJQuery, attr: ng.IAttributes) => {
link: (scope: ng.IScope, el: JQLite, attr: ng.IAttributes) => {
$interpolate(attr['test'])(scope);
$interpolate('', true)(scope);
$interpolate('', true, 'html')(scope);
@@ -869,7 +869,7 @@ angular.module('docsTimeDirective', [])
}])
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
return {
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
link(scope: ng.IScope, element: JQLite, attrs: ng.IAttributes) {
let format: any;
let timeoutId: any;
@@ -916,7 +916,7 @@ angular.module('docsTransclusionExample', [])
transclude: true,
scope: {},
templateUrl: 'my-dialog.html',
link(scope: ng.IScope, element: ng.IAugmentedJQuery) {
link(scope: ng.IScope, element: JQLite) {
scope['name'] = 'Jeff';
}
};
@@ -1017,7 +1017,7 @@ angular.module('docsTabsExample', [])
scope: {
title: '@'
},
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes, tabsCtrl: any) {
link(scope: ng.IScope, element: JQLite, attrs: ng.IAttributes, tabsCtrl: any) {
tabsCtrl.addPane(scope);
},
templateUrl: 'my-pane.html'
@@ -1098,6 +1098,18 @@ angular.module('copyExample', [])
$scope.reset();
}]);
// Extending IScope for a directive, see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/21160
interface IMyScope extends angular.IScope {
myScopeProperty: boolean;
}
angular.module('aaa').directive('directive', () => ({
link(scope: IMyScope) {
console.log(scope.myScopeProperty);
return;
}
}));
namespace locationTests {
const $location: ng.ILocationService = null;
@@ -1312,3 +1324,35 @@ function toPromise<T>(val: T): ng.IPromise<T> {
const p: ng.IPromise<T> = null;
return p;
}
const directiveCompileFn: ng.IDirectiveCompileFn = (
templateElement: JQLite,
templateAttributes: ng.IAttributes,
transclude: ng.ITranscludeFunction
): ng.IDirectiveLinkFn => {
return (
scope: ng.IScope,
instanceElement: JQLite,
instanceAttributes: ng.IAttributes
) => {
return null;
};
};
interface MyScope extends ng.IScope {
foo: string;
}
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope> = (
templateElement: JQLite,
templateAttributes: ng.IAttributes,
transclude: ng.ITranscludeFunction
): ng.IDirectiveLinkFn<MyScope> => {
return (
scope: MyScope,
instanceElement: JQLite,
instanceAttributes: ng.IAttributes
) => {
return null;
};
};
+28 -22
View File
@@ -9,9 +9,6 @@
/// <reference path="jqlite.d.ts" />
// NOTE: @types/angular technically doesn't require TypeScript 2.3, only TypeScript 2.1.
// It has a TypeScript 2.3 header so that merging tests with @types/jquery v3 will work.
declare var angular: angular.IAngularStatic;
// Support for painless dependency injection
@@ -232,8 +229,8 @@ declare namespace angular {
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
* @param directiveFactory An injectable directive factory function.
*/
directive(name: string, directiveFactory: Injectable<IDirectiveFactory>): IModule;
directive(object: {[directiveName: string]: Injectable<IDirectiveFactory>}): IModule;
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): IModule;
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): IModule;
/**
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
*
@@ -1252,8 +1249,8 @@ declare namespace angular {
}
interface ICompileProvider extends IServiceProvider {
directive(name: string, directiveFactory: Injectable<IDirectiveFactory>): ICompileProvider;
directive(object: {[directiveName: string]: Injectable<IDirectiveFactory>}): ICompileProvider;
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): ICompileProvider;
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
component(name: string, options: IComponentOptions): ICompileProvider;
@@ -1302,6 +1299,17 @@ declare namespace angular {
*/
cssClassDirectivesEnabled(): boolean;
cssClassDirectivesEnabled(enabled: boolean): ICompileProvider;
/**
* Call this method to enable/disable strict component bindings check.
* If enabled, the compiler will enforce that for all bindings of a
* component that are not set as optional with ?, an attribute needs
* to be provided on the component's HTML tag.
* Defaults to false.
* See: https://docs.angularjs.org/api/ng/provider/$compileProvider#strictComponentBindingsEnabled
*/
strictComponentBindingsEnabled(): boolean;
strictComponentBindingsEnabled(enabled: boolean): ICompileProvider;
}
interface ICloneAttachFunction {
@@ -1961,13 +1969,13 @@ declare namespace angular {
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
interface IDirectiveFactory {
(...args: any[]): IDirective | IDirectiveLinkFn;
interface IDirectiveFactory<TScope extends IScope = IScope> {
(...args: any[]): IDirective<TScope> | IDirectiveLinkFn<TScope>;
}
interface IDirectiveLinkFn {
interface IDirectiveLinkFn<TScope extends IScope = IScope> {
(
scope: IScope,
scope: TScope,
instanceElement: JQLite,
instanceAttributes: IAttributes,
controller?: IController | IController[] | {[key: string]: IController},
@@ -1975,12 +1983,12 @@ declare namespace angular {
): void;
}
interface IDirectivePrePost {
pre?: IDirectiveLinkFn;
post?: IDirectiveLinkFn;
interface IDirectivePrePost<TScope extends IScope = IScope> {
pre?: IDirectiveLinkFn<TScope>;
post?: IDirectiveLinkFn<TScope>;
}
interface IDirectiveCompileFn {
interface IDirectiveCompileFn<TScope extends IScope = IScope> {
(
templateElement: JQLite,
templateAttributes: IAttributes,
@@ -1991,11 +1999,11 @@ declare namespace angular {
* that is passed to the link function instead.
*/
transclude: ITranscludeFunction
): void | IDirectiveLinkFn | IDirectivePrePost;
): void | IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
}
interface IDirective {
compile?: IDirectiveCompileFn;
interface IDirective<TScope extends IScope = IScope> {
compile?: IDirectiveCompileFn<TScope>;
controller?: string | Injectable<IControllerConstructor>;
controllerAs?: string;
/**
@@ -2004,7 +2012,7 @@ declare namespace angular {
* relies upon bindings inside a $onInit method on the controller, instead.
*/
bindToController?: boolean | {[boundProperty: string]: string};
link?: IDirectiveLinkFn | IDirectivePrePost;
link?: IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
multiElement?: boolean;
priority?: number;
/**
@@ -2077,9 +2085,7 @@ declare namespace angular {
get<T>(name: '$xhrFactory'): IXhrFactory<T>;
has(name: string): boolean;
instantiate<T>(typeConstructor: {new(...args: any[]): T}, locals?: any): T;
invoke(inlineAnnotatedFunction: any[], context?: any, locals?: any): any;
invoke<T>(func: (...args: any[]) => T, context?: any, locals?: any): T;
invoke(func: Function, context?: any, locals?: any): any;
invoke<T = any>(func: Injectable<Function | ((...args: any[]) => T)>, context?: any, locals?: any): T;
strictDi: boolean;
}
+2 -2
View File
@@ -16,7 +16,7 @@
"noImplicitAny": false,
"noImplicitThis": false,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -25,4 +25,4 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
}
+1 -2
View File
@@ -1,7 +1,6 @@
// Type definitions for Angulartics 1.4
// Project: http://luisfarzati.github.io/angulartics/
// Definitions by: Steven Fan <https://github.com/stevenfan>
// Bateast2 <https://github.com/bateast2>
// Definitions by: Bateast2 <https://github.com/bateast2>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/apex/node-apex
// Definitions by: Yoriki Yamaguchi <https://github.com/y13i>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="aws-lambda" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/Esri/arcgis-to-geojson-utils
// Definitions by: Jeff Jacobson <https://github.com/JeffJacobson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="geojson" />
+67
View File
@@ -0,0 +1,67 @@
import * as args from "args";
args
.option("opt1", "desc")
.option("opt2", "desc", false, (value: any): any => value)
.options([
{
name: 'opt3',
description: 'desc',
defaultValue: 1,
init: (value: any) => { },
},
{
name: 'opt4',
description: 'desc',
},
])
.command("cm1", "desc")
.command("cm2", "desc", (value: any): void => { }, ['a'])
.example("ex1", "desc")
.examples([
{
usage: "ex2",
description: "desc",
},
]);
args.parse(['~/bin/node', '~/dir', 'arg', '--param'], {
help: true,
name: "name",
version: true,
usageFilter: (a: any): any => a,
value: "value",
mri: {
args: ['a'],
alias: {
a: "b",
c: ['d'],
},
boolean: ['wat'],
default: {
foo: 'bar',
},
string: ['zulu'],
unknown: (param: string): boolean => true,
},
minimist: {
string: ['string'],
boolean: ['string'],
alias: {
bar: 'foo',
foo: ['bar1', 'bar2'],
},
default: {
foo: 'bar',
},
stopEarly: true,
"--": false,
unknown: (param: string): boolean => true,
},
mainColor: "yellow",
subColor: "dim"
});
args.showHelp();
const x: string = args.sub[0];
+72
View File
@@ -0,0 +1,72 @@
// Type definitions for args 3.0
// Project: https://github.com/leo/args#readme
// Definitions by: Slessi <https://github.com/Slessi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare const c: args;
export = c;
interface args {
sub: string[];
option(name: string | [string, string], description: string, defaultValue?: any, init?: OptionInitFunction): args;
options(list: Option[]): args;
command(name: string, description: string, init?: (name: string, sub: string[], options: ConfigurationOptions) => void, aliases?: string[]): args;
example(usage: string, description: string): args;
examples(list: Example[]): args;
parse(argv: string[], options?: ConfigurationOptions): { [key: string]: any };
showHelp(): void;
}
type OptionInitFunction = (value: any) => any;
interface MriOptions {
args?: string[];
alias?: {
[key: string]: string | string[]
};
boolean?: string | string[];
default?: {
[key: string]: any
};
string?: string | string[];
unknown?: (param: string) => boolean;
}
interface MinimistOptions {
string?: string | string[];
boolean?: boolean | string | string[];
alias?: {
[key: string]: string | string[]
};
default?: {
[key: string]: any
};
stopEarly?: boolean;
"--"?: boolean;
unknown?: (param: string) => boolean;
}
interface ConfigurationOptions {
help?: boolean;
name?: string;
version?: boolean;
usageFilter?: (output: any) => any;
value?: string;
mri: MriOptions;
minimist?: MinimistOptions;
mainColor: string | string[];
subColor: string | string[];
}
interface Option {
name: string | [string, string];
description: string;
init?: OptionInitFunction;
defaultValue?: any;
}
interface Example {
usage: string;
description: string;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"args-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/shoreditch-ops/artillery#readme
// Definitions by: Kira McCoan <https://github.com/kmccoan-allocadia>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
import * as request from 'request';
import * as events from 'events';
+135
View File
@@ -0,0 +1,135 @@
import { ArrayIterator, AsyncIterator, BufferedIterator, ClonedIterator, EmptyIterator, IntegerIterator,
MultiTransformIterator, SingletonIterator, SimpleTransformIterator, TransformIterator } from "asynciterator";
function test_asynciterator() {
// We can't instantiate an abstract class.
const it1: AsyncIterator<number> = <any> {};
const read1: number = it1.read();
it1.each((data: number) => console.log(data));
it1.each((data: number) => console.log(data), {});
it1.close();
const it2: AsyncIterator<string> = <any> {};
const read2: string = it2.read();
it2.each((data: string) => console.log(data));
it2.each((data: string) => console.log(data), {});
it2.close();
const it3: AsyncIterator<AsyncIterator<string>> = <any> {};
const read3: AsyncIterator<string> = it3.read();
it3.each((data: AsyncIterator<string>) => data.each((data: string) => console.log(data)));
it3.each((data: AsyncIterator<string>) => data.each((data: string) => console.log(data), {}), {});
it3.close();
const readable2: boolean = it1.readable;
const closed2: boolean = it1.closed;
const ended2: boolean = it1.ended;
it1.setProperty('name1', 123);
it2.setProperty('name2', 'someValue');
const p1: number = it1.getProperty('name1');
const p2: string = it1.getProperty('name2');
it1.getProperty('name1', (value: number) => console.log(value));
it1.getProperty('name2', (value: string) => console.log(value));
const ps1: {[id: string]: any} = it1.getProperties();
it1.setProperties({ name1: 1234, name2: 'someOtherValue' });
it1.copyProperties(it2, [ 'name1', 'name2' ]);
const str: string = it1.toString();
const stit1: SimpleTransformIterator<number, string> = it1.transform();
const stit2: SimpleTransformIterator<number, string> = it1.map((number: number) => 'i' + number);
const stit3: AsyncIterator<string> = it1.map((number: number) => 'i' + number);
const stit4: AsyncIterator<number> = it2.map(parseInt);
const stit5: AsyncIterator<number> = it1.map((number: number) => number + 1);
const stit6: AsyncIterator<number> = it1.filter((number: number) => number < 10);
const stit7: AsyncIterator<number> = it1.prepend([0, 1, 2]);
const stit8: AsyncIterator<number> = it1.append([0, 1, 2]);
const stit9: AsyncIterator<number> = it1.surround([0, 1, 2], [0, 1, 2]);
const stit10: AsyncIterator<number> = it1.skip(2);
const stit11: AsyncIterator<number> = it1.take(2);
const stit12: AsyncIterator<number> = it1.range(2, 20);
const stit13: AsyncIterator<number> = it1.clone();
const intit1: IntegerIterator = AsyncIterator.range(10, 100, 1);
const intit2: IntegerIterator = AsyncIterator.range(10, 100);
const intit3: IntegerIterator = AsyncIterator.range(10);
const intit4: IntegerIterator = AsyncIterator.range();
}
function test_emptyiterator() {
const it1: AsyncIterator<number> = new EmptyIterator();
const it2: AsyncIterator<string> = new EmptyIterator();
}
function test_singletoniterator() {
const it1: AsyncIterator<number> = new SingletonIterator(3);
const it2: AsyncIterator<string> = new SingletonIterator('a');
}
function test_arrayiterator() {
const it1: AsyncIterator<number> = new ArrayIterator([1, 2, 3]);
const it2: AsyncIterator<string> = new ArrayIterator(['a', 'b', 'c']);
}
function test_integeriterator() {
const it1: IntegerIterator = new IntegerIterator();
const it2: AsyncIterator<number> = new IntegerIterator({});
const it3: AsyncIterator<number> = new IntegerIterator({ start: 0 });
const it4: AsyncIterator<number> = new IntegerIterator({ end: 100 });
const it5: AsyncIterator<number> = new IntegerIterator({ step: 10 });
}
function test_bufferediterator() {
const it1: BufferedIterator<number> = new BufferedIterator();
const it2: AsyncIterator<number> = new BufferedIterator({});
const it3: AsyncIterator<number> = new BufferedIterator({ maxBufferSize: 10 });
const it4: AsyncIterator<number> = new BufferedIterator({ autoStart: true });
}
function test_transformiterator() {
const it1: TransformIterator<number, string> = new TransformIterator<number, string>();
const it2: AsyncIterator<string> = new TransformIterator<number, string>();
const it3: AsyncIterator<number> = new TransformIterator<string, number>(it1);
const it4: AsyncIterator<number> = new TransformIterator<string, number>(it1, {});
const it5: AsyncIterator<number> = new TransformIterator<string, number>(it1, { optional: true });
const it6: AsyncIterator<number> = new TransformIterator<string, number>({ source: it1 });
const source: AsyncIterator<number> = it1.source;
}
function test_simpletransformiterator() {
const it1: SimpleTransformIterator<number, string> = new SimpleTransformIterator<number, string>();
const it2: TransformIterator<number, string> = new SimpleTransformIterator<number, string>();
const it3: AsyncIterator<string> = new SimpleTransformIterator<number, string>();
const it4: AsyncIterator<number> = new SimpleTransformIterator<string, number>(it1);
const it5: AsyncIterator<number> = new SimpleTransformIterator<string, number>(it1, {});
const it6: AsyncIterator<number> = new SimpleTransformIterator<string, number>({});
const it7: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ optional: true });
const it8: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ source: it1 });
const it9: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ offset: 2 });
const it10: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ limit: 2 });
const it11: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ prepend: [0, 1, 2] });
const it12: AsyncIterator<number> = new SimpleTransformIterator<string, number>({ append: [0, 1, 2] });
const it13: AsyncIterator<number> = new SimpleTransformIterator<number, number>(
{ filter: (val: number) => val > 10 });
const it14: AsyncIterator<number> = new SimpleTransformIterator<number, number>({ map: (val: number) => val + 1 });
const it15: AsyncIterator<number> = new SimpleTransformIterator<number, number>(
{ transform: (val: number, cb: (result: number) => void) => cb(val + 1) });
}
function test_multitransformiterator() {
const it1: MultiTransformIterator<number, string> = new MultiTransformIterator<number, string>();
const it2: TransformIterator<number, string> = new MultiTransformIterator<number, string>();
const it3: AsyncIterator<string> = new MultiTransformIterator<number, string>();
const it4: AsyncIterator<number> = new MultiTransformIterator<string, number>(it1);
const it5: AsyncIterator<number> = new MultiTransformIterator<string, number>(it1, {});
const it6: AsyncIterator<number> = new MultiTransformIterator<string, number>({});
const it7: AsyncIterator<number> = new MultiTransformIterator<string, number>({ optional: true });
const it8: AsyncIterator<number> = new MultiTransformIterator<string, number>({ source: it1 });
}
function test_clonediterator() {
const it1: ClonedIterator<number> = new ClonedIterator<number>();
const it2: ClonedIterator<number> = new ClonedIterator<number>(it1);
}
+164
View File
@@ -0,0 +1,164 @@
// Type definitions for asynciterator 1.1
// Project: https://github.com/rubenverborgh/AsyncIterator#readme
// Definitions by: Ruben Taelman <https://github.com/rubensworks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
import { EventEmitter } from "events";
export abstract class AsyncIterator<T> extends NodeJS.EventEmitter {
protected static STATES: ['INIT', 'OPEN', 'CLOSING', 'CLOSED', 'ENDED'];
protected static INIT: 0;
protected static OPEN: 1;
protected static CLOSING: 2;
protected static CLOSED: 3;
protected static ENDED: 4;
protected _state: number;
protected _readable: boolean;
protected _destination?: AsyncIterator<any>;
readable: boolean;
closed: boolean;
ended: boolean;
constructor();
read(): T;
each(callback: (data: T) => void, self?: any): void;
close(): void;
protected _changeState(newState: number, eventAsync?: boolean): void;
private _hasListeners(eventName: string | symbol): boolean;
// tslint:disable-next-line ban-types
private _addSingleListener(eventName: string | symbol, listener: Function): void;
protected _end(): void;
getProperty(propertyName: string, callback?: (value: any) => void): any;
setProperty(propertyName: string, value: any): void;
getProperties(): {[id: string]: any};
setProperties(properties: {[id: string]: any}): void;
copyProperties(source: AsyncIterator<any>, propertyNames: string[]): void;
toString(): string;
protected _toStringDetails(): string;
transform<T2>(options?: SimpleTransformIteratorOptions<T, T2>): SimpleTransformIterator<T, T2>;
map<T2>(mapper: (item: T) => T2, self?: object): SimpleTransformIterator<T, T2>;
filter(filter: (item: T) => boolean, self?: object): SimpleTransformIterator<T, T>;
prepend(items: T[]): SimpleTransformIterator<T, T>;
append<T>(items: T[]): SimpleTransformIterator<T, T>;
surround<T>(prepend: T[], append: T[]): SimpleTransformIterator<T, T>;
skip<T>(offset: number): SimpleTransformIterator<T, T>;
take<T>(limit: number): SimpleTransformIterator<T, T>;
range<T>(start: number, end: number): SimpleTransformIterator<T, T>;
clone(): ClonedIterator<T>;
static range(start?: number, end?: number, step?: number): IntegerIterator;
}
export class EmptyIterator<T> extends AsyncIterator<T> {
_state: 4;
}
export class SingletonIterator<T> extends AsyncIterator<T> {
constructor(item?: T);
}
export class ArrayIterator<T> extends AsyncIterator<T> {
constructor(items?: T[]);
}
export interface IntegerIteratorOptions {
step?: number;
end?: number;
start?: number;
}
export class IntegerIterator extends AsyncIterator<number> {
protected _step: number;
protected _last: number;
protected _next: number;
constructor(options?: IntegerIteratorOptions);
}
export interface BufferedIteratorOptions {
maxBufferSize?: number;
autoStart?: boolean;
}
export class BufferedIterator<T> extends AsyncIterator<T> {
maxBufferSize: number;
protected _pushedCount: number;
protected _buffer: T[];
protected _init(autoStart: boolean): void;
protected _begin(done: () => void): void;
protected _read(count: number, done: () => void): void;
protected _push(item: T): void;
protected _fillBuffer(): void;
protected _completeClose(): void;
protected _flush(done: () => void): void;
constructor(options?: BufferedIteratorOptions);
}
export interface TransformIteratorOptions<S> extends BufferedIteratorOptions {
optional?: boolean;
source?: AsyncIterator<S>;
}
export class TransformIterator<S, T> extends BufferedIterator<T> {
protected _optional: boolean;
source: AsyncIterator<S>;
protected _validateSource(source: AsyncIterator<S>, allowDestination?: boolean): void;
protected _transform(item: S, done: (result: T) => void): void;
protected _closeWhenDone(): void;
constructor(source?: AsyncIterator<S> | TransformIteratorOptions<S>, options?: TransformIteratorOptions<S>);
}
export interface SimpleTransformIteratorOptions<S, T> extends TransformIteratorOptions<S> {
offset?: number;
limit?: number;
prepend?: T[];
append?: T[];
filter?(item: S): boolean;
map?(item: S): T;
transform?(item: S, callback: (result: T) => void): void;
}
export class SimpleTransformIterator<S, T> extends TransformIterator<S, T> {
protected _offset: number;
protected _limit: number;
protected _prepender?: ArrayIterator<T>;
protected _appender?: ArrayIterator<T>;
protected _filter?(item: S): boolean;
protected _map?(item: S): T;
protected _transform(item: S, done: (result: T) => void): void;
protected _insert(inserter: AsyncIterator<S>, done: () => void): void;
constructor(source?: AsyncIterator<S> | SimpleTransformIteratorOptions<S, T>,
options?: SimpleTransformIteratorOptions<S, T>);
}
export class MultiTransformIterator<S, T> extends TransformIterator<S, T> {
_transformerQueue: S[];
protected _createTransformer(): AsyncIterator<S>;
constructor(source?: AsyncIterator<S> | TransformIteratorOptions<S>, options?: TransformIteratorOptions<S>);
}
export class ClonedIterator<T> extends TransformIterator<T, T> {
_readPosition: number;
constructor(source?: AsyncIterator<T>);
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"asynciterator-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -1
View File
@@ -1,8 +1,9 @@
import { Disposable } from "event-kit";
import KeymapManager = require("atom-keymap");
import * as ImportTest from "atom-keymap";
declare const element: HTMLElement;
declare let sub: EventKit.Disposable;
declare let sub: Disposable;
declare const event: KeyboardEvent;
// NPM Examples ===============================================================
+35 -23
View File
@@ -4,15 +4,17 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="event-kit" />
import { Disposable } from "event-kit";
declare global {
namespace AtomKeymap {
/** The event objects that are passed into the callbacks which the user provides to
/**
* The event objects that are passed into the callbacks which the user provides to
* specific API calls.
*/
namespace Events {
/** This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
/**
* This custom subclass of CustomEvent exists to provide the ::abortKeyBinding
* method, as well as versions of the ::stopPropagation methods that record the
* intent to stop propagation so event bubbling can be properly simulated for
* detached elements.
@@ -70,12 +72,14 @@ declare global {
}
interface AddedKeystrokeResolver {
/** The currently resolved keystroke string. If your function returns a falsy
/**
* The currently resolved keystroke string. If your function returns a falsy
* value, this is how Atom will resolve your keystroke.
*/
keystroke: string;
/** The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
/**
* The raw DOM 3 `KeyboardEvent` being resolved. See the DOM API documentation
* for more details.
*/
event: KeyboardEvent;
@@ -83,7 +87,8 @@ declare global {
/** The OS-specific name of the current keyboard layout. */
layoutName: string;
/** An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
/**
* An object mapping DOM 3 `KeyboardEvent.code` values to objects with the
* typed character for that key in each modifier state, based on the current
* operating system layout.
*/
@@ -91,7 +96,8 @@ declare global {
}
}
/** The option objects that the user is expected to fill out and provide to
/**
* The option objects that the user is expected to fill out and provide to
* specific API calls.
*/
namespace Options {
@@ -120,7 +126,8 @@ declare global {
/** Determines whether the given keystroke matches any contained within this binding. */
matches(keystroke: string): boolean;
/** Compare another KeyBinding to this instance.
/**
* Compare another KeyBinding to this instance.
* Returns <= -1 if the argument is considered lesser or of lower priority.
* Returns 0 if this binding is equivalent to the argument.
* Returns >= 1 if the argument is considered greater or of higher priority.
@@ -128,7 +135,8 @@ declare global {
compare(other: KeyBinding): number;
}
/** Allows commands to be associated with keystrokes in a context-sensitive way.
/**
* Allows commands to be associated with keystrokes in a context-sensitive way.
* In Atom, you can access a global instance of this object via `atom.keymaps`.
*/
interface KeymapManager {
@@ -143,29 +151,30 @@ declare global {
destroy(): void;
// Event Subscription
/** Invoke the given callback when one or more keystrokes completely match a key binding. */
/**
* Invoke the given callback when one or more keystrokes completely match a
* key binding.
*/
onDidMatchBinding(callback: (event: Events.FullKeybindingMatch) => void):
EventKit.Disposable;
Disposable;
/** Invoke the given callback when one or more keystrokes partially match a binding. */
onDidPartiallyMatchBindings(callback: (event: Events.PartialKeybindingMatch) =>
void): EventKit.Disposable;
void): Disposable;
/** Invoke the given callback when one or more keystrokes fail to match any bindings. */
onDidFailToMatchBinding(callback: (event: Events.FailedKeybindingMatch) =>
void): EventKit.Disposable;
void): Disposable;
/** Invoke the given callback when a keymap file is reloaded. */
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
onDidReloadKeymap(callback: (event: Events.KeymapLoaded) => void): Disposable;
/** Invoke the given callback when a keymap file is unloaded. */
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void):
EventKit.Disposable;
onDidUnloadKeymap(callback: (event: Events.KeymapLoaded) => void): Disposable;
/** Invoke the given callback when a keymap file not able to be loaded. */
onDidFailToReadFile(callback: (error: Events.FailedKeymapFileRead) => void):
EventKit.Disposable;
Disposable;
// Adding and Removing Bindings
/** Construct KeyBindings from an object grouping them by CSS selector. */
@@ -174,7 +183,7 @@ declare global {
/** Add sets of key bindings grouped by CSS selector. */
add(source: string, bindings: { [key: string]: { [key: string]: string }},
priority?: number): EventKit.Disposable;
priority?: number): Disposable;
// Accessing Bindings
/** Get all current key bindings. */
@@ -192,13 +201,15 @@ declare global {
loadKeymap(bindingsPath: string, options?: { watch?: boolean, priority?: number }):
void;
/** Cause the keymap to reload the key bindings file at the given path whenever
/**
* Cause the keymap to reload the key bindings file at the given path whenever
* it changes.
*/
watchKeymap(filePath: string, options?: { priority: number }): void;
// Managing Keyboard Events
/** Dispatch a custom event associated with the matching key binding for the
/**
* Dispatch a custom event associated with the matching key binding for the
* given `KeyboardEvent` if one can be found.
*/
handleKeyboardEvent(event: KeyboardEvent): void;
@@ -208,9 +219,10 @@ declare global {
/** Customize translation of raw keyboard events to keystroke strings. */
addKeystrokeResolver(resolver: (event: Events.AddedKeystrokeResolver) => string):
EventKit.Disposable;
Disposable;
/** Get the number of milliseconds allowed before pending states caused by
/**
* Get the number of milliseconds allowed before pending states caused by
* partial matches of multi-keystroke bindings are terminated.
*/
getPartialMatchTimeout(): number;
+1 -1
View File
@@ -8,7 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
+2 -30
View File
@@ -1,36 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"class-name": true,
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 110],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
"max-line-length": [true, 100],
"no-any": true
}
}
@@ -1,3 +1,4 @@
import { AtomEnvironment, TestRunnerParams } from "atom";
import { createRunner } from "atom-mocha-test-runner";
import defaultMochaRunner = require("atom-mocha-test-runner");
@@ -20,12 +21,12 @@ testRunner = createRunner({
testSuffixes: ["test.file"],
});
declare const atom: AtomCore.AtomEnvironment;
declare const atom: AtomEnvironment;
declare const blob: object;
declare let num: number;
async function runTests(): Promise<number> {
const runnerArgs: AtomCore.Structures.TestRunnerArgs = {
const runnerArgs: TestRunnerParams = {
testPaths: ["/var/test"],
logFile: "/var/log",
headless: false,
+4 -3
View File
@@ -5,7 +5,8 @@
// TypeScript Version: 2.3
/// <reference types="mocha" />
/// <reference types="atom" />
import { TestRunner } from "atom";
interface AtomMochaOptions {
/** Which reporter to use on the terminal. */
@@ -30,9 +31,9 @@ interface AtomMochaOptions {
// module.exports = createRunner()
// module.exports.createRunner = createRunner
// Which is what we're trying to model here.
interface TestRunnerExport extends AtomCore.TestRunner {
interface TestRunnerExport extends TestRunner {
createRunner(options?: AtomMochaOptions, mochaConfigFunction?:
(mocha: Mocha) => void): AtomCore.TestRunner;
(mocha: Mocha) => void): TestRunner;
}
declare const runner: TestRunnerExport;
+1 -1
View File
@@ -9,7 +9,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
+1 -29
View File
@@ -1,36 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"class-name": true,
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 100],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
"no-any": true
}
}
-60
View File
@@ -1,60 +0,0 @@
## Atom API Type Definitions
TypeScript type definitions for the [Atom Text Editor](https://atom.io/) public API, which is used to develop packages for the editor. Documentation for the public API can be found [here](https://atom.io/docs/api/v1.21.0/).
### Exports
#### The "atom" Variable
These definitions declare a global static variable named "atom" as ambient. Once these definitions have been referenced within your project, you will be able to access properties and member functions from the [AtomEnvironment](https://atom.io/docs/api/v1.21.0/AtomEnvironment) class off of this variable, as it is an instance of that class.
```ts
if (atom.inDevMode()) {}
```
#### The Atom Namespace
All of the types used by or referenced by the Atom public API have been pulled into the Atom namespace, providing a consistent and easy way to access each of them, without having to care about where that type actually lives within the Atom codebase.
```ts
function example(buffer: Atom.TextBuffer) {}
```
#### The AtomCore Namespace
All classes which are core to Atom itself have been provided under the AtomCore namespace.
```ts
function example(cursor: AtomCore.Cursor) {}
```
### Service Type Definitions
There are many services provided by other Atom packages that you may want to use within your own Atom package. We bundle type definitions for several of these services with these type definitions. All type definitions for services are available only through ES6 imports.
```ts
import { AutocompleteProvider } from "atom/autocomplete-plus";
let completionProvider: AutocompleteProvider;
```
The currently supported services are:
- [Autocomplete](https://github.com/atom/autocomplete-plus) (atom/autocomplete-plus)
- [Linter](https://github.com/atom/linter) (atom/linter)
- [Status Bar](https://github.com/atom/status-bar) (atom/status-bar)
### Exposing Private Methods and Properties
[Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) can be used to augment any of the types used within Atom. As an example, if we wanted to reveal the private ```triggerActivationHook``` method within the PackageManager class, then we would create a file with the following contents:
```ts
// <<filename>>.d.ts
declare namespace AtomCore {
interface PackageManager {
triggerActivationHook(name: string): void;
triggerDeferredActivationHooks(): void;
}
}
```
Once this file is either referenced or included within your project, then this new member function would be freely usable on instances of the PackageManager class without TypeScript reporting errors.
+82 -81
View File
@@ -12,59 +12,59 @@ declare let regExp: RegExp;
declare let element: HTMLElement;
declare let elements: HTMLElement[];
declare const div: HTMLDivElement;
declare const keyboardEvent: KeyboardEvent;
declare const event: KeyboardEvent;
declare let buffer: TextBuffer.TextBuffer;
declare const color: AtomCore.Color;
declare let cursor: AtomCore.Cursor;
declare let cursors: AtomCore.Cursor[];
declare let decoration: AtomCore.Decoration;
declare let decorations: AtomCore.Decoration[];
declare let decorationLayerProps: AtomCore.Options.DecorationLayerProps;
declare let dir: PathWatcher.Directory;
declare let dirs: PathWatcher.Directory[];
declare let displayMarker: TextBuffer.DisplayMarker;
declare let displayMarkers: TextBuffer.DisplayMarker[];
declare let displayMarkerLayer: TextBuffer.DisplayMarkerLayer;
declare let dock: AtomCore.Dock;
declare let editor: AtomCore.TextEditor;
declare let editors: AtomCore.TextEditor[];
declare let emitter: EventKit.Emitter;
declare let file: PathWatcher.File;
declare let grammar: FirstMate.Grammar;
declare let grammars: FirstMate.Grammar[];
declare let gutter: AtomCore.Gutter;
declare let gutters: AtomCore.Gutter[];
declare let historyPaths: AtomCore.Structures.HistoryProject[];
declare let layerDecoration: AtomCore.LayerDecoration;
declare let marker: TextBuffer.Marker;
declare let markers: TextBuffer.Marker[];
declare let markerLayer: TextBuffer.MarkerLayer;
declare let notification: AtomCore.Notification;
declare let notifications: AtomCore.Notification[];
declare let pack: AtomCore.Package;
declare let packs: AtomCore.Package[];
declare let pane: AtomCore.Pane;
declare let panes: AtomCore.Pane[];
declare let paneContainer: AtomCore.Dock|AtomCore.WorkspaceCenter;
declare let panel: AtomCore.Panel;
declare let panels: AtomCore.Panel[];
declare let pos: TextBuffer.Point;
declare let posArr: TextBuffer.Point[];
declare let project: AtomCore.Project;
declare let range: TextBuffer.Range;
declare let ranges: TextBuffer.Range[];
declare let registry: FirstMate.GrammarRegistry;
declare let repository: AtomCore.GitRepository;
declare let repositories: AtomCore.GitRepository[];
declare let scopeDescriptor: AtomCore.ScopeDescriptor;
declare let selection: AtomCore.Selection;
declare let selections: AtomCore.Selection[];
declare let styleManager: AtomCore.StyleManager;
declare let subscription: EventKit.Disposable;
declare let subscriptions: EventKit.CompositeDisposable;
declare let tooltips: AtomCore.Structures.Tooltip[];
declare let workspaceCenter: AtomCore.WorkspaceCenter;
declare let buffer: Atom.TextBuffer;
declare const color: Atom.Color;
declare let cursor: Atom.Cursor;
declare let cursors: Atom.Cursor[];
declare let decoration: Atom.Decoration;
declare let decorations: Atom.Decoration[];
declare let decorationLayerProps: Atom.DecorationLayerOptions;
declare let dir: Atom.Directory;
declare let dirs: Atom.Directory[];
declare let displayMarker: Atom.DisplayMarker;
declare let displayMarkers: Atom.DisplayMarker[];
declare let displayMarkerLayer: Atom.DisplayMarkerLayer;
declare let dock: Atom.Dock;
declare let editor: Atom.TextEditor;
declare let editors: Atom.TextEditor[];
declare let emitter: Atom.Emitter;
declare let file: Atom.File;
declare let grammar: Atom.Grammar;
declare let grammars: Atom.Grammar[];
declare let gutter: Atom.Gutter;
declare let gutters: Atom.Gutter[];
declare let historyPaths: Atom.ProjectHistory[];
declare let layerDecoration: Atom.LayerDecoration;
declare let marker: Atom.Marker;
declare let markers: Atom.Marker[];
declare let markerLayer: Atom.MarkerLayer;
declare let notification: Atom.Notification;
declare let notifications: Atom.Notification[];
declare let pack: Atom.Package;
declare let packs: Atom.Package[];
declare let pane: Atom.Pane;
declare let panes: Atom.Pane[];
declare let paneContainer: Atom.Dock|Atom.WorkspaceCenter;
declare let panel: Atom.Panel;
declare let panels: Atom.Panel[];
declare let pos: Atom.Point;
declare let posArr: Atom.Point[];
declare let project: Atom.Project;
declare let range: Atom.Range;
declare let ranges: Atom.Range[];
declare let registry: Atom.GrammarRegistry;
declare let repository: Atom.GitRepository;
declare let repositories: Atom.GitRepository[];
declare let scopeDescriptor: Atom.ScopeDescriptor;
declare let selection: Atom.Selection;
declare let selections: Atom.Selection[];
declare let styleManager: Atom.StyleManager;
declare let subscription: Atom.Disposable;
declare let subscriptions: Atom.CompositeDisposable;
declare let tooltips: Atom.Tooltip[];
declare let workspaceCenter: Atom.WorkspaceCenter;
// AtomEnvironment ============================================================
function testAtomEnvironment() {
@@ -125,8 +125,8 @@ function testAtomEnvironment() {
});
subscription = atom.workspace.observeTextEditors((editor) => {
subscription = editor.onDidStopChanging((keyboardEvent) => {
for (const change of keyboardEvent.changes) {
subscription = editor.onDidStopChanging((event) => {
for (const change of event.changes) {
change.newExtent;
}
});
@@ -276,9 +276,6 @@ function testCommandRegistry() {
// CompositeDisposable ========================================================
function testCompositeDisposable() {
// Properties
bool = subscriptions.disposed;
// Construction and Lifecycle
subscriptions = new Atom.CompositeDisposable();
new Atom.CompositeDisposable(subscription);
@@ -482,7 +479,7 @@ function testCursor() {
// TestRunner =================================================================
function testTestRunner() {
const testRunner: AtomCore.TestRunner = (params) => {
const testRunner: Atom.TestRunner = (params) => {
const delegate = params.buildDefaultApplicationDelegate();
const environment = params.buildAtomEnvironment({
applicationDelegate: delegate,
@@ -803,7 +800,6 @@ function testDisplayMarkerLayer() {
// Disposable =================================================================
function testDisposable() {
bool = subscription.disposed;
if (subscription.disposalAction) subscription.disposalAction();
subscription.dispose();
}
@@ -829,8 +825,12 @@ function testDock() {
subscription = dock.onDidChangeActivePane(pane => pane.activate());
subscription = dock.observeActivePane(pane => pane.activate());
subscription = dock.onDidAddPaneItem(event => event.index && event.item && event.pane);
subscription = dock.onWillDestroyPaneItem(event => event.index && event.item && event.pane);
subscription = dock.onDidDestroyPaneItem(event => event.index && event.item && event.pane);
subscription = dock.onWillDestroyPaneItem(event => {
event.index && event.item && event.pane;
});
subscription = dock.onDidDestroyPaneItem(event => {
event.index && event.item && event.pane;
});
// Pane Items
objs = dock.getPaneItems();
@@ -847,8 +847,6 @@ function testDock() {
function testEmitter() {
emitter = new Atom.Emitter();
bool = emitter.disposed;
emitter.clear();
emitter.dispose();
@@ -1113,7 +1111,7 @@ function testKeymapManager() {
subscription = manager.add("a", {}, 0);
// Accessing Bindings
let bindings: AtomKeymap.KeyBinding[] = manager.getKeyBindings();
let bindings: Atom.KeyBinding[] = manager.getKeyBindings();
bindings = manager.findKeyBindings();
bindings = manager.findKeyBindings({ command: "a" });
bindings = manager.findKeyBindings({ keystrokes: "a" });
@@ -1127,8 +1125,8 @@ function testKeymapManager() {
manager.loadKeymap("Test.file", { watch: true, priority: 0});
// Managing Keyboard Events
manager.handleKeyboardEvent(keyboardEvent);
manager.keystrokeForKeyboardEvent(keyboardEvent);
manager.handleKeyboardEvent(event);
manager.keystrokeForKeyboardEvent(event);
subscription = manager.addKeystrokeResolver((event): string => {
event.layoutName;
@@ -1151,10 +1149,6 @@ function testLayerDecoration() {
function testMarker() {
// Properties
num = marker.id;
bool = marker.tailed;
bool = marker.reversed;
bool = marker.valid;
str = marker.invalidate;
// Lifecycle
marker = marker.copy({
@@ -1301,8 +1295,8 @@ function testNotification() {
});
// Event Subscription
subscription = notification.onDidDismiss(notification => notification.dismissed);
subscription = notification.onDidDisplay(notification => notification.timestamp);
subscription = notification.onDidDismiss(notification => notification.getType());
subscription = notification.onDidDisplay(notification => notification.getMessage());
// Methods
str = notification.getType();
@@ -1377,7 +1371,7 @@ function testPackageManager() {
subscription = atom.packages.onDidActivatePackage(pack => pack.name);
subscription = atom.packages.onDidDeactivatePackage(pack => pack.path);
subscription = atom.packages.onDidLoadPackage(pack => pack.isCompatible());
subscription = atom.packages.onDidUnloadPackage(pack => pack.bundledPackage);
subscription = atom.packages.onDidUnloadPackage(pack => pack.name);
// Package system data
str = atom.packages.getApmPath();
@@ -1618,7 +1612,7 @@ function testPoint() {
point.isGreaterThanOrEqual([0, 0]);
// Operations
const frozenPoint: Readonly<TextBuffer.Point> = point.freeze();
const frozenPoint: Readonly<Atom.Point> = point.freeze();
point = point.translate(point);
point.translate([0, 0]);
@@ -1644,7 +1638,7 @@ function testProject() {
});
subscription = project.onDidAddBuffer(buffer => buffer.id);
subscription = project.observeBuffers(buffer => buffer.file);
subscription = project.observeBuffers(buffer => buffer.getUri());
// Accessing the git repository
repositories = project.getRepositories();
@@ -1707,7 +1701,7 @@ function testRange() {
nums = range.getRows();
// Operations
const frozenRange: Readonly<TextBuffer.Range> = range.freeze();
const frozenRange: Readonly<Atom.Range> = range.freeze();
range = range.union(range);
range = range.translate(pos);
@@ -1923,7 +1917,7 @@ function testStyleManager() {
// Task =======================================================================
function testTask() {
let task: AtomCore.Task = Atom.Task.once("File.path", {}, () => {});
let task: Atom.Task = Atom.Task.once("File.path", {}, () => {});
task = new Atom.Task("File.path");
task.start({}, () => {});
@@ -2282,7 +2276,7 @@ function testTextEditor() {
subscription = editor.onDidChangeSoftWrapped(softWrapped => {});
subscription = editor.onDidChangeEncoding(encoding => {});
subscription = editor.observeGrammar(grammar => grammar.name);
subscription = editor.onDidChangeGrammar(grammar => grammar.scopeName);
subscription = editor.onDidChangeGrammar(grammar => grammar.name);
subscription = editor.onDidChangeModified(modified => {});
subscription = editor.onDidConflict(() => {});
subscription = editor.onWillInsertText(event => event.cancel && event.text);
@@ -2997,8 +2991,9 @@ function testWorkspace() {
subscription = atom.workspace.observeActivePane(pane => pane.activate());
subscription = atom.workspace.onDidAddPaneItem(event => event.index && event.item &&
event.pane);
subscription = atom.workspace.onWillDestroyPaneItem(event => event.index &&
event.item && event.pane);
subscription = atom.workspace.onWillDestroyPaneItem(event => {
event.index && event.item && event.pane;
});
subscription = atom.workspace.onDidDestroyPaneItem(event => event.index &&
event.item && event.pane);
subscription = atom.workspace.onDidAddTextEditor(event => event.index && event.pane &&
@@ -3045,7 +3040,13 @@ function testWorkspace() {
if (result) obj = result;
}
atom.workspace.addOpener(() => element);
atom.workspace.addOpener((uri) => {
if (uri === "test://") {
return {
getTitle: () => "Test Title",
};
}
});
atom.workspace.buildTextEditor(obj);
+128
View File
@@ -0,0 +1,128 @@
import "../index";
declare module "atom" {
interface ConfigValues {
/**
* Suggestions will show as you type if this preference is enabled. If it is
* disabled, you can still see suggestions by using the keymapping for
* 'autocomplete-plus:activate' (shown below).
*/
"autocomplete-plus.enableAutoActivation": boolean;
/**
* If you are experiencing performance issues when typing, you should try
* increasing this value to a non-zero number (e.g. 100).
*/
"autocomplete-plus.autoActivationDelay": number;
/** The suggestion list will only show this many suggestions. */
"autocomplete-plus.maxVisibleSuggestions": number;
/**
* You should use the key(s) indicated here to confirm a suggestion from the
* suggestion list and have it inserted into the file.
*/
"autocomplete-plus.confirmCompletion":
| "tab"
| "enter"
| "tab and enter"
| "tab always, enter when suggestion explicitly selected";
/**
* Disable this if you want to bind your own keystrokes to move around the
* suggestion list. You will also need to add definitions to your keymap.
*/
"autocomplete-plus.useCoreMovementCommands": boolean;
/**
* Suggestions will not be provided for files matching this list, e.g. *.md
* for Markdown files. To blacklist more than one file extension, use comma
* as a separator, e.g. ["*.md", "*.txt"] (both Markdown and text files).
*/
"autocomplete-plus.fileBlacklist": string[];
/** Suggestions will not be provided for scopes matching this list. */
"autocomplete-plus.scopeBlacklist": string[];
/**
* For grammars with no registered provider(s), the default provider will
* include completions from all buffers, instead of just the buffer you are
* currently editing.
*/
"autocomplete-plus.includeCompletionsFromAllBuffers": boolean;
/**
* Fuzzy searching is performed if this is disabled; if it is enabled, suggestions
* must begin with the prefix from the current word.
*/
"autocomplete-plus.strictMatching": boolean;
/**
* Only autocomplete when you've typed at least this many characters.
* Note: May not affect external providers.
*/
"autocomplete-plus.minimumWordLength": number;
/**
* The package comes with a built-in provider that will provide suggestions
* using the words in your current buffer or all open buffers. You will get
* better suggestions by installing additional autocomplete+ providers.
* To stop using the built-in provider, disable this option.
*/
"autocomplete-plus.enableBuiltinProvider": boolean;
/** Don't use the built-in provider for these selector(s). */
"autocomplete-plus.builtinProviderBlacklist": string;
/**
* If enabled, typing `backspace` will show the suggestion list if suggestions
* are available. If disabled, suggestions will not be shown while backspacing.
*/
"autocomplete-plus.backspaceTriggersAutocomplete": boolean;
/**
* If enabled, automatically insert suggestion on manual activation with
* 'autocomplete-plus:activate' when there is only one match.
*/
"autocomplete-plus.enableAutoConfirmSingleSuggestion": boolean;
/**
* With 'Cursor' the suggestion list appears at the cursor's position.
* With 'Word' it appears at the beginning of the word that's being completed.
*/
"autocomplete-plus.suggestionListFollows": "Word"|"Cursor";
/**
* If you're having trouble with autocomplete, you may consider falling back
* to the Symbol provider and filing an issue.
*/
"autocomplete-plus.defaultProvider": "Subsequence"|"Symbol";
/** Don't auto-activate when any of these classes are present in the editor. */
"autocomplete-plus.suppressActivationForEditorClasses": string[];
/**
* Completing a suggestion consumes text following the cursor matching the
* suffix of the chosen suggestion.
*/
"autocomplete-plus.consumeSuffix": boolean;
/**
* -EXPERIMENTAL- Prefers runs of consecutive characters, acronyms and start
* of words.
*/
"autocomplete-plus.useAlternateScoring": boolean;
/** Gives words near the cursor position a higher score than those far away. */
"autocomplete-plus.useLocalityBonus": boolean;
/** Identifies non-latin alphabet characters as letters. */
"autocomplete-plus.enableExtendedUnicodeSupport": boolean;
/**
* Should similar suggestions be removed from the list? If so how to determine
* they are similar.
*/
"autocomplete-plus.similarSuggestionRemoval": "none"|"textOrSnippet";
}
}
@@ -1,16 +1,20 @@
// Autocomplete Plus 2.x
// https://atom.io/packages/autocomplete-plus
/// <reference path="./config.d.ts" />
import { Point, ScopeDescriptor, TextEditor } from "../index";
/** The parameters passed into getSuggestions by Autocomplete+. */
export interface SuggestionsRequestedEvent {
/** The current TextEditor. */
editor: AtomCore.TextEditor;
editor: TextEditor;
/** The position of the cursor. */
bufferPosition: TextBuffer.Point;
bufferPosition: Point;
/** The scope descriptor for the current cursor position. */
scopeDescriptor: AtomCore.ScopeDescriptor;
scopeDescriptor: ScopeDescriptor;
/** The prefix for the word immediately preceding the current cursor position. */
prefix: string;
@@ -21,26 +25,30 @@ export interface SuggestionsRequestedEvent {
/** The parameters passed into onDidInsertSuggestion by Autocomplete+. */
export interface SuggestionInsertedEvent {
editor: AtomCore.TextEditor;
triggerPosition: TextBuffer.Point;
editor: TextEditor;
triggerPosition: Point;
suggestion: TextSuggestion|SnippetSuggestion;
}
/** An autocompletion suggestion for the user.
/**
* An autocompletion suggestion for the user.
* Primary data type for the Atom Autocomplete+ service.
*/
export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** A string that will show in the UI for this suggestion.
/**
* A string that will show in the UI for this suggestion.
* When not set, snippet || text is displayed.
*/
displayText?: string;
/** The text immediately preceding the cursor, which will be replaced by the text.
/**
* The text immediately preceding the cursor, which will be replaced by the text.
* If not provided, the prefix passed into getSuggestions will be used.
*/
replacementPrefix?: string;
/** The suggestion type. It will be converted into an icon shown against the
/**
* The suggestion type. It will be converted into an icon shown against the
* suggestion.
*/
type?: string;
@@ -51,7 +59,8 @@ export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** Use this instead of leftLabel if you want to use html for the left label. */
leftLabelHTML?: string;
/** An indicator (e.g. function, variable) denoting the "kind" of suggestion this
/**
* An indicator (e.g. function, variable) denoting the "kind" of suggestion this
* represents.
*/
rightLabel?: string;
@@ -59,22 +68,26 @@ export interface Suggestion<T extends { text: string }|{ snippet: string }> {
/** Use this instead of rightLabel if you want to use html for the right label. */
rightLabelHTML?: string;
/** Class name for the suggestion in the suggestion list. Allows you to style your
/**
* Class name for the suggestion in the suggestion list. Allows you to style your
* suggestion via CSS, if desired.
*/
className?: string;
/** If you want complete control over the icon shown against the suggestion.
/**
* If you want complete control over the icon shown against the suggestion.
* e.g. iconHTML: <i class="icon-move-right"></i>
*/
iconHTML?: string;
/** A doc-string summary or short description of the suggestion. When specified, it
/**
* A doc-string summary or short description of the suggestion. When specified, it
* will be displayed at the bottom of the suggestions list.
*/
description?: string;
/** A url to the documentation or more information about this suggestion.
/**
* A url to the documentation or more information about this suggestion.
* When specified, a More.. link will be displayed in the description area.
*/
descriptionMoreURL?: string;
@@ -86,7 +99,8 @@ export interface TextSuggestion extends Suggestion<TextSuggestion> {
}
export interface SnippetSuggestion extends Suggestion<SnippetSuggestion> {
/** A snippet string. This will allow users to tab through function arguments
/**
* A snippet string. This will allow users to tab through function arguments
* or other options.
*/
snippet: string;
@@ -96,24 +110,28 @@ export type Suggestions = Array<TextSuggestion|SnippetSuggestion>;
/** The interface that all Autocomplete+ providers must implement. */
export interface AutocompleteProvider {
/** Defines the scope selector(s) (can be comma-separated) for which your provider
/**
* Defines the scope selector(s) (can be comma-separated) for which your provider
* should receive suggestion requests.
*/
selector: string;
/** Is called when a suggestion request has been dispatched by autocomplete+ to
/**
* Is called when a suggestion request has been dispatched by autocomplete+ to
* your provider. Return an array of suggestions (if any) in the order you would
* like them displayed to the user. Returning a Promise of an array of suggestions
* is also supported.
*/
getSuggestions(params: SuggestionsRequestedEvent): Suggestions|Promise<Suggestions>;
/** Defines the scope selector(s) (can be comma-separated) for which your provider
/**
* Defines the scope selector(s) (can be comma-separated) for which your provider
* should not be used.
*/
disableForSelector?: string;
/** A number to indicate its priority to be included in a suggestions request.
/**
* A number to indicate its priority to be included in a suggestions request.
* The default provider has an inclusion priority of 0. Higher priority providers
* can suppress lower priority providers with excludeLowerPriority.
*/
@@ -122,12 +140,14 @@ export interface AutocompleteProvider {
/** Will not use lower priority providers when this provider is used. */
excludeLowerPriority?: boolean;
/** A number to determine the sort order of suggestions. The default provider has
/**
* A number to determine the sort order of suggestions. The default provider has
* an suggestion priority of 1.
*/
suggestionPriority?: number;
/** Function that is called when a suggestion from your provider was inserted
/**
* Function that is called when a suggestion from your provider was inserted
* into the buffer.
*/
onDidInsertSuggestion?(params: SuggestionInsertedEvent): void;
+6541 -4087
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
import "../index";
declare module "atom" {
interface ConfigValues {
/** Lint tabs while they are still in preview status. */
"linter.lintPreviewTabs": boolean;
/** Lint files automatically when they are opened. */
"linter.lintOnOpen": boolean;
/**
* Lint files while typing, without the need to save (only for supported
* providers).
*/
"linter.lintOnChange": boolean;
/** Interval at which linting is done as you type (in ms). */
"linter.lintOnChangeInterval": number;
/** Ignore files matching this Glob. */
"linter.ignoreGlob": string;
/** Disabled providers. */
"linter.disabledProviders": string[];
}
}
+13 -8
View File
@@ -1,9 +1,13 @@
// Linter 2.x
// https://atom.io/packages/linter
/// <reference path="./config.d.ts" />
import { Disposable, Point, Range, TextEditor } from "../index";
export interface ReplacementSolution {
title?: string;
position: TextBuffer.Range;
position: Range;
priority?: number;
currentText?: string;
replaceWith: string;
@@ -11,7 +15,7 @@ export interface ReplacementSolution {
export interface CallbackSolution {
title?: string;
position: TextBuffer.Range;
position: Range;
priority?: number;
// tslint:disable-next-line:no-any
apply(): any;
@@ -24,7 +28,7 @@ export interface Message {
file: string;
/** The range of the message in the editor. */
position: TextBuffer.Range;
position: Range;
};
/** A reference to a different location in the editor. */
@@ -33,7 +37,7 @@ export interface Message {
file: string;
/** The point being referenced in that file. */
position?: TextBuffer.Point;
position?: Point;
};
/** An HTTP link to a resource explaining the issue. Default is a google search. */
@@ -51,7 +55,8 @@ export interface Message {
/** Possible solutions (which the user can invoke at will). */
solutions?: Array<ReplacementSolution|CallbackSolution>;
/** Markdown long description of the error. Accepts a callback so that you can
/**
* Markdown long description of the error. Accepts a callback so that you can
* do things like HTTP requests.
*/
description?: string|(() => Promise<string>|string);
@@ -63,8 +68,8 @@ export interface IndieDelegate {
clearMessages(): void;
setMessages(filePath: string, messages: Message[]): void;
setAllMessages(messages: Message[]): void;
onDidUpdate(callback: () => void): EventKit.Disposable;
onDidDestroy(callback: () => void): EventKit.Disposable;
onDidUpdate(callback: () => void): Disposable;
onDidDestroy(callback: () => void): Disposable;
dispose(): void;
}
@@ -73,5 +78,5 @@ export interface LinterProvider {
scope: "file"|"project";
lintsOnChange: boolean;
grammarScopes: string[];
lint(textEditor: AtomCore.TextEditor): Message[]|void|Promise<Message[]|undefined>;
lint(textEditor: TextEditor): Message[]|void|Promise<Message[]|undefined>;
}
+23
View File
@@ -0,0 +1,23 @@
import "../index";
declare module "atom" {
interface ConfigValues {
/** Show status bar at the bottom of the workspace. */
"status-bar.isVisible": boolean;
/** Fit the status-bar to the window's full-width. */
"status-bar.fullWidth": boolean;
/**
* Format for the cursor position status bar element, where %L is the line
* number and %C is the column number.
*/
"status-bar.cursorPositionFormat": string;
/**
* Format for the selection count status bar element, where %L is the line
* count and %C is the character count.
*/
"status-bar.selectionCountFormat": string;
}
}
@@ -1,13 +1,17 @@
// Status Bar 1.x
// https://atom.io/packages/status-bar
/// <reference path="./config.d.ts" />
export interface AddTileOptions {
/** A DOM element, a jQuery object, or a model object for which a view provider
/**
* A DOM element, a jQuery object, or a model object for which a view provider
* has been registered in the the view registry.
*/
item: object;
/** Determines the placement of the tile within the status bar. Lower priority
/**
* Determines the placement of the tile within the status bar. Lower priority
* will result in closer placement to the anchor.
*/
priority: number;
@@ -25,12 +29,14 @@ export interface Tile {
}
export interface StatusBar {
/** Add a tile to the left side of the status bar. Lower priority tiles are placed
/**
* Add a tile to the left side of the status bar. Lower priority tiles are placed
* further to the left.
*/
addLeftTile(options: AddTileOptions): Tile;
/** Add a tile to the right side of the status bar. Lower priority tiles are placed
/**
* Add a tile to the right side of the status bar. Lower priority tiles are placed
* further to the right.
*/
addRightTile(options: AddTileOptions): Tile;
+4 -4
View File
@@ -8,7 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -20,8 +20,8 @@
"files": [
"index.d.ts",
"atom-tests.ts",
"autocomplete-plus.d.ts",
"linter.d.ts",
"status-bar.d.ts"
"autocomplete-plus/index.d.ts",
"linter/index.d.ts",
"status-bar/index.d.ts"
]
}
+2 -30
View File
@@ -2,36 +2,8 @@
"extends": "dtslint/dt.json",
"rules": {
"await-promise": [true, "CancellablePromise"],
"class-name": true,
"indent": [true, "spaces", 4],
"jsdoc-format": true,
"max-line-length": [true, 110],
"quotemark": [true, "double", "avoid-escape"],
"trailing-comma": [true, {
"multiline": { "objects": "always", "arrays": "always", "functions": "never" },
"singleline": { "objects": "never", "arrays": "never", "functions": "never" }
}],
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-module",
"check-separator",
"check-type",
"check-typecast",
"check-rest-spread",
"check-preblock"
],
// Soon to be defaults.
"arrow-return-shorthand": [true, "multiline"],
"no-any": true,
"no-floating-promises": true,
"no-unbound-method": true,
"no-unsafe-any": true,
"number-literal-format": true,
"restrict-plus-operands": true,
"return-undefined": true,
"switch-final-break": true
"max-line-length": [true, 100],
"no-any": true
}
}
+6
View File
@@ -355,6 +355,12 @@ export class Popup {
domain: string,
/** your Auth0 client identifier obtained when creating the client in the Auth0 Dashboard */
clientId?: string,
/**
* identity provider whose login page will be displayed in the popup.
* If omitted the hosted login page is used.
* {@link https://auth0.com/docs/identityproviders}
*/
connection?: string,
/** url that the Auth0 will redirect after Auth with the Authorization Response */
redirectUri: string,
/**
+90 -11
View File
@@ -1,4 +1,4 @@
// Type definitions for auth0 2.4
// Type definitions for auth0 2.5
// Project: https://github.com/auth0/node-auth0
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>, Amiram Korach <https://github.com/amiram>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -87,6 +87,84 @@ export interface Rule {
order?: number;
}
export interface Client {
/**
* The name of the client.
*/
name?: string;
/**
* Free text description of the purpose of the Client. (Max character length: `140`).
*/
description?: string;
/**
* The id of the client.
*/
client_id?: string;
/**
* The client secret, it must not be public.
*/
client_secret?: string;
/**
* The type of application this client represents.
*/
app_type?: string;
/**
* The URL of the client logo (recommended size: 150x150).
*/
logo_uri?: string;
/**
* Whether this client a first party client or not.
*/
is_first_party?: boolean;
/**
* Whether this client will conform to strict OIDC specifications.
*/
oidc_conformant?: boolean;
/**
* The URLs that Auth0 can use to as a callback for the client.
*/
callbacks?: string[];
allowed_origins?: string[];
web_origins?: string[];
client_aliases?: string[];
allowed_clients?: string[];
allowed_logout_urls?: string[];
jwt_configuration?: any;
/**
* Client signing keys.
*/
signing_keys?: string[];
encryption_key?: any;
sso?: boolean;
/**
* `true` to disable Single Sign On, `false` otherwise (default: `false`)
*/
sso_disabled?: boolean;
/**
* `true` if this client can be used to make cross-origin authentication requests, `false` otherwise (default: `false`)
*/
cross_origin_auth?: boolean;
/**
* Url fo the location in your site where the cross origin verification takes place for the cross-origin auth flow when performing Auth in your own domain instead of Auth0 hosted login page.
*/
cross_origin_loc?: string;
/**
* `true` if the custom login page is to be used, `false` otherwise. (default: `true`)
*/
custom_login_page_on?: boolean;
custom_login_page?: string;
custom_login_page_preview?: string;
form_template?: string;
addons?: any;
/**
* Defines the requested authentication method for the token endpoint. Possible values are 'none' (public client without a client secret), 'client_secret_post' (client uses HTTP POST parameters) or 'client_secret_basic' (client uses HTTP Basic) ['none' or 'client_secret_post' or 'client_secret_basic']
*/
token_endpoint_auth_method?: string;
client_metadata?: any;
mobile?: any;
}
export interface User {
email?: string;
email_verified?: boolean;
@@ -338,21 +416,22 @@ export class ManagementClient {
// Clients
getClients(): Promise<User>;
getClients(cb: (err: Error, data: any) => void): void;
getClients(): Promise<Client[]>;
getClients(cb: (err: Error, clients: Client[]) => void): void;
getClient(params: ClientParams): Promise<User>;
getClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
getClient(params: ClientParams): Promise<Client>;
getClient(params: ClientParams, cb: (err: Error, client: Client) => void): void;
createClient(data: Data): Promise<User>;
createClient(data: Data, cb: (err: Error, data: any) => void): void;
createClient(data: Data): Promise<Client>;
createClient(data: Data, cb: (err: Error, client: Client) => void): void;
updateClient(params: ClientParams, data: Data): Promise<User>;
updateClient(params: ClientParams, data: Data, cb: (err: Error, data: any) => void): void;
updateClient(params: ClientParams, data: Data): Promise<Client>;
updateClient(params: ClientParams, data: Data, cb: (err: Error, client: Client) => void): void;
deleteClient(params: ClientParams): Promise<User>;
deleteClient(params: ClientParams, cb: (err: Error, data: any) => void): void;
deleteClient(params: ClientParams): Promise<void>;
deleteClient(params: ClientParams, cb: (err: Error) => void): void;
// Client Grants
getClientGrants(): Promise<User>;
getClientGrants(cb: (err: Error, data: any) => void): void;
+3 -3
View File
@@ -32,19 +32,19 @@ export interface DeviceOptions extends mqtt.IClientOptions {
* same as certPath, but can also accept a buffer containing client
* certificate data
*/
clientCert?: string;
clientCert?: string | Buffer;
/**
* same as keyPath, but can also accept a buffer containing private key
* data
*/
privateKey?: string;
privateKey?: string | Buffer;
/**
* same as caPath, but can also accept a buffer containing CA certificate
* data
*/
caCert?: string;
caCert?: string | Buffer;
/**
* set to "true" to automatically re-subscribe to topics after
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/moskalyk/typed-aws-lambda-mock-context
// Definitions by: Morgan Moskalyk <morgan.moskalyk@gmail.com>, Anand Nimkar <anand.a.nimkar@gmail.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare function context(options?: Options): Context;
+2 -2
View File
@@ -331,9 +331,9 @@ interface PolicyDocument {
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
*/
interface Statement {
Action: string | [string];
Action: string | string[];
Effect: string;
Resource: string | [string];
Resource: string | string[];
}
/**
+1
View File
@@ -3,6 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Johnny Estilles <https://github.com/johnnyestilles>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as t from 'babel-types';
+7 -2
View File
@@ -165,7 +165,12 @@ function CommonMethodsInEventStreamsAndProperties() {
{
// Calculator for grouped consecutive values until group is cancelled:
var events = [
interface Event {
id:number;
type:string;
val?:number;
}
var events: Event[] = [
{id: 1, type: "add", val: 3},
{id: 2, type: "add", val: -1},
{id: 1, type: "add", val: 2},
@@ -177,7 +182,7 @@ function CommonMethodsInEventStreamsAndProperties() {
{id: 1, type: "cancel"}
],
keyF = (event:{id:number}) => event.id,
limitF = (groupedStream:Bacon.EventStream<string, {id:number; type:string; val?:number}>) => {
limitF = (groupedStream:Bacon.EventStream<string, Event>) => {
var cancel = groupedStream.filter(x => x.type === "cancel").take(1),
adds = groupedStream.filter(x => x.type === "add");
return adds.takeUntil(cancel).map(x => x.val);
+1 -1
View File
@@ -203,5 +203,5 @@ declare namespace BezierJs {
}
declare module "bezier-js" {
export = BezierJs;
export = BezierJs.Bezier;
}
+17 -13
View File
@@ -10,12 +10,12 @@
/// <reference types="node" />
import BigInteger = require("bigi");
export interface Output {
export interface Out {
script: Buffer;
value: number;
}
export interface Input {
export interface In {
script: Buffer;
hash: Buffer;
index: number;
@@ -152,8 +152,8 @@ export class HDNode {
export class Transaction {
version: number;
locktime: number;
ins: Input[];
outs: Output[];
ins: In[];
outs: Out[];
constructor();
addInput(hash: Buffer, index: number, sequence?: number, scriptSig?: Buffer): number;
@@ -205,21 +205,25 @@ export class Transaction {
static isCoinbaseHash(buffer: Buffer): boolean;
}
export interface Input {
pubKeys: Buffer[];
signatures: Buffer[];
prevOutScript: Buffer;
prevOutType: string;
signType: string;
signScript: Buffer;
witness: boolean;
}
export class TransactionBuilder {
tx: Transaction;
inputs: Array<{ pubKeys: Buffer[],
signatures: Buffer[],
prevOutScript: Buffer,
prevOutType: string,
signType: string,
signScript: Buffer,
witness: boolean} >;
inputs: Input[];
constructor(network?: Network, maximumFeeRate?: number);
addInput(txhash: Buffer | string | Transaction, vout: number, sequence?: number, prevOutScript?: Buffer): number;
addOutput(scriptPubKey: Buffer, value: number): number;
addOutput(scriptPubKey: Buffer | string, value: number): number;
build(): Transaction;
@@ -537,7 +541,7 @@ export namespace script {
output: {
check(script: Buffer): boolean;
decode(buffer: Buffer): Buffer;
encode(data: Buffer[]): Buffer;
encode(data: Buffer): Buffer;
};
};
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/expressjs/body-parser
// Definitions by: Santi Albo <https://github.com/santialbo>, Vilic Vane <https://github.com/vilic>, Jonathan Häberle <https://github.com/dreampulse>, Gevik Babakhani <https://github.com/blendsdk>, Tomasz Łaziuk <https://github.com/tlaziuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.2
/// <reference types="node" />
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for bookshelfjs v0.9.3
// Type definitions for bookshelfjs v0.9.4
// Project: http://bookshelfjs.org/
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>, Vesa Poikajärvi <https://github.com/vesse>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -17,7 +17,7 @@ interface Bookshelf extends Bookshelf.Events<any> {
Collection: typeof Bookshelf.Collection;
plugin(name: string | string[] | Function, options?: any): Bookshelf;
transaction<T>(callback: (transaction: knex.Transaction) => BlueBird<T>): BlueBird<T>;
transaction<T>(callback: (transaction: knex.Transaction) => PromiseLike<T>): BlueBird<T>;
}
declare function Bookshelf(knex: knex): Bookshelf;
+2 -2
View File
@@ -4,7 +4,7 @@
// AJP <https://github.com/AJamesPhillips>
// Jinesh Shah <https://github.com/jineshshah36>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.4
export = Boom;
@@ -55,7 +55,7 @@ declare namespace Boom {
// Excluded this to aid typing of the other values. See tests for example casting to a custom interface to manipulate the payload
// [anyContent: string]: any;
}
/**
* Decorates an error with the boom properties
* @param error the error object to wrap. If error is already a boom object, it defaults to overriding the object with the new status code and message.
+2 -1011
View File
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -1,10 +1,11 @@
bowser.msedge === true;
bowser.test(['msie']) === true;
bowser.msedge; // $ExpectType boolean
bowser.test(['msie']); // $ExpectType boolean
bowser.a === bowser.c;
bowser.osversion > 10;
bowser.osversion === '10.1A';
bowser.compareVersions(['9.0', '10']);
bowser() === {android: true, x: true};
bowser().android; // $ExpectType boolean
bowser().x; // $ExpectType boolean
bowser.check({msie: "11"}, window.navigator.userAgent);
bowser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent);
bowser.isUnsupportedBrowser({msie: "10"}, window.navigator.userAgent);
+18 -21
View File
@@ -8,13 +8,12 @@ export = bowser;
export as namespace bowser;
declare namespace bowser {
export interface IBowserOS {
interface IBowserOS {
mac: boolean;
/**other than Windows Phone */
/** other than Windows Phone */
windows: boolean;
windowsphone: boolean;
/**other than android, chromeos, webos, tizen, and sailfish */
/** other than android, chromeos, webos, tizen, and sailfish */
linux: boolean;
chromeos: boolean;
android: boolean;
@@ -29,7 +28,7 @@ declare namespace bowser {
sailfish: boolean;
}
export interface IBowserVersions {
interface IBowserVersions {
chrome: boolean;
firefox: boolean;
msie: boolean;
@@ -53,14 +52,14 @@ declare namespace bowser {
kMeleon: boolean;
}
export interface IBowserEngines {
interface IBowserEngines {
/** IE <= 11 */
msie: boolean;
/**Chrome 0-27, Android <4.4, iOs, BB, etc. */
/** Chrome 0-27, Android <4.4, iOs, BB, etc. */
webkit: boolean;
/**Chrome >=28, Android >=4.4, Opera, etc. */
/** Chrome >=28, Android >=4.4, Opera, etc. */
blink: boolean;
/**Firefox, etc. */
/** Firefox, etc. */
gecko: boolean;
/** IE > 11 */
msedge: boolean;
@@ -68,37 +67,35 @@ declare namespace bowser {
tablet: boolean;
/** All detected mobile OSes are additionally flagged mobile, unless it's a tablet */
mobile: boolean;
}
export interface IBowserGrade {
interface IBowserGrade {
/** Grade A browser */
a: boolean;
/** Grade C browser */
c: boolean;
/** Grade X browser */
x: boolean;
/**A human readable name for this browser. E.g. 'Chrome', '' */
/** A human readable name for this browser. E.g. 'Chrome', '' */
name: string;
/**Version number for the browser. E.g. '32.0' */
version: string|number;
osversion: string|number;
/** Version number for the browser. E.g. '32.0' */
version: string | number;
osversion: string | number;
}
export interface IBowserDetection extends IBowserGrade, IBowserEngines, IBowserOS, IBowserVersions { }
interface IBowserDetection extends IBowserGrade, IBowserEngines, IBowserOS, IBowserVersions { }
export interface IBowserMinVersions {
interface IBowserMinVersions {
// { msie: "11", "firefox": "4" }
[index: string]: string;
}
export interface IBowser extends IBowserDetection {
interface IBowser extends IBowserDetection {
(): IBowserDetection;
test(browserList: string[]): boolean;
_detect(ua: string): IBowser;
compareVersions(versions: string[]): number;
check(minVersions: IBowserMinVersions, strictMode?: boolean|string, ua?: string): Boolean;
isUnsupportedBrowser(minVersions: IBowserMinVersions, strictMode?: boolean|string, ua?: string): boolean;
check(minVersions: IBowserMinVersions, strictMode?: boolean | string, ua?: string): boolean;
isUnsupportedBrowser(minVersions: IBowserMinVersions, strictMode?: boolean | string, ua?: string): boolean;
}
}
+2 -74
View File
@@ -1,79 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
// TODO
"interface-name": false
}
}
+1
View File
@@ -3,6 +3,7 @@
// Definitions by: Paul Lockwood <https://github.com/PaulLockwood>
// Michael Strobel <https://github.com/kryops>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/Floby/node-bunyan-blackhole
// Definitions by: Olivier Chevet <https://github.com/olivr70>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as Logger from "bunyan";
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/marnusw/bunyan-bugsnag
// Definitions by: Pasi Eronen <https://github.com/pasieronen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as Logger from 'bunyan';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/gluwer/bunyan-winston-adapter
// Definitions by: Steve Hipwell <https://github.com/stevehipwell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import * as bunyan from "bunyan";
import { LoggerInstance } from "winston";
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/rsamec/form
// Definitions by: Roman Samec <https://github.com/rsamec>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Source: typings/business-rules-engine/Validation.d.ts
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/hapijs/catbox
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen>, AJP <https://github.com/AJamesPhillips>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.4
import * as Boom from 'boom';
@@ -16,7 +16,7 @@ const mockContext: Mocha.IBeforeAndAfterContext = <any> {
}
};
chaiJestSnapshot.setFileName("filename");
chaiJestSnapshot.setFilename("filename");
chaiJestSnapshot.setTestName("testname");
chaiJestSnapshot.configureUsingMochaContext(mockContext);
chaiJestSnapshot.resetSnapshotRegistry();
+1 -1
View File
@@ -21,7 +21,7 @@ interface ChaiJestSnapshot {
(chai: any, utils: any): void;
/** Set snapshot file name */
setFileName(filename: string): void;
setFilename(filename: string): void;
/**
* Set snapshot test name
+2 -2
View File
@@ -411,8 +411,8 @@ declare namespace Chart {
interface ChartDataSets {
cubicInterpolationMode?: 'default' | 'monotone';
backgroundColor?: ChartColor | ChartColor[];
borderWidth?: number;
borderColor?: ChartColor;
borderWidth?: number | number[];
borderColor?: ChartColor | ChartColor[];
borderCapStyle?: string;
borderDash?: number[];
borderDashOffset?: number;
+1 -1
View File
@@ -172,7 +172,7 @@ interface Cheerio {
empty(): Cheerio;
html(): string;
html(): string | null;
html(html: string): Cheerio;
text(): string;
+2 -1
View File
@@ -7030,8 +7030,9 @@ declare namespace chrome.webNavigation {
/**
* The ID of the process runs the renderer for this tab.
* @since Chrome 22.
* @deprecated since Chrome 49. Frames are now uniquely identified by their tab ID and frame ID; the process ID is no longer needed and therefore ignored.
*/
processId: number;
processId?: number;
/** The ID of the tab in which the frame is. */
tabId: number;
/** The ID of the frame in the given tab. */
+3 -1
View File
@@ -2,6 +2,8 @@
// Project: https://github.com/chocolatechipui/chocolatechip-ui
// Definitions by: Robert Biggs <http://chocolatechip-ui.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// ChocolateChip-UI 3.9.1
/**
These TypeScript delcarations for ChocolateChip-UI contain interfaces for both ChocolateChipJS and jQuery. Depending on which library you are using, you will get the type interfaces appropriate for it.
@@ -1078,7 +1080,7 @@ interface JQueryStatic {
data: {
repeaterName?: any;
};
/**
* Use this value to output an index value in a template repeater.
*/
+1 -2
View File
@@ -1,7 +1,6 @@
// Type definitions for CKEditor
// Project: http://ckeditor.com/
// Definitions by: Ondrej Sevcik <https://github.com/ondrejsevcik>
// Thomas Wittwer <https://github.com/wittwert>
// Definitions by: Thomas Wittwer <https://github.com/wittwert>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// WORK-IN-PROGRESS: Any contribution support welcomed.
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/cojs/co-body
// Definitions by: Joshua DeVinney <https://github.com/geoffreak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node"/>
/// <reference types="koa"/>
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/expressjs/compression
// Definitions by: Santi Albo <https://github.com/santialbo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as express from 'express';
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/jaredhanson/connect-ensure-login
// Definitions by: Pavel Puchkov <https://github.com/0x6368656174>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { RequestHandler } from "express";
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/jaredhanson/connect-flash
// Definitions by: Andreas Gassmann <https://github.com/AndreasGassmann>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="express" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/bripkens/connect-history-api-fallback#readme
// Definitions by: Douglas Duteil <https://github.com/douglasduteil>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/tinganho/connect-modrewrite
// Definitions by: Tingan Ho <https://github.com/tinganho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+1
View File
@@ -3,6 +3,7 @@
// Definitions by: Xavier Stouder <https://github.com/xstoudi>
// Albert Kurniawan <https://github.com/morcerf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="express" />
/// <reference types="express-session" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/avinoamr/connect-slashes
// Definitions by: Sam Herrmann <https://github.com/samherrmann>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/* =================== USAGE ===================
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/expressjs/cookie-session
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="express" />
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/petermetz/cordova-plugin-ibeacon
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as Q from "q";
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/troygoode/node-cors/
// Definitions by: Mihhail Lapushkin <https://github.com/mihhail-lapushkin/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+38
View File
@@ -0,0 +1,38 @@
import coverup = require("coverup");
coverup("4242-4242-4242-4242"); // $ExpectType string
// => *******************
coverup("4242-4242-4242-4242", { char: "%" }); // $ExpectType string
// => %%%%%%%%%%%%%%%%%%%
coverup("4242-4242-4242-4242", { keepSymbols: true }); // $ExpectType string
// => ****-****-****-****
coverup("4242-4242-4242-4242", { keepLeft: 1, keepRight: 1, compactTo: 4 }); // $ExpectType string
// => 4****2
coverup("4242-4242-4242-4242", { keepLeft: 4 }); // $ExpectType string
// => 4242***************
coverup("4242-4242-4242-4242", { keepRight: 4 }); // $ExpectType string
// => ***************4242
let options: coverup.Options = {
char: "x",
keepLeft: 3,
keepRight: 3,
};
coverup("4242-4242-4242-4242", options); // $ExpectType string
// => 424xxxxxxxxxxxxx242
options = {
keepLeft: 1,
keepRight: 1,
compactTo: 4,
keepSymbols: true,
};
coverup("4242-4242-4242-4242", options); // $ExpectError "you cannot define both compactTo and keepSymbols"
// => Error: you cannot define both compactTo and keepSymbols
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for coverup 0.1
// Project: https://github.com/jsonmaur/coverup
// Definitions by: Vadim Belorussov <https://github.com/bevalorous>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace Coverup;
export = coverup;
declare function coverup(value: string, options?: coverup.Options): string;
declare namespace coverup {
interface Options {
char?: string;
keepLeft?: number;
keepRight?: number;
compactTo?: number;
keepSymbols?: boolean;
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"coverup-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4 -4
View File
@@ -178,7 +178,7 @@ declare namespace cytoscape {
*/
layout?: NullLayoutOptions | RandomLayoutOptions | PresetLayoutOptions |
GridLayoutOptions | CircleLayoutOptions | ConcentricLayoutOptions |
BreadthFirstLayoutOptions | CoseLayoutOptions;
BreadthFirstLayoutOptions | CoseLayoutOptions | BaseLayoutOptions;
///////////////////////////////////////
// initial viewport state:
@@ -978,7 +978,7 @@ declare namespace cytoscape {
* An analogue to run a layout on a subset of the graph exists as eles.layout().
* http://js.cytoscape.org/#cy.layout
*/
layout(layout: LayoutOptions): void;
layout(layout: LayoutOptions): LayoutManipulation;
/**
* Get a new layout, which can be used to algorithmically
* position the nodes in the graph.
@@ -991,7 +991,7 @@ declare namespace cytoscape {
* Note that you must call layout.run() in order for it to affect the graph.
* An analogue to make a layout on a subset of the graph exists as eles.makeLayout().
*/
makeLayout(options: LayoutOptions): void;
makeLayout(options: LayoutOptions): LayoutManipulation;
}
/**
@@ -4144,7 +4144,7 @@ declare namespace cytoscape {
type LayoutOptions =
NullLayoutOptions | PresetLayoutOptions | GridLayoutOptions |
CircleLayoutOptions | ConcentricLayoutOptions | BreadthFirstLayoutOptions |
CoseLayoutOptions;
CoseLayoutOptions | BaseLayoutOptions;
type LayoutHandler = () => void;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://d3js.org/d3-contour/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Hugues Stefanski <https://github.com/Ledragon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Last module patch version validated against: 1.1.0
+119 -63
View File
@@ -21,7 +21,7 @@ const tsvTestStringWithHeader = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.
const pipedTestStringWithHeader = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
interface ParsedTestObject {
year: Date;
year: Date | null;
make: string;
model: string;
length: number;
@@ -35,8 +35,9 @@ let parseRowsMappedArray: ParsedTestObject[];
let columns: string[];
let num: number;
let date: Date;
let dateNull: Date | null;
let str: string;
let strMaybe: string | undefined;
// ------------------------------------------------------------------------------------------
// Test CSV
@@ -50,7 +51,7 @@ parseArray = d3Dsv.csvParse(csvTestStringWithHeader);
columns = parseArray.columns;
str = parseArray[0]['Year'];
strMaybe = parseArray[0]['Year'];
// date = parseArray[0]['Year']; // fails, return value is string
// with row mapper ---------------------------------------------------------------------------
@@ -60,19 +61,39 @@ parseMappedArray = d3Dsv.csvParse(csvTestStringWithHeader, (rawRow, index, colum
const i: number = index;
const c: string[] = columns;
const pr: ParsedTestObject = {
year: new Date(+rr['Year'], 0, 1),
make: rr['Make'],
model: rr['Model'],
length: +rr['Length']
year: rr['Year'] ? new Date(+rr['Year']!, 0, 1) : null,
make: rr['Make'] ? rr['Make']! : "Missing Value",
model: rr['Model'] ? rr['Model']! : "Missing Value",
length: ['Length'] ? +rr['Length']! : NaN
};
return pr;
});
parseMappedArray = d3Dsv.csvParse(csvTestStringWithHeader, (rawRow, index, columns) => {
const rr: d3Dsv.DSVRowString = rawRow;
const i: number = index;
const c: string[] = columns;
const d: number | null = rr['Year'] ? +rr['Year']! : null;
const pr: ParsedTestObject | null | undefined = d !== null
? (
d > 1997
? {
year: new Date(d, 0, 1),
make: rr['Make'] ? rr['Make']! : "Missing Value",
model: rr['Model'] ? rr['Model']! : "Missing Value",
length: ['Length'] ? +rr['Length']! : NaN
}
: undefined
)
: null;
return pr;
});
columns = parseMappedArray.columns;
date = parseMappedArray[0].year;
str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
dateNull = parseMappedArray[0].year;
strMaybe = parseMappedArray[0].make;
strMaybe = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// csvParseRows(...) ============================================================================
@@ -81,7 +102,7 @@ num = parseMappedArray[0].length;
parseRowsArray = d3Dsv.csvParseRows(csvTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
strMaybe = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
// with row mapper ---------------------------------------------------------------------------
@@ -89,18 +110,25 @@ str = parseRowsArray[0][0]; // 'Year' of first row
parseRowsMappedArray = d3Dsv.csvParseRows(csvTestString, (rawRow, index) => {
const rr: string[] = rawRow;
const i: number = index;
const pr: ParsedTestObject = {
year: new Date(+rr[0], 0, 1),
make: rr[1],
model: rr[2],
length: +rr[3]
};
const d: number | null = rr[0].length ? +rr[0] : null;
const pr: ParsedTestObject | null | undefined = d !== null
? (
d > 1997
? {
year: new Date(d, 0, 1),
make: rr[1].length ? rr[1] : "Missing Value",
model: rr[2].length ? rr[2] : "Missing Value",
length: rr[3].length ? +rr[3] : NaN
}
: undefined
)
: null;
return pr;
});
date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
dateNull = parseRowsMappedArray[0].year;
strMaybe = parseRowsMappedArray[0].make;
strMaybe = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;
// csvFormat(...) ============================================================================
@@ -111,7 +139,7 @@ str = d3Dsv.csvFormat(parseRowsMappedArray, columns);
// csvFormatRows(...) ========================================================================
str = d3Dsv.csvFormatRows(parseRowsMappedArray.map((d, i) => [
d.year.getFullYear().toString(),
d.year ? d.year.getFullYear().toString() : '',
d.make,
d.model,
d.length.toString()
@@ -129,7 +157,7 @@ parseArray = d3Dsv.tsvParse(tsvTestStringWithHeader);
columns = parseArray.columns;
str = parseArray[0]['Year'];
strMaybe = parseArray[0]['Year'];
// date = parseArray[0]['Year']; // fails, return value is string
// with row mapper ---------------------------------------------------------------------------
@@ -138,20 +166,27 @@ parseMappedArray = d3Dsv.tsvParse(tsvTestStringWithHeader, (rawRow, index, colum
const rr: d3Dsv.DSVRowString = rawRow;
const i: number = index;
const c: string[] = columns;
const pr: ParsedTestObject = {
year: new Date(+rr['Year'], 0, 1),
make: rr['Make'],
model: rr['Model'],
length: +rr['Length']
};
const d: number | null = rr['Year'] ? +rr['Year']! : null;
const pr: ParsedTestObject | null | undefined = d !== null
? (
d > 1997
? {
year: new Date(d, 0, 1),
make: rr['Make'] ? rr['Make']! : "Missing Value",
model: rr['Model'] ? rr['Model']! : "Missing Value",
length: ['Length'] ? +rr['Length']! : NaN
}
: undefined
)
: null;
return pr;
});
columns = parseMappedArray.columns;
date = parseMappedArray[0].year;
str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
dateNull = parseMappedArray[0].year;
strMaybe = parseMappedArray[0].make;
strMaybe = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// tsvParseRows(...) ============================================================================
@@ -160,7 +195,7 @@ num = parseMappedArray[0].length;
parseRowsArray = d3Dsv.tsvParseRows(tsvTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
strMaybe = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
// with row mapper ---------------------------------------------------------------------------
@@ -168,18 +203,25 @@ str = parseRowsArray[0][0]; // 'Year' of first row
parseRowsMappedArray = d3Dsv.tsvParseRows(tsvTestString, (rawRow, index) => {
const rr: string[] = rawRow;
const i: number = index;
const pr: ParsedTestObject = {
year: new Date(+rr[0], 0, 1),
make: rr[1],
model: rr[2],
length: +rr[3]
};
const d: number | null = rr[0].length ? +rr[0] : null;
const pr: ParsedTestObject | null | undefined = d !== null
? (
d > 1997
? {
year: new Date(d, 0, 1),
make: rr[1].length ? rr[1] : "Missing Value",
model: rr[2].length ? rr[2] : "Missing Value",
length: rr[3].length ? +rr[3] : NaN
}
: undefined
)
: null;
return pr;
});
date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
dateNull = parseRowsMappedArray[0].year;
strMaybe = parseRowsMappedArray[0].make;
strMaybe = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;
// tsvFormat(...) ============================================================================
@@ -190,7 +232,7 @@ str = d3Dsv.tsvFormat(parseRowsMappedArray, columns);
// tsvFormatRows(...) ========================================================================
str = d3Dsv.tsvFormatRows(parseRowsMappedArray.map((d, i) => [
d.year.getFullYear().toString(),
d.year ? d.year.getFullYear().toString() : '',
d.make,
d.model,
d.length.toString()
@@ -213,7 +255,7 @@ parseArray = dsv.parse(pipedTestStringWithHeader);
columns = parseArray.columns;
str = parseArray[0]['Year'];
strMaybe = parseArray[0]['Year'];
// date = parseArray[0]['Year']; // fails, return value is string
// with row mapper ---------------------------------------------------------------------------
@@ -222,20 +264,27 @@ parseMappedArray = dsv.parse(pipedTestStringWithHeader, (rawRow, index, columns)
const rr: d3Dsv.DSVRowString = rawRow;
const i: number = index;
const c: string[] = columns;
const pr: ParsedTestObject = {
year: new Date(+rr['Year'], 0, 1),
make: rr['Make'],
model: rr['Model'],
length: +rr['Length']
};
const d: number | null = rr['Year'] ? +rr['Year']! : null;
const pr: ParsedTestObject | null | undefined = d !== null
? (
d > 1997
? {
year: new Date(d, 0, 1),
make: rr['Make'] ? rr['Make']! : "Missing Value",
model: rr['Model'] ? rr['Model']! : "Missing Value",
length: ['Length'] ? +rr['Length']! : NaN
}
: undefined
)
: null;
return pr;
});
columns = parseMappedArray.columns;
date = parseMappedArray[0].year;
str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
dateNull = parseMappedArray[0].year;
strMaybe = parseMappedArray[0].make;
strMaybe = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// parseRows(...) ============================================================================
@@ -244,7 +293,7 @@ num = parseMappedArray[0].length;
parseRowsArray = dsv.parseRows(pipedTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
strMaybe = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
// with row mapper ---------------------------------------------------------------------------
@@ -252,18 +301,25 @@ str = parseRowsArray[0][0]; // 'Year' of first row
parseRowsMappedArray = dsv.parseRows(pipedTestString, (rawRow, index) => {
const rr: string[] = rawRow;
const i: number = index;
const pr: ParsedTestObject = {
year: new Date(+rr[0], 0, 1),
make: rr[1],
model: rr[2],
length: +rr[3]
};
const d: number | null = rr[0].length ? +rr[0] : null;
const pr: ParsedTestObject | null | undefined = d !== null
? (
d > 1997
? {
year: new Date(d, 0, 1),
make: rr[1].length ? rr[1] : "Missing Value",
model: rr[2].length ? rr[2] : "Missing Value",
length: rr[3].length ? +rr[3] : NaN
}
: undefined
)
: null;
return pr;
});
date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
dateNull = parseRowsMappedArray[0].year;
strMaybe = parseRowsMappedArray[0].make;
strMaybe = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;
// format(...) ============================================================================
@@ -274,7 +330,7 @@ str = dsv.format(parseRowsMappedArray, columns);
// formatRows(...) ========================================================================
str = dsv.formatRows(parseRowsMappedArray.map((d, i) => [
d.year.getFullYear().toString(),
d.year ? d.year.getFullYear().toString() : '',
d.make,
d.model,
d.length.toString()
+287 -7
View File
@@ -3,19 +3,35 @@
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.30
// ------------------------------------------------------------------------------------------
// Shared Types and Interfaces
// ------------------------------------------------------------------------------------------
/**
* An object representing a DSV parsed row with values represented as strings.
*/
export interface DSVRowString {
[key: string]: string;
[key: string]: string | undefined;
}
/**
* An object representing a DSV parsed row with values represented as an arbitrary datatype, depending
* on the performed parsed row mapping.
*/
export interface DSVRowAny {
[key: string]: any;
}
/**
* An array object representing all parsed rows. The array is enhanced with a property listing
* the names of the parsed columns.
*/
export interface DSVParsedArray<T> extends Array<T> {
/**
* List of column names.
*/
columns: string[];
}
@@ -25,20 +41,108 @@ export interface DSVParsedArray<T> extends Array<T> {
// csvParse(...) ============================================================================
/**
* Parses the specified string, which must be in the comma-separated values format, returning an array of objects representing the parsed rows.
*
* Unlike csvParseRows, this method requires that the first line of the CSV content contains a comma-separated list of column names;
* these column names become the attributes on the returned objects.
*
* The returned array also exposes a columns property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary).
*
* Equivalent to dsvFormat(",").parse.
*
* @param csvString A string, which must be in the comma-separated values format.
*/
export function csvParse(csvString: string): DSVParsedArray<DSVRowString>;
export function csvParse<ParsedRow extends DSVRowAny>(csvString: string, row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow): DSVParsedArray<ParsedRow>;
/**
* Parses the specified string, which must be in the comma-separated values format, returning an array of objects representing the parsed rows.
*
* Unlike csvParseRows, this method requires that the first line of the CSV content contains a comma-separated list of column names;
* these column names become the attributes on the returned objects.
*
* The returned array also exposes a columns property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary).
*
* Equivalent to dsvFormat(",").parse.
*
* @param csvString A string, which must be in the comma-separated values format.
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
* In effect, row is similar to applying a map and filter operator to the returned rows.
*/
export function csvParse<ParsedRow extends DSVRowAny>(
csvString: string,
row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null
): DSVParsedArray<ParsedRow>;
// csvParseRows(...) ========================================================================
/**
* Parses the specified string, which must be in the comma-separated values format, returning an array of arrays representing the parsed rows.
*
* Unlike csvParse, this method treats the header line as a standard row, and should be used whenever CSV content does not contain a header.
* Each row is represented as an array rather than an object. Rows may have variable length.
*
* If a row conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types.
* In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the + operator), but better is to specify a row conversion function.
*
* Equivalent to dsvFormat(",").parseRows.
*
* @param csvString A string, which must be in the comma-separated values format.
*/
export function csvParseRows(csvString: string): string[][];
export function csvParseRows<ParsedRow extends DSVRowAny>(csvString: string, row: (rawRow: string[], index: number) => ParsedRow): ParsedRow[];
/**
* Parses the specified string, which must be in the comma-separated values format, returning an array of arrays representing the parsed rows.
*
* Unlike csvParse, this method treats the header line as a standard row, and should be used whenever CSV content does not contain a header.
* Each row is represented as an array rather than an object. Rows may have variable length.
*
* Equivalent to dsvFormat(",").parseRows.
*
* @param csvString A string, which must be in the comma-separated values format.
* @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i)
* starting at zero for the first row, and the array of column names. If the returned value is null or undefined,
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
* In effect, row is similar to applying a map and filter operator to the returned rows.
*/
export function csvParseRows<ParsedRow extends DSVRowAny>(
csvString: string,
row: (rawRow: string[], index: number) => ParsedRow | undefined | null
): ParsedRow[];
// csvFormat(...) ============================================================================
/**
* Formats the specified array of object rows as comma-separated values, returning a string.
* This operation is the inverse of csvParse. Each row will be separated by a newline (\n),
* and each column within each row will be separated by the comma-delimiter.
* Values that contain either the comma-delimiter, a double-quote (") or a newline will be escaped using double-quotes.
*
* If columns is not specified, the list of column names that forms the header row is determined by the union of all properties on all objects in rows;
* the order of columns is nondeterministic.
*
* Equivalent to dsvFormat(",").format.
*
* @param rows Array of object rows.
* @param columns An array of strings representing the column names.
*/
export function csvFormat(rows: DSVRowAny[], columns?: string[]): string;
// csvFormatRows(...) ========================================================================
/**
* Formats the specified array of array of string rows as comma-separated values, returning a string.
* This operation is the reverse of csvParseRows. Each row will be separated by a newline (\n),
* and each column within each row will be separated by the comma-delimiter.
* Values that contain either the comma-delimiter, a double-quote (") or a newline will be escaped using double-quotes.
*
* To convert an array of objects to an array of arrays while explicitly specifying the columns, use array.map.
* If you like, you can also array.concat this result with an array of column names to generate the first row.
*
* Equivalent to dsvFormat(",").formatRows.
*
* @param rows An array of array of string rows.
*/
export function csvFormatRows(rows: string[][]): string;
// ------------------------------------------------------------------------------------------
@@ -47,33 +151,209 @@ export function csvFormatRows(rows: string[][]): string;
// tsvParse(...) ============================================================================
/**
* Parses the specified string, which must be in the tab-separated values format, returning an array of objects representing the parsed rows.
*
* Unlike tsvParseRows, this method requires that the first line of the TSV content contains a tab-separated list of column names;
* these column names become the attributes on the returned objects.
*
* The returned array also exposes a columns property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary).
*
* Equivalent to dsvFormat("\t").parse.
*
* @param tsvString A string, which must be in the tab-separated values format.
*/
export function tsvParse(tsvString: string): DSVParsedArray<DSVRowString>;
export function tsvParse<MappedRow extends DSVRowAny>(tsvString: string, row: (rawRow: DSVRowString, index: number, columns: string[]) => MappedRow): DSVParsedArray<MappedRow>;
/**
* Parses the specified string, which must be in the tab-separated values format, returning an array of objects representing the parsed rows.
*
* Unlike tsvParseRows, this method requires that the first line of the TSV content contains a tab-separated list of column names;
* these column names become the attributes on the returned objects.
*
* The returned array also exposes a columns property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary).
*
* Equivalent to dsvFormat("\t").parse.
*
* @param tsvString A string, which must be in the tab-separated values format.
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
* In effect, row is similar to applying a map and filter operator to the returned rows.
*/
export function tsvParse<MappedRow extends DSVRowAny>(
tsvString: string,
row: (rawRow: DSVRowString, index: number, columns: string[]) => MappedRow | undefined | null
): DSVParsedArray<MappedRow>;
// tsvParseRows(...) ========================================================================
/**
* Parses the specified string, which must be in the tab-separated values format, returning an array of arrays representing the parsed rows.
*
* Unlike tsvParse, this method treats the header line as a standard row, and should be used whenever TSV content does not contain a header.
* Each row is represented as an array rather than an object. Rows may have variable length.
*
* If a row conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types.
* In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the + operator), but better is to specify a row conversion function.
*
* Equivalent to dsvFormat("\t").parseRows.
*
* @param tsvString A string, which must be in the tab-separated values format.
*/
export function tsvParseRows(tsvString: string): string[][];
export function tsvParseRows<MappedRow extends DSVRowAny>(tsvString: string, row: (rawRow: string[], index: number) => MappedRow): MappedRow[];
/**
* Parses the specified string, which must be in the tab-separated values format, returning an array of arrays representing the parsed rows.
*
* Unlike tsvParse, this method treats the header line as a standard row, and should be used whenever TSV content does not contain a header.
* Each row is represented as an array rather than an object. Rows may have variable length.
*
* Equivalent to dsvFormat("\t").parseRows.
*
* @param tsvString A string, which must be in the tab-separated values format.
* @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i)
* starting at zero for the first row, and the array of column names. If the returned value is null or undefined,
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
* In effect, row is similar to applying a map and filter operator to the returned rows.
*/
export function tsvParseRows<MappedRow extends DSVRowAny>(
tsvString: string,
row: (rawRow: string[], index: number) => MappedRow | undefined | null
): MappedRow[];
// tsvFormat(...) ============================================================================
/**
* Formats the specified array of object rows as tab-separated values, returning a string.
* This operation is the inverse of tsvParse. Each row will be separated by a newline (\n),
* and each column within each row will be separated by the tab-delimiter.
* Values that contain either the tab-delimiter, a double-quote (") or a newline will be escaped using double-quotes.
*
* If columns is not specified, the list of column names that forms the header row is determined by the union of all properties on all objects in rows;
* the order of columns is nondeterministic.
*
* Equivalent to dsvFormat("\t").format.
*
* @param rows Array of object rows.
* @param columns An array of strings representing the column names.
*/
export function tsvFormat(rows: DSVRowAny[], columns?: string[]): string;
// tsvFormatRows(...) ========================================================================
/**
* Formats the specified array of array of string rows as tab-separated values, returning a string.
* This operation is the reverse of tsvParseRows. Each row will be separated by a newline (\n),
* and each column within each row will be separated by the tab-delimiter.
* Values that contain either the tab-delimiter, a double-quote (") or a newline will be escaped using double-quotes.
*
* To convert an array of objects to an array of arrays while explicitly specifying the columns, use array.map.
* If you like, you can also array.concat this result with an array of column names to generate the first row.
*
* Equivalent to dsvFormat("\t").formatRows.
*
* @param rows An array of array of string rows.
*/
export function tsvFormatRows(rows: string[][]): string;
// ------------------------------------------------------------------------------------------
// DSV Generalized Parsers and Formatters
// ------------------------------------------------------------------------------------------
/**
* A DSV parser and formatter
*/
export interface DSV {
/**
* Parses the specified string, which must be in the delimiter-separated values format with the appropriate delimiter, returning an array of objects representing the parsed rows.
*
* Unlike dsv.parseRows, this method requires that the first line of the DSV content contains a delimiter-separated list of column names;
* these column names become the attributes on the returned objects.
*
* The returned array also exposes a columns property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary).
*
* @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter.
*/
parse(dsvString: string): DSVParsedArray<DSVRowString>;
parse<ParsedRow extends DSVRowAny>(dsvString: string, row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow): DSVParsedArray<ParsedRow>;
/**
* Parses the specified string, which must be in the delimiter-separated values format with the appropriate delimiter, returning an array of objects representing the parsed rows.
*
* Unlike dsv.parseRows, this method requires that the first line of the DSV content contains a delimiter-separated list of column names;
* these column names become the attributes on the returned objects.
*
* The returned array also exposes a columns property containing the column names in input order (in contrast to Object.keys, whose iteration order is arbitrary).
*
* @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter.
* @param row A row conversion function which is invoked for each row, being passed an object representing the current row (d),
* the index (i) starting at zero for the first non-header row, and the array of column names. If the returned value is null or undefined,
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
* In effect, row is similar to applying a map and filter operator to the returned rows.
*/
parse<ParsedRow extends DSVRowAny>(
dsvString: string,
row: (rawRow: DSVRowString, index: number, columns: string[]) => ParsedRow | undefined | null
): DSVParsedArray<ParsedRow>;
/**
* Parses the specified string, which must be in the delimiter-separated values format with the appropriate delimiter, returning an array of arrays representing the parsed rows.
*
* Unlike dsv.parse, this method treats the header line as a standard row, and should be used whenever DSV content does not contain a header.
* Each row is represented as an array rather than an object. Rows may have variable length.
*
* If a row conversion function is not specified, field values are strings. For safety, there is no automatic conversion to numbers, dates, or other types.
* In some cases, JavaScript may coerce strings to numbers for you automatically (for example, using the + operator), but better is to specify a row conversion function.
*
* @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter.
*/
parseRows(dsvString: string): string[][];
parseRows<ParsedRow extends DSVRowAny>(dsvString: string, row: (rawRow: string[], index: number) => ParsedRow): ParsedRow[];
/**
* Parses the specified string, which must be in the delimiter-separated values format with the appropriate delimiter, returning an array of arrays representing the parsed rows.
*
* Unlike dsv.parse, this method treats the header line as a standard row, and should be used whenever DSV content does not contain a header.
* Each row is represented as an array rather than an object. Rows may have variable length.
*
* @param dsvString A string, which must be in the delimiter-separated values format with the appropriate delimiter.
* @param row A row conversion function which is invoked for each row, being passed an array representing the current row (d), the index (i)
* starting at zero for the first row, and the array of column names. If the returned value is null or undefined,
* the row is skipped and will be ommitted from the array returned by dsv.parse; otherwise, the returned value defines the corresponding row object.
* In effect, row is similar to applying a map and filter operator to the returned rows.
*/
parseRows<ParsedRow extends DSVRowAny>(
dsvString: string,
row: (rawRow: string[], index: number) => ParsedRow | undefined | null
): ParsedRow[];
/**
* Formats the specified array of object rows as delimiter-separated values, returning a string.
* This operation is the inverse of dsv.parse. Each row will be separated by a newline (\n),
* and each column within each row will be separated by the delimiter (such as a comma, ,).
* Values that contain either the delimiter, a double-quote (") or a newline will be escaped using double-quotes.
*
* If columns is not specified, the list of column names that forms the header row is determined by the union of all properties on all objects in rows;
* the order of columns is nondeterministic.
*
* @param rows Array of object rows.
* @param columns An array of strings representing the column names.
*/
format(rows: DSVRowAny[], columns?: string[]): string;
/**
* Formats the specified array of array of string rows as delimiter-separated values, returning a string.
* This operation is the reverse of dsv.parseRows. Each row will be separated by a newline (\n),
* and each column within each row will be separated by the delimiter (such as a comma, ,).
* Values that contain either the delimiter, a double-quote (") or a newline will be escaped using double-quotes.
*
* To convert an array of objects to an array of arrays while explicitly specifying the columns, use array.map.
* If you like, you can also array.concat this result with an array of column names to generate the first row.
*
* @param rows An array of array of string rows.
*/
formatRows(rows: string[][]): string;
}
/**
* Constructs a new DSV parser and formatter for the specified delimiter.
*
* @param delimiter A delimiter character. The delimiter must be a single character (i.e., a single 16-bit code unit);
* so, ASCII delimiters are fine, but emoji delimiters are not.
*/
export function dsvFormat(delimiter: string): DSV;
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -20,4 +20,4 @@
"index.d.ts",
"d3-dsv-tests.ts"
]
}
}
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/d3/d3-geo/
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Last module patch version validated against: 1.9.0
@@ -34,7 +34,7 @@ selection = selection.attrs({
});
// Function that returns a map
selection = selection.attrs(function(d, i, g) {
selection = selection.attrs(function(d, i, g): {} | { id: string } {
const that: HTMLAnchorElement = this;
const index: number = i;
const group: HTMLAnchorElement[] | ArrayLike<HTMLAnchorElement> = g;
@@ -89,7 +89,7 @@ selection = selection.properties({
});
// Function that returns an object
selection = selection.properties(function(d, i, g) {
selection = selection.properties(function(d, i, g): {} | { href: string } {
const that: HTMLAnchorElement = this;
const index: number = i;
const group: HTMLAnchorElement[] | ArrayLike<HTMLAnchorElement> = g;
@@ -118,7 +118,7 @@ transition = transition.attrs({
});
// Function that returns a map
transition = transition.attrs(function(d, i, g) {
transition = transition.attrs(function(d, i, g): {} | { id: string } {
const that: HTMLAnchorElement = this;
const index: number = i;
const group: HTMLAnchorElement[] | ArrayLike<HTMLAnchorElement> = g;
+1
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/d3/d3
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export as namespace d3;

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