Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped into lodash-omit-unset

This commit is contained in:
AJ Richardson
2018-05-05 16:36:38 -04:00
270 changed files with 7863 additions and 1515 deletions
+31
View File
@@ -3039,6 +3039,37 @@ declare namespace AceAjax {
**/
new(container: HTMLElement, theme?: string): VirtualRenderer;
}
export interface Completer {
/**
* Provides possible completion results asynchronously using the given callback.
* @param editor The editor to associate with
* @param session The `EditSession` to refer to
* @param pos An object containing the row and column
* @param prefix The prefixing string before the current position
* @param callback Function to provide the results or error
*/
getCompletions: (editor: Editor, session: IEditSession, pos: Position, prefix: string, callback: CompletionCallback) => void;
/**
* Provides tooltip information about a completion result.
* @param item The completion result
*/
getDocTooltip?: (item: Completion) => void;
}
export interface Completion {
value: string;
meta: string;
type?: string;
caption?: string;
snippet?: any;
score?: number;
exactMatch?: number;
docHTML?: string;
}
export type CompletionCallback = (error: Error, results: Completion[]) => void;
}
declare var ace: AceAjax.Ace;
@@ -1,5 +1,5 @@
declare namespace adone {
namespace application {
namespace app {
namespace I {
type ArgumentType = ((x: string, index: number) => any) | RegExp;
@@ -12,7 +12,7 @@ declare namespace adone {
| "append"
| "count"
| "set";
nargs?: number | "+" | "*" | "?"
nargs?: number | "+" | "*" | "?";
type?: ArgumentType | ArgumentType[];
verify?: (args: any, opts: any) => boolean; // TODO
required?: boolean;
@@ -49,7 +49,7 @@ declare namespace adone {
name?: string;
description?: string;
subsystems?: SubsystemInfo[];
commandsGroups?: Group[]
commandsGroups?: Group[];
}
interface SubsystemInfo {
@@ -71,24 +71,24 @@ declare namespace adone {
namespace I {
interface LoadSubsystemOptions {
name?: string,
description?: string,
group?: string,
transpile?: boolean
name?: string;
description?: string;
group?: string;
transpile?: boolean;
}
interface CommonAddSubsystemInfo {
name?: string,
useFilename?: boolean
description?: string,
group?: string,
configureArgs?: any[]
transpile?: boolean,
bind?: boolean | string
name?: string;
useFilename?: boolean;
description?: string;
group?: string;
configureArgs?: any[];
transpile?: boolean;
bind?: boolean | string;
}
interface AddSubsystemInfo extends CommonAddSubsystemInfo {
subsystem: Subsystem | string,
subsystem: Subsystem | string;
}
interface SysInfo {
@@ -109,7 +109,7 @@ declare namespace adone {
}
interface AddSubsystemsFromOptions extends CommonAddSubsystemInfo {
filter?: string[] | ((file: string) => boolean | Promise<boolean>)
filter?: string[] | ((file: string) => boolean | Promise<boolean>);
}
}
@@ -211,25 +211,22 @@ declare namespace adone {
_rejectionHandled(p: Promise<any>): void;
_signalExit(sigName: string): void;
}
namespace I {
interface Command {
// ?
names: string[];
// TODO
}
interface Argument {
// ?
names: string[];
// TODO
}
interface PositionalArgument extends Argument {
// ?
}
type PositionalArgument = Argument; // TODO
interface OptionalArgument extends Argument {
// ?
}
type OptionalArgument = Argument; // TODO
interface DefineCommandFromSubsystemOptions {
name?: string;
+2 -2
View File
@@ -320,12 +320,12 @@ declare namespace adone {
/**
* Checks whether the given object is an adone subsystem
*/
export function subsystem(obj: any): obj is adone.application.Subsystem;
export function subsystem(obj: any): obj is adone.app.Subsystem;
/**
* Checks whether the given object is an adone application
*/
export function application(obj: any): obj is adone.application.Application;
export function application(obj: any): obj is adone.app.Application;
/**
* Checks whether the given object is an adone logger
+1 -1
View File
@@ -5,7 +5,7 @@
// TypeScript Version: 2.4
/// <reference path="./adone.d.ts" />
/// <reference path="./glosses/application.d.ts" />
/// <reference path="./glosses/app.d.ts" />
/// <reference path="./glosses/archives.d.ts" />
/// <reference path="./glosses/assertion.d.ts" />
/// <reference path="./glosses/collections/index.d.ts" />
@@ -8,7 +8,7 @@ namespace applicationTests {
Subsystem,
runCli,
Application
} = adone.application;
} = adone.app;
namespace DApplicationTests {
{
+2 -1
View File
@@ -24,6 +24,7 @@
"adone.d.ts",
"async.d.ts",
"benchmark.d.ts",
"glosses/app.d.ts",
"glosses/archives.d.ts",
"glosses/assertion.d.ts",
"glosses/collections/array_set.d.ts",
@@ -95,7 +96,7 @@
"glosses/utils.d.ts",
"glosses/vault.d.ts",
"index.d.ts",
"test/glosses/application.ts",
"test/glosses/app.ts",
"test/glosses/archives.ts",
"test/glosses/assertion.ts",
"test/glosses/collections/array_set.ts",
+14 -14
View File
@@ -2,16 +2,16 @@ import * as algoliasearch from 'algoliasearch';
import {
ClientOptions,
SynonymOption,
AlgoliaApiKeyOptions,
ApiKeyOptions,
SearchSynonymOptions,
AlgoliaResponse,
AlgoliaSecuredApiOptions,
AlgoliaIndexSettings,
AlgoliaQueryParameters,
AlgoliaIndex,
SecuredApiOptions,
Index,
Response,
IndexSettings,
QueryParameters,
} from 'algoliasearch';
let _algoliaResponse: AlgoliaResponse = {
let _algoliaResponse: Response = {
hits: [{}, {}],
page: 0,
nbHits: 12,
@@ -33,7 +33,7 @@ let _synonymOption: SynonymOption = {
replaceExistingSynonyms: false,
};
let _algoliaApiKeyOptions: AlgoliaApiKeyOptions = {
let _algoliaApiKeyOptions: ApiKeyOptions = {
validity: 0,
maxQueriesPerIPPerHour: 0,
indexes: [''],
@@ -48,14 +48,14 @@ let _searchSynonymOptions: SearchSynonymOptions = {
hitsPerPage: 0,
};
let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
let _algoliaSecuredApiOptions: SecuredApiOptions = {
filters: '',
validUntil: 0,
restrictIndices: '',
userToken: '',
};
let _algoliaIndexSettings: AlgoliaIndexSettings = {
let _algoliaIndexSettings: IndexSettings = {
attributesToIndex: [''],
attributesForFaceting: [''],
unretrievableAttributes: [''],
@@ -63,7 +63,7 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = {
ranking: [''],
customRanking: [''],
replicas: [''],
maxValuesPerFacet: '',
maxValuesPerFacet: 100,
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
@@ -96,13 +96,13 @@ let _algoliaIndexSettings: AlgoliaIndexSettings = {
placeholders: '',
};
let _algoliaQueryParameters: AlgoliaQueryParameters = {
let _algoliaQueryParameters: QueryParameters = {
query: '',
filters: '',
attributesToRetrieve: [''],
restrictSearchableAttributes: [''],
facets: '',
maxValuesPerFacet: '',
maxValuesPerFacet: 2,
attributesToHighlight: [''],
attributesToSnippet: [''],
highlightPreTag: '',
@@ -147,7 +147,7 @@ let _algoliaQueryParameters: AlgoliaQueryParameters = {
minProximity: 0,
};
let index: AlgoliaIndex = algoliasearch('', '').initIndex('');
let index: Index = algoliasearch('', '').initIndex('');
let search = index.search({ query: '' });
index.search({ query: '' }, (err, res) => {});
+569 -700
View File
File diff suppressed because it is too large Load Diff
+624
View File
@@ -0,0 +1,624 @@
// Type definitions for algoliasearch-client-js 3.27.0
// Project: https://github.com/algolia/algoliasearch-client-js
// Definitions by: Baptiste Coquelle <https://github.com/cbaptiste>
// Haroen Viaene <https://github.com/haroenv>
// Aurélien Hervé <https://github.com/aherve>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare namespace algoliasearch {
/*
Interface for the algolia client object
*/
interface Client {
/**
* Initialization of the index
* https://github.com/algolia/algoliasearch-client-js#init-index---initindex
*/
initIndex(indexName: string): Index;
/**
* Query on multiple index
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
*/
search(
queries: {
indexName: string;
query: string;
params: QueryParameters;
}[],
cb: (err: Error, res: MultiResponse) => void
): void;
/**
* Query on multiple index
* https://github.com/algolia/algoliasearch-client-js#multiple-queries---multiplequeries
*/
search(
queries: {
indexName: string;
query: string;
params: QueryParameters;
}[]
): Promise<MultiResponse>;
/**
* Query for facet values of a specific facet
*/
searchForFacetValues(
queries: [{ indexName: string; params: SearchForFacetValues.Parameters }]
): Promise<SearchForFacetValues.Response[]>;
/**
* clear browser cache
* https://github.com/algolia/algoliasearch-client-js#cache
*/
clearCache(): 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;
}
/**
* Interface for the index algolia object
*/
interface Index {
/**
* Gets a specific object
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
*/
getObject(objectID: string, cb: (err: Error, res: {}) => void): void;
/**
* Gets specific attributes from an object
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
*/
getObject(
objectID: string,
attributes: string[],
cb: (err: Error, res: {}) => void
): void;
/**
* Gets a list of objects
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
*/
getObjects(
objectIDs: string[],
cb: (err: Error, res: { results: {}[] }) => void
): void;
/**
* Gets a list of objects
* https://github.com/algolia/algoliasearch-client-js#find-by-ids---getobjects
*/
getObjects(objectIDs: string[]): Promise<{ results: {}[] }>;
/**
* Clear cache of an index
* https://github.com/algolia/algoliasearch-client-js#cache
*/
clearCache(): void;
/**
* Search in an index
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
*/
search(
params: QueryParameters,
cb: (err: Error, res: Response) => void
): void;
/**
* Search in an index
* https://github.com/algolia/algoliasearch-client-js#search-in-an-index---search
*/
search(params: QueryParameters): Promise<Response>;
/**
* Search in an index
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
*/
searchForFacetValues(
options: SearchForFacetValues.Parameters
): Promise<SearchForFacetValues.Response>;
/**
* Search in an index
* https://www.algolia.com/doc/api-reference/api-methods/search-for-facet-values/
*/
searchForFacetValues(
options: SearchForFacetValues.Parameters,
cb: (err: Error, res: SearchForFacetValues.Response) => void
): void;
/**
* Browse an index
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
*/
browse(query: string, cb: (err: Error, res: BrowseResponse) => void): void;
/**
* Browse an index
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
*/
browse(query: string): Promise<BrowseResponse>;
/**
* Browse an index from a cursor
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
*/
browseFrom(
cursor: string,
cb: (err: Error, res: BrowseResponse) => void
): void;
/**
* Browse an index from a cursor
* https://github.com/algolia/algoliasearch-client-js#backup--export-an-index---browse
*/
browseFrom(cursor: string): Promise<BrowseResponse>;
}
/**
* Interface describing available options when initializing a client
*/
interface ClientOptions {
/**
* Timeout for requests to our servers, in milliseconds
* default: 15s (node), 2s (browser)
* https://github.com/algolia/algoliasearch-client-js#client-options
*/
timeout?: number;
/**
* Protocol to use when communicating with algolia
* default: current protocol(browser), https(node)
* https://github.com/algolia/algoliasearch-client-js#client-options
*/
protocol?: string;
/**
* (node only) httpAgent instance to use when communicating with servers.
* https://github.com/algolia/algoliasearch-client-js#client-options
*/
httpAgent?: any;
/**
* read: array of read hosts to use to call servers, computed automatically
* write: array of read hosts to use to call servers, computed automatically
* https://github.com/algolia/algoliasearch-client-js#client-options
*/
hosts?: { read?: string[]; write?: string[] };
}
interface BrowseResponse {
cursor?: string;
hits: {}[];
params: string;
query: string;
processingTimeMS: number;
}
interface QueryParameters {
/**
* Query string used to perform the search
* default: ''
* https://github.com/algolia/algoliasearch-client-js#query
*/
query?: string;
/**
* Filter the query with numeric, facet or/and tag filters
* default: ""
* https://github.com/algolia/algoliasearch-client-js#filters
*/
filters?: string;
/**
* A string that contains the list of attributes you want to retrieve in order to minimize the size of the JSON answer.
* default: *
* https://github.com/algolia/algoliasearch-client-js#attributestoretrieve
*/
attributesToRetrieve?: string[];
/**
* List of attributes you want to use for textual search
* default: attributeToIndex
* https://github.com/algolia/algoliasearch-client-js#restrictsearchableattributes
*/
restrictSearchableAttributes?: string[];
/**
* You can use facets to retrieve only a part of your attributes declared in attributesForFaceting attributes
* default: ""
* https://github.com/algolia/algoliasearch-client-js#facets
*/
facets?: string;
/**
* Limit the number of facet values returned for each facet.
* default: ""
* https://github.com/algolia/algoliasearch-client-js#maxvaluesperfacet
*/
maxValuesPerFacet?: number;
/**
* Default list of attributes to highlight. If set to null, all indexed attributes are highlighted.
* default: null
* https://github.com/algolia/algoliasearch-client-js#attributestohighlight
*/
attributesToHighlight?: string[];
/**
* Default list of attributes to snippet alongside the number of words to return
* default: null
* https://github.com/algolia/algoliasearch-client-js#attributestosnippet
*/
attributesToSnippet?: string[];
/**
* Specify the string that is inserted before the highlighted parts in the query result
* default: <em>
* https://github.com/algolia/algoliasearch-client-js#highlightpretag
*/
highlightPreTag?: string;
/**
* Specify the string that is inserted after the highlighted parts in the query result
* default: </em>
* https://github.com/algolia/algoliasearch-client-js#highlightposttag
*/
highlightPostTag?: string;
/**
* String used as an ellipsis indicator when a snippet is truncated.
* default: …
* https://github.com/algolia/algoliasearch-client-js#snippetellipsistext
*/
snippetEllipsisText?: string;
/**
* If set to true, restrict arrays in highlights and snippets to items that matched the query at least partially else return all array items in highlights and snippets
* default: false
* https://github.com/algolia/algoliasearch-client-js#restricthighlightandsnippetarrays
*/
restrictHighlightAndSnippetArrays?: boolean;
/**
* Pagination parameter used to select the number of hits per page
* default: 20
* https://github.com/algolia/algoliasearch-client-js#hitsperpage
*/
hitsPerPage?: number;
/**
* Pagination parameter used to select the page to retrieve.
* default: 0
* https://github.com/algolia/algoliasearch-client-js#page
*/
page?: number;
/**
* Offset of the first hit to return
* default: null
* https://github.com/algolia/algoliasearch-client-js#offset
*/
offset?: number;
/**
* Number of hits to return.
* default: null
* https://github.com/algolia/algoliasearch-client-js#length
*/
length?: number;
/**
* The minimum number of characters needed to accept one typo.
* default: 4
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor1typo
*/
minWordSizefor1Typo?: number;
/**
* The minimum number of characters needed to accept two typo.
* fault: 8
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
*/
minWordSizefor2Typos?: number;
/**
* This option allows you to control the number of typos allowed in the result set:
* default: true
* 'true' The typo tolerance is enabled and all matching hits are retrieved
* 'false' The typo tolerance is disabled. All results with typos will be hidden.
* 'min' Only keep results with the minimum number of typos
* 'strict' Hits matching with 2 typos are not retrieved if there are some matching without typos.
* https://github.com/algolia/algoliasearch-client-js#minwordsizefor2typos
*/
typoTolerance?: boolean;
/**
* If set to false, disables typo tolerance on numeric tokens (numbers).
* default:
* https://github.com/algolia/algoliasearch-client-js#allowtyposonnumerictokens
*/
allowTyposOnNumericTokens?: boolean;
/**
* If set to true, plural won't be considered as a typo
* default: false
* https://github.com/algolia/algoliasearch-client-js#ignoreplurals
*/
ignorePlurals?: boolean;
/**
* List of attributes on which you want to disable typo tolerance
* default: ""
* https://github.com/algolia/algoliasearch-client-js#disabletypotoleranceonattributes
*/
disableTypoToleranceOnAttributes?: string;
/**
* Search for entries around a given location
* default: ""
* https://github.com/algolia/algoliasearch-client-js#aroundlatlng
*/
aroundLatLng?: string;
/**
* Search for entries around a given latitude/longitude automatically computed from user IP address.
* default: ""
* https://github.com/algolia/algoliasearch-client-js#aroundlatlngviaip
*/
aroundLatLngViaIP?: string;
/**
* Control the radius associated with a geo search. Defined in meters.
* default: null
* You can specify aroundRadius=all if you want to compute the geo distance without filtering in a geo area
* https://github.com/algolia/algoliasearch-client-js#aroundradius
*/
aroundRadius?: number | 'all';
/**
* Control the precision of a geo search
* default: null
* https://github.com/algolia/algoliasearch-client-js#aroundprecision
*/
aroundPrecision?: number;
/**
* Define the minimum radius used for a geo search when aroundRadius is not set.
* default: null
* https://github.com/algolia/algoliasearch-client-js#minimumaroundradius
*/
minimumAroundRadius?: number;
/**
* Search entries inside a given area defined by the two extreme points of a rectangle
* default: null
* https://github.com/algolia/algoliasearch-client-js#insideboundingbox
*/
insideBoundingBox?: number[][];
/**
* Selects how the query words are interpreted
* default: 'prefixLast'
* 'prefixAll' All query words are interpreted as prefixes. This option is not recommended.
* 'prefixLast' Only the last word is interpreted as a prefix (default behavior).
* 'prefixNone' No query word is interpreted as a prefix. This option is not recommended.
* https://github.com/algolia/algoliasearch-client-js#querytype
*/
queryType?: any;
/**
* Search entries inside a given area defined by a set of points
* defauly: ''
* https://github.com/algolia/algoliasearch-client-js#insidepolygon
*/
insidePolygon?: number[][];
/**
* This option is used to select a strategy in order to avoid having an empty result page
* default: 'none'
* 'lastWords' When a query does not return any results, the last word will be added as optional
* 'firstWords' When a query does not return any results, the first word will be added as optional
* 'allOptional' When a query does not return any results, a second trial will be made with all words as optional
* 'none' No specific processing is done when a query does not return any results
* https://github.com/algolia/algoliasearch-client-js#removewordsifnoresults
*/
removeWordsIfNoResults?: string;
/**
* Enables the advanced query syntax
* default: false
* https://github.com/algolia/algoliasearch-client-js#advancedsyntax
*/
advancedSyntax?: boolean;
/**
* A string that contains the comma separated list of words that should be considered as optional when found in the query
* default: []
* https://github.com/algolia/algoliasearch-client-js#optionalwords
*/
optionalWords?: string[];
/**
* Remove stop words from the query before executing it
* default: false
* true|false: enable or disable stop words for all 41 supported languages; or
* a list of language ISO codes (as a comma-separated string) for which stop words should be enable
* https://github.com/algolia/algoliasearch-client-js#removestopwords
*/
removeStopWords?: string[];
/**
* List of attributes on which you want to disable the computation of exact criteria
* default: []
* https://github.com/algolia/algoliasearch-client-js#disableexactonattributes
*/
disableExactOnAttributes?: string[];
/**
* This parameter control how the exact ranking criterion is computed when the query contains one word
* default: attribute
* 'none': no exact on single word query
* 'word': exact set to 1 if the query word is found in the record
* 'attribute': exact set to 1 if there is an attribute containing a string equals to the query
* https://github.com/algolia/algoliasearch-client-js#exactonsinglewordquery
*/
exactOnSingleWordQuery?: string;
/**
* Specify the list of approximation that should be considered as an exact match in the ranking formula
* default: ['ignorePlurals', 'singleWordSynonym']
* 'ignorePlurals': alternative words added by the ignorePlurals feature
* 'singleWordSynonym': single-word synonym (For example "NY" = "NYC")
* 'multiWordsSynonym': multiple-words synonym
* https://github.com/algolia/algoliasearch-client-js#alternativesasexact
*/
alternativesAsExact?: any;
/**
* If set to 1, enables the distinct feature, disabled by default, if the attributeForDistinct index setting is set.
* https://github.com/algolia/algoliasearch-client-js#distinct
*/
distinct?: any;
/**
* If set to true, the result hits will contain ranking information in the _rankingInfo attribute.
* default: false
* https://github.com/algolia/algoliasearch-client-js#getrankinginfo
*/
getRankingInfo?: boolean;
/**
* All numerical attributes are automatically indexed as numerical filters
* default: ''
* https://github.com/algolia/algoliasearch-client-js#numericattributestoindex
*/
numericAttributesToIndex?: string[];
/**
* @deprecated please use filters instead
* A string that contains the comma separated list of numeric filters you want to apply.
* https://github.com/algolia/algoliasearch-client-js#numericfilters-deprecated
*/
numericFilters?: string[];
/**
* @deprecated
* Filter the query by a set of tags.
* https://github.com/algolia/algoliasearch-client-js#tagfilters-deprecated
*/
tagFilters?: string;
/**
* @deprecated
* Filter the query by a set of facets.
* https://github.com/algolia/algoliasearch-client-js#facetfilters-deprecated
*/
facetFilters?: string;
/**
* If set to false, this query will not be taken into account in the analytics feature.
* default true
* https://github.com/algolia/algoliasearch-client-js#analytics
*/
analytics?: boolean;
/**
* If set, tag your query with the specified identifiers
* default: null
* https://github.com/algolia/algoliasearch-client-js#analyticstags
*/
analyticsTags?: string[];
/**
* If set to false, the search will not use the synonyms defined for the targeted index.
* default: true
* https://github.com/algolia/algoliasearch-client-js#synonyms
*/
synonyms?: boolean;
/**
* If set to false, words matched via synonym expansion will not be replaced by the matched synonym in the highlighted result.
* default: true
* https://github.com/algolia/algoliasearch-client-js#replacesynonymsinhighlight
*/
replaceSynonymsInHighlight?: boolean;
/**
* Configure the precision of the proximity ranking criterion
* default: 1
* https://github.com/algolia/algoliasearch-client-js#minproximity
*/
minProximity?: number;
nbShards?: number;
userData?: string | object;
}
interface AlgoliaResponse {
/**
* Contains all the hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hits: any[];
/**
* Current page
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
page: number;
/**
* Number of total hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbHits: number;
/**
* Number of pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbPage: number;
/**
* Number of hits per pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hitsPerPage: number;
/**
* Engine processing time (excluding network transfer)
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
processingTimeMS: number;
/**
* Query used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
query: string;
/**
* GET parameters used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
params: string;
facets: {
[facetName: string]: { [facetValue: string]: number };
};
}
namespace SearchForFacetValues {
interface Parameters extends QueryParameters {
/**
* The facet to search in
*/
facetName: string;
/**
* The query for the search in this facet
*/
facetQuery: string;
}
interface Response {
facetHits: { value: string; highlighted: string; count: number }[];
exhaustiveFacetsCount: boolean;
processingTimeMS: number;
}
}
interface Response {
/**
* Contains all the hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hits: any[];
/**
* Current page
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
page: number;
/**
* Number of total hits matching the query
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbHits: number;
/**
* Number of pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
nbPages: number;
/**
* Number of hits per pages
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
hitsPerPage: number;
/**
* Engine processing time (excluding network transfer)
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
processingTimeMS: number;
/**
* Query used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
query: string;
/**
* GET parameters used to perform the search
* https://github.com/algolia/algoliasearch-client-js#response-format
*/
params: string;
facets?: {
[facetName: string]: { [facetValue: string]: number };
};
}
interface MultiResponse {
results: Response[];
}
}
declare function algoliasearch(
applicationId: string,
apiKey: string,
options?: algoliasearch.ClientOptions
): algoliasearch.Client;
export = algoliasearch;
+2 -1
View File
@@ -18,6 +18,7 @@
},
"files": [
"index.d.ts",
"lite/index.d.ts",
"algoliasearch-tests.ts"
]
}
}
+2 -4
View File
@@ -1,11 +1,9 @@
// Type definitions for Angular Translate (pascalprecht.translate module) 2.15
// Project: https://github.com/PascalPrecht/angular-translate
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions by: Michel Salib <https://github.com/michelsalib>, Gabriel Gil <https://github.com/GabrielGil>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />
declare var _: string;
export = _;
@@ -69,7 +67,7 @@ declare module 'angular' {
versionInfo(): string;
loaderCache(): any;
isReady(): boolean;
onReady(): angular.IPromise<void>;
onReady(fn?: () => void): angular.IPromise<void>;
resolveClientLocale(): string;
getAvailableLanguageKeys(): string[];
}
+12 -1
View File
@@ -1138,7 +1138,8 @@ angular.module('multiSlotTranscludeExample', [])
};
});
angular.module('componentExample', [])
// $ExpectType IModule
const componentModule = angular.module('componentExample', [])
.component('counter', {
require: {ctrl: '^ctrl'},
bindings: {
@@ -1160,6 +1161,16 @@ angular.module('componentExample', [])
},
template: '',
transclude: true
})
.component({
aThirdComponent: {
controller: class AThirdComponentController {
count: number;
},
bindings: {
count: '='
}
}
});
interface ICopyExampleUser {
+8 -1
View File
@@ -196,6 +196,12 @@ declare namespace angular {
* @param options A definition object passed into the component.
*/
component(name: string, options: IComponentOptions): IModule;
/**
* Use this method to register a component.
*
* @param object Object map of components where the keys are the names and the values are the component definition objects
*/
component(object: {[componentName: string]: IComponentOptions}): IModule;
/**
* Use this method to register work which needs to be performed on module loading.
*
@@ -1028,7 +1034,7 @@ declare namespace angular {
all<T1, T2, T3, T4>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise <T4>]): IPromise<[T1, T2, T3, T4]>;
all<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[T1, T2, T3]>;
all<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[T1, T2]>;
all<TAll>(promises: Array<IPromise<TAll>>): IPromise<TAll[]>;
all<TAll>(promises: Array<TAll | IPromise<TAll>>): IPromise<TAll[]>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
*
@@ -1273,6 +1279,7 @@ declare namespace angular {
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
component(name: string, options: IComponentOptions): ICompileProvider;
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
aHrefSanitizationWhitelist(): RegExp;
aHrefSanitizationWhitelist(regexp: RegExp): ICompileProvider;
@@ -0,0 +1,15 @@
import Layer from '@atlaskit/layer';
import * as React from 'react';
import { render } from 'react-dom';
declare const container: Element;
render(
<Layer
position="bottom left"
content={<h1>Hello, world!</h1>}
autoFlip={false}
/>,
container,
);
+72
View File
@@ -0,0 +1,72 @@
// Type definitions for @atlaskit/layer 3.1
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/src/master/
// Definitions by: Lee Standen <https://github.com/lstanden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { Component, ReactNode } from 'react';
export default class Layer extends Component<Props> {}
export interface Props {
/**
* Sets whether the content auto flip when it reaches the border set it as true for default flip
* or set the custom flip positions
*/
autoFlip?: boolean | FlipPositionType | FlipPositionType[];
/**
* Element to act as a boundary for the Layer. The Layer will not sit outside this element if it
* can help it. If, through it's normal positoning, it would end up outside the boundary the
* layer will flip positions if the autoPosition prop is set.
*/
boundariesElement?: BoundariesElementType;
/** Target to which layer is attached */
children?: ReactNode;
/** HTML content to display in the layer. Will be aligned to the target according to the position prop. */
content?: ReactNode;
/**
* String representing the offsets from the target element in the format "[x-offset][y-offset]",
* measured in pixels.
*/
offset?: string;
/**
* Callback that is used to know when the flipped state of Layer changes. This occurs when placing a
* Layered element in the requested position would cause Layer to be rendered outside of the
* boundariesElement (usually viewport).
*/
onFlippedChange?: (
flipped: boolean,
actualPosition: CSSPositionType,
originalPosition: CSSPositionType,
) => void;
/**
* Position of a layer relative to its target. The position attribute takes two positional arguments in
* the format position="edge edge-position", where edge specifies what edge to align the layer to, and
* edge-position specifies where on that edge the layer should appear.
*/
position?: PositionType;
/** z-index for the layer component */
zIndex?: number;
/** Lock scrolling behind the layer */
lockScroll?: boolean;
}
export type FlipPositionType = 'top' | 'right' | 'bottom' | 'left';
export type PositionType =
| 'top left'
| 'top center'
| 'top right'
| 'right top'
| 'right middle'
| 'right bottom'
| 'bottom left'
| 'bottom center'
| 'bottom right'
| 'left top'
| 'left middle'
| 'left bottom';
export type BoundariesElementType = 'viewport' | 'window' | 'scrollParent';
export type CSSPositionType = 'absolute' | 'fixed';
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"paths": {
"@atlaskit/layer": ["atlaskit__layer"]
}
},
"files": ["index.d.ts", "atlaskit__layer-tests.tsx"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,14 @@
import SingleSelect, { StatelessSelect } from '@atlaskit/single-select';
import * as React from 'react';
import { render } from 'react-dom';
declare const container: Element;
render(
<div>
<SingleSelect />
<StatelessSelect />
</div>,
container,
);
+125
View File
@@ -0,0 +1,125 @@
// Type definitions for @atlaskit/single-select 4.0
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/src/master/
// Definitions by: Lee Standen <https://github.com/lstanden>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import { Component, ReactNode, SyntheticEvent } from 'react';
export default class SingleSelect extends Component<Props> {}
export class StatelessSelect extends Component<StatelessProps> {}
export interface Props {
/** Subtle items do not have a background color. */
appearance?: 'default' | 'subtle';
/** Item to be selected on component mount. */
defaultSelected?: ItemType;
/** Sets whether the dropdown should be constrained to the width of its trigger */
droplistShouldFitContainer?: boolean;
/**
* Sets whether the field should be selectable. If it is, the field will be
* a text box, which will filter the items.
*/
hasAutocomplete?: boolean;
/** id property to be passed down to the html select component. */
id?: string;
/** message to show on the dialog when isInvalid is true */
invalidMessage?: ReactNode;
/** controls the top margin of the label component rendered. */
isFirstChild?: boolean;
/** Sets whether the select is selectable. Changes hover state. */
isDisabled?: boolean;
/** Sets whether the component should be open on mount. */
isDefaultOpen?: boolean;
/**
* Sets whether form including select can be submitted without an option
* being made.
*/
isRequired?: boolean;
/**
* Set whether there is an error with the selection. Sets an orange border
* and shows the warning icon.
*/
isInvalid?: boolean;
/**
* An array of objects, each one of which must have an array of items, and
* may have a heading. All items should have content and value properties, with
* content being the displayed text.
*/
items?: GroupType[];
/** Label to be displayed above select. */
label?: string;
/** name property to be passed to the html select element. */
name?: string;
/**
* Message to display in any group in items if there are no items in it,
* including if there is one item that has been selected.
*/
noMatchesFound?: string;
/** Handler to be called when the filtered items changes. */
onFilterChange?: (filter: string) => void;
/**
* Handler to be called when an item is selected. Called with an object that
* has the item selected as a property on the object.
*/
onSelected?: (item: ItemType) => void;
/**
* Handler called when the select is opened or closed. Called with an object
* that has both the event, and the new isOpen state.
*/
onOpenChange?: (
change: { event: SyntheticEvent<any>; isOpen: boolean },
) => void;
/** Text to be shown within the select when no item is selected. */
placeholder?: string;
/** Where the select dropdown should be displayed relative to the field position. */
position?: string;
/** Sets whether the field will become focused. */
shouldFocus?: boolean;
/** Sets whether the field should be constrained to the width of its trigger */
shouldFitContainer?: boolean;
/** Sets whether the droplist should flip its position when there is not enough space. */
shouldFlip?: boolean;
/** Set the max height of the dropdown list in pixels. */
maxHeight?: number;
}
export interface StatelessProps extends Props {
/** Value to be used when filtering the items. Compared against 'content'. */
filterValue?: string;
/** Sets whether the Select dropdown is open. */
isOpen?: boolean;
/**
* Sets whether the field is loading data. The same property is used
* for either initial fetch (when no options are available) as well for
* subsequent loading of more options. The component reacts accordingly
* based on the `items` provided.
*/
isLoading?: boolean;
/**
* Message to be displayed when the component is set to its loading state.
* The message might be displayed differently depending on whether or not
* there are items already being rendered.
*/
loadingMessage?: string;
/** The selected item data */
selectedItem?: ItemType;
}
export interface GroupType {
heading?: string;
items: ItemType[];
}
export interface ItemType {
content?: ReactNode;
description?: string;
label?: string;
tooltipDescription?: string;
tooltipPosition?: 'top' | 'bottom' | 'left';
value?: string | number;
filterValues?: string[];
isDisabled?: boolean;
isSelected?: boolean;
elemBefore?: ReactNode;
}
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"paths": {
"@atlaskit/single-select": ["atlaskit__single-select"]
}
},
"files": ["index.d.ts", "atlaskit__single-select-tests.tsx"]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -1
View File
@@ -258,6 +258,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions);
const authResult : AuthResult = {
accessToken: 'fake_access_token',
expiresIn: 7200,
idToken: 'fake_id_token',
idTokenPayload: {
aud: "EaQzyHt1Dy57l-r5iHcMeT-lh1fFZntg",
@@ -267,5 +268,6 @@ const authResult : AuthResult = {
sub: "auth0|aksjfkladsf"
},
refreshToken: undefined,
state: "923jf092j3.FFSDJFDSKLDF"
state: "923jf092j3.FFSDJFDSKLDF",
tokenType: 'Bearer'
};
+5 -1
View File
@@ -165,6 +165,8 @@ interface Auth0LockShowOptions {
interface AuthResult {
accessToken: string;
appState?: any;
expiresIn: number;
idToken: string;
idTokenPayload: {
aud: string;
@@ -174,8 +176,10 @@ interface AuthResult {
sub: string;
};
refreshToken?: string;
scope?: string;
state: string;
}
tokenType: string;
}
interface Auth0LockStatic {
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
+19
View File
@@ -75,6 +75,25 @@ management
// Handle the error.
});
// Link users
management
.createUser({ connection: 'email', email: 'hi@me.co' })
.catch(err => console.error('Cannot create E-mail user', err))
.then((emailUser) => {
if (!emailUser) return;
management
.createUser({ connection: 'sms', phone_number: '+1234567890' })
.catch(err => console.error('Cannot create SMS user', err))
.then((smsUser) => {
if (!smsUser) return;
const userId = emailUser.user_id;
const params = { user_id: smsUser.user_id, provider: 'sms' };
management.linkUsers(userId, params)
.catch(err => console.error('Cannot link E-mail and SMS users', err))
.then((linkedUsers) => console.log(linkedUsers))
})
});
auth
.requestChangePasswordEmail({
connection: 'My-Connection',
+12 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for auth0 2.7
// Type definitions for auth0 2.9.1
// 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
@@ -345,6 +345,14 @@ export interface Identity {
user_id: string;
provider: string;
isSocial: boolean;
profileData?: {
email?: string;
email_verified?: boolean;
name?: string;
phone_number?: string;
phone_verified?: boolean;
request_language?: string;
}
}
export interface AuthenticationClientOptions {
@@ -462,7 +470,7 @@ export interface UnlinkAccountsResponse {
profileData?: UnlinkAccountsResponseProfile
}
export interface LinkAccountsData {
export interface LinkAccountsParams {
user_id: string;
connection_id?: string;
provider?: string;
@@ -664,8 +672,8 @@ export class ManagementClient {
unlinkUsers(params: UnlinkAccountsParams): Promise<UnlinkAccountsResponse>;
unlinkUsers(params: UnlinkAccountsParams, cb: (err: Error, data: UnlinkAccountsResponse) => void): void;
linkUsers(userId: string, data: LinkAccountsData): Promise<any>;
linkUsers(userId: string, data: LinkAccountsData, cb: (err: Error, data: any) => void): void;
linkUsers(userId: string, params: LinkAccountsParams): Promise<any>;
linkUsers(userId: string, params: LinkAccountsParams, cb: (err: Error, data: any) => void): void;
// Tokens
+1
View File
@@ -11,6 +11,7 @@ new Awesomplete(input, {
const awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
awesomplete.destroy();
new Awesomplete(input, {
list: [
+5 -1
View File
@@ -1,6 +1,9 @@
// Type definitions for Awesomplete 1.1
// Project: https://leaverou.github.io/awesomplete/
// Definitions by: webbiesdk <https://github.com/webbiesdk>, Ben Dixon <https://github.com/bmdixon>, Trevor Bekolay <https://github.com/tbekolay>
// Definitions by: webbiesdk <https://github.com/webbiesdk>
// Ben Dixon <https://github.com/bmdixon>
// Trevor Bekolay <https://github.com/tbekolay>
// Chris LoPresto <https://github.com/chrislopresto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Awesomplete {
@@ -35,6 +38,7 @@ declare class Awesomplete {
selected: boolean;
open: () => void;
status: HTMLElement;
destroy: () => void;
}
declare namespace Awesomplete {
+73
View File
@@ -0,0 +1,73 @@
import '../behavior3';
// Test decode
const blackboard = new b3.Blackboard();
const behaviorTree = new b3.BehaviorTree();
behaviorTree.load({
version: "0.3.0",
scope: "tree",
id: "6bc03cd0-38ef-4a3e-8e08-54c412491525",
title: "A behavior tree",
description: "",
root: "607d29f5-9dbc-4cc4-8ebb-e57c4908d87b",
properties: {},
nodes: {
"607d29f5-9dbc-4cc4-8ebb-e57c4908d87b": {
id: "607d29f5-9dbc-4cc4-8ebb-e57c4908d87b",
name: "Sequence",
title: "Sequence",
description: "",
properties: {},
display: {
x: -216,
y: -36
},
children: [
"09f04185-205b-40c0-8494-ffd53ffd0820",
"df7366f8-999a-4971-872c-cef57607f99f"
]
},
"df7366f8-999a-4971-872c-cef57607f99f": {
id: "df7366f8-999a-4971-872c-cef57607f99f",
name: "Runner",
title: "Runner",
description: "",
properties: {},
display: {
x: -12,
y: -36
}
},
"e498e1a5-5295-43c3-8716-20dd6d3407f2": {
id: "e498e1a5-5295-43c3-8716-20dd6d3407f2",
name: "Succeeder",
title: "Succeeder",
description: "",
properties: {},
display: {
x: 192,
y: -96
}
},
"09f04185-205b-40c0-8494-ffd53ffd0820": {
id: "09f04185-205b-40c0-8494-ffd53ffd0820",
name: "Inverter",
title: "Inverter",
description: "",
properties: {},
display: {
x: -36,
y: -108
},
child: "e498e1a5-5295-43c3-8716-20dd6d3407f2"
}
},
display: {
camera_x: 640,
camera_y: 324,
camera_z: 1,
x: -324,
y: -36
}
});
behaviorTree.tick(null, blackboard);
+908
View File
@@ -0,0 +1,908 @@
// Type definitions for behavior3 0.2
// Project: https://github.com/behavior3/behavior3js
// Definitions by: carry.wu <https://github.com/carrrywu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Behavior3JS
* ===========
*
* * * *
*
* **Behavior3JS** is a Behavior Tree library written in JavaScript. It
* provides structures and algorithms that assist you in the task of creating
* intelligent agents for your game or application. Check it out some features
* of Behavior3JS:
*
* - Based on the work of (Marzinotto et al., 2014), in which they propose a
* **formal**, **consistent** and **general** definition of Behavior Trees;
* - **Optimized to control multiple agents**: you can use a single behavior
* tree instance to handle hundreds of agents;
* - It was **designed to load and save trees in a JSON format**, in order to
* use, edit and test it in multiple environments, tools and languages;
* - A **cool visual editor** which you can access online;
* - Several **composite, decorator and action nodes** available within the
* library. You still can define your own nodes, including composites and
* decorators;
* - **Completely free**, the core module and the visual editor are all
* published under the MIT License, which means that you can use them for
* your open source and commercial projects;
* - **Lightweight**!
*
* Visit http://behavior3.com to know more!
*
*
* ## Core Classes and Functions
*
* This library include the following core structures...
*
*
* **Public:**
*
* - **BehaviorTree**: the structure that represents a Behavior Tree;
* - **Blackboard**: represents a "memory" in an agent and is required to to
* run a `BehaviorTree`;
* - **Composite**: base class for all composite nodes;
* - **Decorator**: base class for all decorator nodes;
* - **Action**: base class for all action nodes;
* - **Condition**: base class for all condition nodes;
*
*
* **Internal:**
*
* - **Tick**: used as container and tracking object through the tree during
* the tick signal;
* - **BaseNode**: the base class that provide all common node features;
*
* *Some classes are used internally on Behavior3JS, but you may need to access
* its functionalities eventually, specially the `Tick` object.*
*
*
* **Nodes:**
*
* - **Composite Nodes**: Sequence, Priority, MemSequence, MemPriority.
* - **Decorators**: Inverter, Limiter, MaxTime, Repeater,
* RepeaterUntilFailure, RepeaterUntilSuccess.
* - **Actions**: Succeeder, Failer, Error, Runner, Wait.
*
* ## The list of all constants in B3.
*
* NAME | VALUE
* ------------------- | ----------------------
* VERSION | depends on the version
* |
* **Node State** |
* SUCCESS | 1
* FAILURE | 2
* RUNNING | 3
* ERROR | 4
* |
* **Node categories** |
* COMPOSITE | 'composite'
* DECORATOR | 'decorator'
* ACTION | 'action'
* CONDITION | 'condition'
*
*/
declare namespace b3 {
/**
* This function is used to create unique IDs for trees and nodes.
*
* (consult http://www.ietf.org/rfc/rfc4122.txt).
*
*/
function createUUID(): string;
/**
* The BaseNode class is used as super class to all nodes in BehaviorJS. It
* comprises all common variables and methods that a node must have to
* execute.
*
* **IMPORTANT:** Do not inherit from this class, use `Composite`,
* `Decorator`, `Action` or `Condition`, instead.
*
* The attributes are specially designed to serialization of the node in a
* JSON format. In special, the `parameters` attribute can be set into the
* visual editor (thus, in the JSON file), and it will be used as parameter
* on the node initialization at `BehaviorTree.load`.
*
* BaseNode also provide 5 callback methods, which the node implementations
* can override. They are `enter`, `open`, `tick`, `close` and `exit`. See
* their documentation to know more. These callbacks are called inside the
* `_execute` method, which is called in the tree traversal.
*
*/
class BaseNode {
/**
* Initialization method.
*/
constructor({category, name, title, description, properties}?: {category?: string, name?: string, title?: string, description?: string, properties?: any});
/**
* This is the main method to propagate the tick signal to this node. This
* method calls all callbacks: `enter`, `open`, `tick`, `close`, and
* `exit`. It only opens a node if it is not already open. In the same
* way, this method only close a node if the node returned a status
* different of `RUNNING`.
*
*/
_execute(tick: Tick): number;
/**
* Wrapper for enter method.
*/
_enter(tick: Tick): void;
/**
* Wrapper for open method.
*/
_open(tick: Tick): void;
/**
* Wrapper for tick method.
*/
_tick(tick: Tick): number;
/**
* Wrapper for close method.
*/
_close(tick: Tick): void;
/**
* Wrapper for exit method.
*/
_exit(tick: Tick): void;
/**
* Enter method, override this to use. It is called every time a node is
* asked to execute, before the tick itself.
*/
enter(tick: Tick): void;
/**
* Open method, override this to use. It is called only before the tick
* callback and only if the not isn't closed.
*
* Note: a node will be closed if it returned `RUNNING` in the tick.
*
*/
open(tick: Tick): void;
/**
* Tick method, override this to use. This method must contain the real
* execution of node (perform a task, call children, etc.). It is called
* every time a node is asked to execute.
*
*/
tick(tick: Tick): void;
/**
* Close method, override this to use. This method is called after the tick
* callback, and only if the tick return a state different from
* `RUNNING`.
*
*/
close(tick: Tick): void;
/**
* Exit method, override this to use. Called every time in the end of the
* execution.
*
*/
exit(tick: Tick): void;
}
/**
* Action is the base class for all action nodes. Thus, if you want to create
* new custom action nodes, you need to inherit from this class. For example,
* take a look at the Runner action:
*
* class Runner extends b3.Action {
* constructor(){
* super({name: 'Runner'});
* }
* tick(tick) {
* return b3.RUNNING;
* }
* };
*
*/
class Action extends BaseNode {
/**
* Creates an instance of Action.
*/
constructor({name, title, properties}?: {name?: string, title?: string, properties?: any});
}
/**
* The BehaviorTree class, as the name implies, represents the Behavior Tree
* structure.
*
* There are two ways to construct a Behavior Tree: by manually setting the
* root node, or by loading it from a data structure (which can be loaded
* from a JSON). Both methods are shown in the examples below and better
* explained in the user guide.
*
* The tick method must be called periodically, in order to send the tick
* signal to all nodes in the tree, starting from the root. The method
* `BehaviorTree.tick` receives a target object and a blackboard as
* parameters. The target object can be anything: a game agent, a system, a
* DOM object, etc. This target is not used by any piece of Behavior3JS,
* i.e., the target object will only be used by custom nodes.
*
* The blackboard is obligatory and must be an instance of `Blackboard`. This
* requirement is necessary due to the fact that neither `BehaviorTree` or
* any node will store the execution variables in its own object (e.g., the
* BT does not store the target, information about opened nodes or number of
* times the tree was called). But because of this, you only need a single
* tree instance to control multiple (maybe hundreds) objects.
*
* Manual construction of a Behavior Tree
* --------------------------------------
*
* var tree = new b3.BehaviorTree();
*
* tree.root = new b3.Sequence({children:[
* new b3.Priority({children:[
* new MyCustomNode(),
* new MyCustomNode()
* ]}),
* ...
* ]});
*
*
* Loading a Behavior Tree from data structure
* -------------------------------------------
*
* var tree = new b3.BehaviorTree();
*
* tree.load({
* 'title' : 'Behavior Tree title'
* 'description' : 'My description'
* 'root' : 'node-id-1'
* 'nodes' : {
* 'node-id-1' : {
* 'name' : 'Priority', // this is the node type
* 'title' : 'Root Node',
* 'description' : 'Description',
* 'children' : ['node-id-2', 'node-id-3'],
* },
* ...
* }
* })
*
*/
class BehaviorTree {
/**
* Initialization method.
*/
constructor();
/**
* This method loads a Behavior Tree from a data structure, populating this
* object with the provided data. Notice that, the data structure must
* follow the format specified by Behavior3JS. Consult the guide to know
* more about this format.
*
* You probably want to use custom nodes in your BTs, thus, you need to
* provide the `names` object, in which this method can find the nodes by
* `names[NODE_NAME]`. This variable can be a namespace or a dictionary,
* as long as this method can find the node by its name, for example:
*
* //json
* ...
* 'node1': {
* 'name': MyCustomNode,
* 'title': ...
* }
* ...
*
* //code
* var bt = new b3.BehaviorTree();
* bt.load(data, {'MyCustomNode':MyCustomNode})
*
*
*/
load(data: any, names?: any): void;
/**
* This method dump the current BT into a data structure.
*
* Note: This method does not record the current node parameters. Thus,
* it may not be compatible with load for now.
*
*/
dump(): any;
/**
* Propagates the tick signal through the tree, starting from the root.
*
* This method receives a target object of any type (Object, Array,
* DOMElement, whatever) and a `Blackboard` instance. The target object has
* no use at all for all Behavior3JS components, but surely is important
* for custom nodes. The blackboard instance is used by the tree and nodes
* to store execution variables (e.g., last node running) and is obligatory
* to be a `Blackboard` instance (or an object with the same interface).
*
* Internally, this method creates a Tick object, which will store the
* target and the blackboard objects.
*
* Note: BehaviorTree stores a list of open nodes from last tick, if these
* nodes weren't called after the current tick, this method will close them
* automatically.
*
*/
tick(target: any, blackboard: Blackboard): string;
}
/**
* The Blackboard is the memory structure required by `BehaviorTree` and its
* nodes. It only have 2 public methods: `set` and `get`. These methods works
* in 3 different contexts: global, per tree, and per node per tree.
*
* Suppose you have two different trees controlling a single object with a
* single blackboard, then:
*
* - In the global context, all nodes will access the stored information.
* - In per tree context, only nodes sharing the same tree share the stored
* information.
* - In per node per tree context, the information stored in the blackboard
* can only be accessed by the same node that wrote the data.
*
* The context is selected indirectly by the parameters provided to these
* methods, for example:
*
* // getting/setting variable in global context
* blackboard.set('testKey', 'value');
* var value = blackboard.get('testKey');
*
* // getting/setting variable in per tree context
* blackboard.set('testKey', 'value', tree.id);
* var value = blackboard.get('testKey', tree.id);
*
* // getting/setting variable in per node per tree context
* blackboard.set('testKey', 'value', tree.id, node.id);
* var value = blackboard.get('testKey', tree.id, node.id);
*
* Note: Internally, the blackboard store these memories in different
* objects, being the global on `_baseMemory`, the per tree on `_treeMemory`
* and the per node per tree dynamically create inside the per tree memory
* (it is accessed via `_treeMemory[id].nodeMemory`). Avoid to use these
* variables manually, use `get` and `set` instead.
*
*/
class Blackboard {
/**
* Initialization method.
*/
constructor();
/**
* Internal method to retrieve the tree context memory. If the memory does
* not exist, this method creates it.
*
*/
_getTreeMemory(treeScope: string): any;
/**
* Internal method to retrieve the node context memory, given the tree
* memory. If the memory does not exist, this method creates is.
*
*/
_getNodeMemory(treeMemory: string, nodeScope: string): any;
/**
* Internal method to retrieve the context memory. If treeScope and
* nodeScope are provided, this method returns the per node per tree
* memory. If only the treeScope is provided, it returns the per tree
* memory. If no parameter is provided, it returns the global memory.
* Notice that, if only nodeScope is provided, this method will still
* return the global memory.
*
*/
_getMemory(treeScope: string, nodeScope: string): any;
/**
* Stores a value in the blackboard. If treeScope and nodeScope are
* provided, this method will save the value into the per node per tree
* memory. If only the treeScope is provided, it will save the value into
* the per tree memory. If no parameter is provided, this method will save
* the value into the global memory. Notice that, if only nodeScope is
* provided (but treeScope not), this method will still save the value into
* the global memory.
*
*/
set(key: string, value: string, treeScope: string, nodeScope: string): void;
/**
* Retrieves a value in the blackboard. If treeScope and nodeScope are
* provided, this method will retrieve the value from the per node per tree
* memory. If only the treeScope is provided, it will retrieve the value
* from the per tree memory. If no parameter is provided, this method will
* retrieve from the global memory. If only nodeScope is provided (but
* treeScope not), this method will still try to retrieve from the global
* memory.
*
*/
get(key: string, treeScope: string, nodeScope: string): any;
}
/**
* Composite is the base class for all composite nodes. Thus, if you want to
* create new custom composite nodes, you need to inherit from this class.
*
* When creating composite nodes, you will need to propagate the tick signal
* to the children nodes manually. To do that, override the `tick` method and
* call the `_execute` method on all nodes. For instance, take a look at how
* the Sequence node inherit this class and how it call its children:
*
* // Inherit from Composite, using the util function Class.
* class Sequence extends Composite {
*
* constructor(){
* // Remember to set the name of the node.
* super({name: 'Sequence'});
* }
*
* // Override the tick function
* tick(tick) {
*
* // Iterates over the children
* for (var i=0; i<this.children.length; i++) {
*
* // Propagate the tick
* var status = this.children[i]._execute(tick);
*
* if (status !== SUCCESS) {
* return status;
* }
* }
*
* return SUCCESS;
* }
* };
*
*/
class Composite extends BaseNode {
/**
* Creates an instance of Composite.
*/
constructor({children, name, title, properties}?: {children?: BaseNode[], name?: string, title?: string, properties?: any});
}
/**
* Condition is the base class for all condition nodes. Thus, if you want to
* create new custom condition nodes, you need to inherit from this class.
*
*/
class Condition extends BaseNode {
/**
* Creates an instance of Condition.
*/
constructor({name, title, properties}?: {name?: string, title?: string, properties?: any});
}
/**
* Decorator is the base class for all decorator nodes. Thus, if you want to
* create new custom decorator nodes, you need to inherit from this class.
*
* When creating decorator nodes, you will need to propagate the tick signal
* to the child node manually, just like the composite nodes. To do that,
* override the `tick` method and call the `_execute` method on the child
* node. For instance, take a look at how the Inverter node inherit this
* class and how it call its children:
*
* // Inherit from Decorator, using the util function Class.
* class Inverter extends b3.Decorator {
*
* constructor(){
* super({name: 'Invereter'});
* }
*
* tick: function(tick) {
* if (!this.child) {
* return b3.ERROR;
* }
*
* // Propagate the tick
* var status = this.child._execute(tick);
*
* if (status === b3.SUCCESS) {
* status = b3.FAILURE;
* } else if (status === b3.FAILURE) {
* status = b3.SUCCESS;
* }
*
* return status;
* }
* });
*
*/
class Decorator extends BaseNode {
/**
* Creates an instance of Decorator.
*/
constructor({child, name, title, properties}?: {child?: BaseNode, name?: string, title?: string, properties?: any});
}
/**
* A new Tick object is instantiated every tick by BehaviorTree. It is passed
* as parameter to the nodes through the tree during the traversal.
*
* The role of the Tick class is to store the instances of tree, debug,
* target and blackboard. So, all nodes can access these informations.
*
* For internal uses, the Tick also is useful to store the open node after
* the tick signal, in order to let `BehaviorTree` to keep track and close
* them when necessary.
*
* This class also makes a bridge between nodes and the debug, passing the
* node state to the debug if the last is provided.
*
*/
class Tick {
/**
* Initialization method.
*/
constructor();
/**
* Called when entering a node (called by BaseNode).
*/
_enterNode(node: any): void;
/**
* Callback when opening a node (called by BaseNode).
*/
_openNode(node: any): void;
/**
* Callback when ticking a node (called by BaseNode).
*/
_tickNode(node: any): void;
/**
* Callback when closing a node (called by BaseNode).
*/
_closeNode(node: any): void;
/**
* Callback when exiting a node (called by BaseNode).
*/
_exitNode(node: any): void;
}
/**
* This action node returns `ERROR` always.
*
*/
class Error extends Action {
/**
* Creates an instance of Error.
*/
constructor();
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* This action node returns `FAILURE` always.
*
*/
class Failer extends Action {
/**
* Creates an instance of Failer.
*/
constructor();
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* This action node returns RUNNING always.
*
*/
class Runner extends Action {
/**
* Creates an instance of Runner.
*/
constructor();
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* This action node returns `SUCCESS` always.
*
*/
class Succeeder extends Action {
/**
* Creates an instance of Succeeder.
*/
constructor();
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* Wait a few seconds.
*
*/
class Wait extends Action {
/**
* Creates an instance of Wait.
*/
constructor({milliseconds}?: {milliseconds?: number});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* MemPriority is similar to Priority node, but when a child returns a
* `RUNNING` state, its index is recorded and in the next tick the,
* MemPriority calls the child recorded directly, without calling previous
* children again.
*
*/
class MemPriority extends Composite {
/**
* Creates an instance of MemPriority.
*/
constructor({children}?: {children?: BaseNode[]});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* MemSequence is similar to Sequence node, but when a child returns a
* `RUNNING` state, its index is recorded and in the next tick the
* MemPriority call the child recorded directly, without calling previous
* children again.
*
*/
class MemSequence extends Composite {
/**
* Creates an instance of MemSequence.
*/
constructor({children}?: {children?: BaseNode[]});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* Priority ticks its children sequentially until one of them returns
* `SUCCESS`, `RUNNING` or `ERROR`. If all children return the failure state,
* the priority also returns `FAILURE`.
*
*/
class Priority extends Composite {
/**
* Creates an instance of Priority.
*/
constructor({children}?: {children?: BaseNode[]});
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* The Sequence node ticks its children sequentially until one of them
* returns `FAILURE`, `RUNNING` or `ERROR`. If all children return the
* success state, the sequence also returns `SUCCESS`.
*
*/
class Sequence extends Composite {
/**
* Creates an instance of Sequence.
*/
constructor({children}?: {children?: BaseNode[]});
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* The Inverter decorator inverts the result of the child, returning `SUCCESS`
* for `FAILURE` and `FAILURE` for `SUCCESS`.
*
*/
class Inverter extends Decorator {
/**
* Creates an instance of Inverter.
*/
constructor({child}?: {child?: BaseNode});
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* This decorator limit the number of times its child can be called. After a
* certain number of times, the Limiter decorator returns `FAILURE` without
* executing the child.
*
*/
class Limiter extends Decorator {
/**
* Creates an instance of Limiter.
*
* Settings parameters:
*
* - **maxLoop** (*Integer*) Maximum number of repetitions.
* - **child** (*BaseNode*) The child node.
*
*/
constructor({child, maxLoop}?: {child?: BaseNode, maxLoop?: number});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* The MaxTime decorator limits the maximum time the node child can execute.
* Notice that it does not interrupt the execution itself (i.e., the child
* must be non-preemptive), it only interrupts the node after a `RUNNING`
* status.
*
*/
class MaxTime extends Decorator {
/**
* Creates an instance of MaxTime.
*
* - **maxTime** (*Integer*) Maximum time a child can execute.
* - **child** (*BaseNode*) The child node.
*
*/
constructor({maxTime, child}?: {maxTime?: number, child?: BaseNode});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* RepeatUntilFailure is a decorator that repeats the tick signal until the
* node child returns `FAILURE`, `RUNNING` or `ERROR`. Optionally, a maximum
* number of repetitions can be defined.
*
*/
class RepeatUntilFailure extends Decorator {
/**
* Creates an instance of RepeatUntilFailure.
*
* - **maxLoop** (*Integer*) Maximum number of repetitions. Default to -1 (infinite).
* - **child** (*BaseNode*) The child node.
*
*/
constructor({maxLoop, child}?: {maxLoop?: number, child?: BaseNode});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* RepeatUntilSuccess is a decorator that repeats the tick signal until the
* node child returns `SUCCESS`, `RUNNING` or `ERROR`. Optionally, a maximum
* number of repetitions can be defined.
*
*/
class RepeatUntilSuccess extends Decorator {
/**
* Creates an instance of RepeatUntilSuccess.
*
* - **maxLoop** (*Integer*) Maximum number of repetitions. Default to -1 (infinite).
* - **child** (*BaseNode*) The child node.
*
*/
constructor({maxLoop, child}?: {maxLoop?: number, child?: BaseNode});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
/**
* Repeater is a decorator that repeats the tick signal until the child node
* return `RUNNING` or `ERROR`. Optionally, a maximum number of repetitions
* can be defined.
*
*/
class Repeater extends Decorator {
/**
* Creates an instance of MaxTime.
*
* - **maxLoop** (*Integer*) Maximum number of repetitions. Default to -1 (infinite).
* - **child** (*BaseNode*) The child node.
*
*/
constructor({maxLoop, child}?: {maxLoop?: number, child?: BaseNode});
/**
* Open method.
*/
open(tick: Tick): void;
/**
* Tick method.
*/
tick(tick: Tick): number;
}
const VERSION: string;
const SUCCESS: number;
const FAILURE: number;
const RUNNING: number;
const ERROR: number;
const COMPOSITE: string;
const DECORATOR: string;
const ACTION: string;
const CONDITION: string;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"strictFunctionTypes": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"behavior3-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,19 @@
import BiMap from "bidirectional-map";
const bidirectionalMap = new BiMap({
one: 1
});
bidirectionalMap.size; // $ExpectType number
bidirectionalMap.set("two", 2);
bidirectionalMap.set("three", 3);
bidirectionalMap.get("one"); // $ExpectType number
bidirectionalMap.get(true); // $ExpectError
bidirectionalMap.getKey(1); // $ExpectType string
bidirectionalMap.getKey("one"); // $ExpectError
bidirectionalMap.delete("two");
bidirectionalMap.deleteValue(3);
bidirectionalMap.entries(); // $ExpectType IterableIterator<[string, number]>
bidirectionalMap.has("one"); // $ExpectType boolean
bidirectionalMap.hasValue(2); // $ExpectType boolean
bidirectionalMap.keys(); // $ExpectType IterableIterator<string>
bidirectionalMap.values(); // $ExpectType IterableIterator<number>
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for bidirectional-map 1.0
// Project: https://github.com/educastellano/bidirectional-map
// Definitions by: Helen Anderson <https://github.com/helenanderson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
export default class BiMap<TValue> {
constructor(object?: { [i: string]: TValue });
size: number;
set(key: string, value: TValue): void;
get(key: string): TValue;
getKey(value: TValue): string;
clear(): void;
delete(key: string): void;
deleteValue(value: TValue): void;
entries(): IterableIterator<[string, TValue]>;
has(key: string): boolean;
hasValue(value: TValue): boolean;
keys(): IterableIterator<string>;
values(): IterableIterator<TValue>;
}
+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",
"bidirectional-map-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -30,3 +30,10 @@ const options: retry.Options = {
};
retry(logFail, options);
function stopErrorExample() {
console.log('retrying\n');
throw new retry.StopError('stop retrying');
}
retry(stopErrorExample);
+2
View File
@@ -20,6 +20,8 @@ declare namespace retry {
context?: any;
args?: any;
}
class StopError extends Error {}
}
export = retry;
+24 -4
View File
@@ -167,8 +167,8 @@ browserSync({
browserSync({
proxy: {
target: "http://yourlocal.dev",
proxyRes: function (proxyRes, req, res) {
console.log(proxyRes);
proxyRes: function (proxyResponse, req, res) {
console.log(proxyResponse);
}
}
});
@@ -177,8 +177,28 @@ browserSync({
proxy: {
target: "http://yourlocal.dev",
proxyRes: [
function (proxyRes, req, res) {
console.log(proxyRes);
function (proxyResponse, req, res) {
console.log(proxyResponse);
}
]
}
});
browserSync({
proxy: {
target: "http://yourlocal.dev",
proxyRes: function (res) {
console.log(res);
}
}
});
browserSync({
proxy: {
target: "http://yourlocal.dev",
proxyRes: [
function (res) {
console.log(res);
}
]
}
+39 -17
View File
@@ -39,7 +39,7 @@ declare namespace browserSync {
* Specify which file events to respond to.
* Available events: `add`, `change`, `unlink`, `addDir`, `unlinkDir`
*/
watchEvents?: string[];
watchEvents?: WatchEvents | string[];
/**
* Watch files automatically.
*/
@@ -72,7 +72,7 @@ declare namespace browserSync {
* ws - Default: undefined
* middleware - Default: undefined
* reqHeaders - Default: undefined
* proxyRes - Default: undefined
* proxyRes - Default: undefined (http.ServerResponse if expecting single parameter)
* proxyReq - Default: undefined
*/
proxy?: string | ProxyOptions;
@@ -91,7 +91,7 @@ declare namespace browserSync {
* Default: []
* Note: Requires at least version 2.8.0.
*/
serveStatic?: (string | { route?: string | string[], dir?: string | string[]})[];
serveStatic?: StaticOptions[] | string[];
/**
* Options that are passed to the serve-static middleware when you use the
* string[] syntax: eg: `serveStatic: ['./app']`.
@@ -120,7 +120,7 @@ declare namespace browserSync {
* Can be either "info", "debug", "warn", or "silent"
* Default: info
*/
logLevel?: string;
logLevel?: LogLevel;
/**
* Change the console logging prefix. Useful if you're creating your own project based on Browsersync
* Default: BS
@@ -170,7 +170,7 @@ declare namespace browserSync {
* Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set.
* Can be true, local, external, ui, ui-external, tunnel or false
*/
open?: string | boolean;
open?: OpenOptions | boolean;
/**
* The browser(s) to open
* Default: default
@@ -320,6 +320,12 @@ declare namespace browserSync {
excludeFileTypes?: string[];
}
type WatchEvents = "add" | "change" | "unlink" | "addDir" | "unlinkDir";
type LogLevel = "info" | "debug" | "warn" | "silent";
type OpenOptions = "local" | "external" | "ui" | "ui-external" | "tunnel";
interface Hash<T> {
[path: string]: T;
}
@@ -353,16 +359,21 @@ declare namespace browserSync {
routes?: Hash<string>;
/** configure custom middleware */
middleware?: (MiddlewareHandler | PerRouteMiddleware)[];
serveStaticOptions?: ServeStaticOptions
serveStaticOptions?: ServeStaticOptions;
}
interface ProxyOptions {
target?: string;
middleware?: MiddlewareHandler;
ws?: boolean;
reqHeaders?: (config: any) => Hash<any>;
proxyRes?: ((res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any)[] | ((res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any);
proxyReq?: ((res: http.ServerRequest) => any)[] | ((res: http.ServerRequest) => any);
reqHeaders?: (config: object) => Hash<object>;
proxyRes?: ProxyResponseMiddleware | ProxyResponseMiddleware[];
proxyReq?: ((res: http.ServerRequest) => void)[] | ((res: http.ServerRequest) => void);
error?: (err: NodeJS.ErrnoException, req: http.IncomingMessage, res: http.ServerResponse) => void;
}
interface ProxyResponseMiddleware {
(proxyRes: http.ServerResponse | http.IncomingMessage, res: http.ServerResponse, req: http.IncomingMessage): void;
}
interface HttpsOptions {
@@ -370,11 +381,17 @@ declare namespace browserSync {
cert?: string;
}
interface StaticOptions {
route: string | string[],
dir: string | string[]
}
interface MiddlewareHandler {
(req: http.IncomingMessage, res: http.ServerResponse, next: Function): any;
(req: http.IncomingMessage, res: http.ServerResponse, next: () => void): any;
}
interface PerRouteMiddleware {
id?: string;
route: string;
handle: MiddlewareHandler;
}
@@ -382,18 +399,23 @@ declare namespace browserSync {
interface GhostOptions {
clicks?: boolean;
scroll?: boolean;
forms?: boolean | {
submit?: boolean;
inputs?: boolean;
toggles?: boolean;
};
forms?: FormsOptions | boolean;
}
interface FormsOptions {
inputs: boolean,
submit: boolean,
toggles: boolean
}
interface SnippetOptions {
async?: boolean,
async?: boolean;
whitelist?: string[],
blacklist?: string[],
rule?: { match?: RegExp; fn?: (snippet: string, match: string) => any };
rule?: {
match?: RegExp;
fn?: (snippet: string, match: string) => any
};
}
interface SocketOptions {
+1 -1
View File
@@ -166,7 +166,7 @@ declare namespace Chart {
interface ChartPoint {
x?: number | string | Date;
y?: number;
y?: number | string | Date;
r?: number;
}
+1
View File
@@ -263,6 +263,7 @@ declare namespace chrome.bookmarks {
export interface BookmarkRemoveInfo {
index: number;
parentId: string;
node: BookmarkTreeNode;
}
export interface BookmarkMoveInfo {
+10 -1
View File
@@ -2,7 +2,7 @@ import * as React from "react";
import Cleave = require("cleave.js");
import CleaveReact = require("cleave.js/react");
const Example1 = () => {
const ExampleSelector1 = () => {
const cleave = new Cleave("#my-input", { phone: true });
cleave.setPhoneRegionCode("AT");
cleave.setRawValue("foo");
@@ -11,6 +11,15 @@ const Example1 = () => {
cleave.destroy();
};
const ExampleElement1 = () => {
const input: HTMLElement = new HTMLElement();
const cleave = new Cleave(input, { date: true });
cleave.setRawValue("2001/01/01");
const formattedDate: string = cleave.getISOFormatDate();
cleave.destroy();
};
const ExampleReact1 = (props: any) => {
return (
<CleaveReact
+5 -3
View File
@@ -1,15 +1,15 @@
// Type definitions for cleave.js 1.1
// Type definitions for cleave.js 1.3
// Project: https://github.com/nosir/cleave.js
// Definitions by: C Lentfort <https://github.com/clentfort>,
// J Giancono <https://github.com/jasongi-at-sportsbet>,
// Alex Shakun <https://github.com/sashashakun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
// TypeScript Version: 2.8
import { CleaveOptions } from './options';
declare class Cleave {
constructor(selector: string, options: CleaveOptions);
constructor(selector: string | HTMLElement, options: CleaveOptions);
getRawValue(): string;
@@ -17,6 +17,8 @@ declare class Cleave {
getFormattedValue(): string;
getISOFormatDate(): string;
destroy(): void;
setPhoneRegionCode(regionCode: string): void;
+43
View File
@@ -0,0 +1,43 @@
import cloner = require("cloner");
interface A {
test: string;
nest: {
test: string;
num: number;
};
}
interface B {
somethingElse: string;
nest: {
somethingElse: string;
notNaN: number;
};
}
let aO: A;
let aN: A;
let bO: B;
let bN: B;
aO = {
test: "test",
nest: {
test: "nestTest",
num: 1
}
};
bO = {
somethingElse: "se",
nest: {
somethingElse: "nestSe",
notNaN: 0
}
};
aN = cloner.deep.copy(aO);
bN = cloner.shallow.copy(bO);
aN = cloner.deep.merge(aO, bO);
bN = cloner.shallow.merge(aO, bO);
+45
View File
@@ -0,0 +1,45 @@
// Type definitions for cloner 0.4
// Project: https://github.com/WebReflection/cloner
// Definitions by: matrumz <https://github.com/matrumz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Deep-style methods that will perform operations by value, instead of reference.
*/
export namespace deep {
/**
* Will loop over all own keys and deeply copy (copy by value) them to a new object.
*
* Preserves inheritance and is recursion aware, meaning it shouldn't fail with recursive properties.
* @param [obj] The object to copy.
*/
function copy<T>(obj: T): T;
/**
* Preserves what's already in the target and merges all own keys found in one or more passed sources.
*
* Properties are merged by value.
* @param [target] Destination object for merged properties.
* @param [sources] Source object(s) for properties to merge.
*/
function merge(target: any, ...sources: any[]): any;
}
/**
* Shallow-style methods that will perform operations by reference, instead of value.
*/
export namespace shallow {
/**
* Will loop over all own keys and shallow copy (copy by reference) them to a new object.
*
* Preserves inheritance and is recursion aware, meaning it shouldn't fail with recursive properties.
* @param [obj] The object to copy.
*/
function copy<T>(obj: T): T;
/**
* Preserves what's already in the target and merges all own keys found in one or more passed sources.
*
* Properties are merged by reference.
* @param [target] Destination object for merged properties.
* @param [sources] Source object(s) for properties to merge.
*/
function merge(target: any, ...sources: any[]): any;
}
+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",
"cloner-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -1,10 +1,24 @@
import commandLineArgs = require('command-line-args');
const optionDefinitions = [
{ name: 'verbose', alias: 'v', type: Boolean },
{ name: 'src', type: String, multiple: true, defaultOption: true },
{ name: 'timeout', alias: 't', type: Number }
const optionDefinitions: commandLineArgs.OptionDefinition[] = [
{
name: 'something',
alias: 's',
type: String,
defaultValue: '1',
multiple: true,
lazyMultiple: true,
defaultOption: true,
group: 'one'
}
];
const options = commandLineArgs(optionDefinitions);
const options = commandLineArgs(optionDefinitions, {
argv: [ '--one', '1' ],
partial: true,
stopAtFirstUnknown: true,
camelCase: true
});
const unknown = options._unknown;
const something = options.something;
+79 -76
View File
@@ -1,87 +1,90 @@
// Type definitions for command-line-args 4.0.7
// Type definitions for command-line-args 5.0
// Project: https://github.com/75lb/command-line-args
// Definitions by: CzBuCHi <https://github.com/CzBuCHi>
// Definitions by: Lloyd Brookes <https://github.com/75lb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/**
* Returns an object containing all options set on the command line. By default it parses the global [`process.argv`](https://nodejs.org/api/process.html#process_process_argv) array.
*
* By default, an exception is thrown if the user sets an unknown option (one without a valid [definition](#exp_module_definition--OptionDefinition)). To enable __partial parsing__, invoke `commandLineArgs` with the `partial` option - all unknown arguments will be returned in the `_unknown` property.
*
*
* @param {module:definition[]} - An array of [OptionDefinition](#exp_module_definition--OptionDefinition) objects
* @param [options] {object} - Options.
* @param [options.argv] {string[]} - An array of strings, which if passed will be parsed instead of `process.argv`.
* @param [options.partial] {boolean} - If `true`, an array of unknown arguments is returned in the `_unknown` property of the output.
* @returns {object}
* @throws `UNKNOWN_OPTION` if `options.partial` is false and the user set an undefined option
* @throws `NAME_MISSING` if an option definition is missing the required `name` property
* @throws `INVALID_TYPE` if an option definition has a `type` value that's not a function
* @throws `INVALID_ALIAS` if an alias is numeric, a hyphen or a length other than 1
* @throws `DUPLICATE_NAME` if an option definition name was used more than once
* @throws `DUPLICATE_ALIAS` if an option definition alias was used more than once
* @throws `DUPLICATE_DEFAULT_OPTION` if more than one option definition has `defaultOption: true`
* @alias module:command-line-args
* Returns an object containing option values parsed from the command line. By default it parses the global `process.argv` array.
* Parsing is strict by default. To be more permissive, enable `partial` or `stopAtFirstUnknown` modes.
*/
declare function commandLineArgs(optionDefinitions: commandLineArgs.OptionDefinition[], options?: commandLineArgs.Options): any;
declare function commandLineArgs(optionDefinitions: commandLineArgs.OptionDefinition[], options?: commandLineArgs.ParseOptions): commandLineArgs.CommandLineOptions;
declare module commandLineArgs {
declare namespace commandLineArgs {
interface CommandLineOptions {
/**
* Command-line arguments not parsed by `commandLineArgs`.
*/
_unknown?: string[];
[propName: string]: any;
}
export interface OptionDefinition {
/**
* The only required definition property is name, the value of each option will be either a Boolean or string.
*/
name: string,
/**
* The type value is a setter function (you receive the output from this),
* enabling you to be specific about the type and value received.
*/
type?: (arg: string) => any,
/**
* getopt-style short option names. Can be any single character (unicode included) except a digit or hypen.
*/
alias?: string,
/**
* Set this flag if the option takes a list of values. You will receive an array of values, each passed
* through the type function (if specified).
*/
multiple?: boolean,
/**
* Any unclaimed command-line args will be set on this option. This flag is typically set on
* the most commonly-used option to make for more concise usage
* (i.e. $ myapp *.js instead of $ myapp --files *.js).
*/
defaultOption?: boolean,
/**
* An initial value for the option.
*/
defaultValue?: any,
/**
* When your app has a large amount of options it makes sense to organise them in groups.
* There are two automatic groups: _all (contains all options) and _none (contains options
* without a group specified in their definition).
*/
group?: string | string[],
/**
* Describes the option.
*/
description?: string,
/**
* A label for the type, e.g. <ms>.
*/
typeLabel?: string;
}
interface ParseOptions {
/**
* An array of strings which if present will be parsed instead of `process.argv`.
*/
argv?: string[];
export interface Options {
/**
* An array of strings, which if passed will be parsed instead of `process.argv`.
*/
argv?: string[];
/**
* If `true`, an array of unknown arguments is returned in the `_unknown` property of the output.
*/
partial?: boolean;
}
/**
* If `true`, `commandLineArgs` will not throw on unknown options or values, instead returning them in the `_unknown` property of the output.
*/
partial?: boolean;
/**
* If `true`, `commandLineArgs` will not throw on unknown options or values. Instead, parsing will stop at the first unknown argument
* and the remaining arguments returned in the `_unknown` property of the output. If set, `partial: true` is implied.
*/
stopAtFirstUnknown?: boolean;
/**
* If `true`, options with hypenated names (e.g. `move-to`) will be returned in camel-case (e.g. `moveTo`).
*/
camelCase?: boolean;
}
interface OptionDefinition {
/**
* The long option name.
*/
name: string;
/**
* A setter function (you receive the output from this) enabling you to be specific about the type and value received. Typical values
* are `String` (the default), `Number` and `Boolean` but you can use a custom function. If no option value was set you will receive `null`.
*/
type?: (input: string) => any;
/**
* A getopt-style short option name. Can be any single character except a digit or hyphen.
*/
alias?: string;
/**
* Set this flag if the option accepts multiple values. In the output, you will receive an array of values each passed through the `type` function.
*/
multiple?: boolean;
/**
* Identical to `multiple` but with greedy parsing disabled.
*/
lazyMultiple?: boolean;
/**
* Any values unaccounted for by an option definition will be set on the `defaultOption`. This flag is typically set
* on the most commonly-used option to enable more concise usage.
*/
defaultOption?: boolean;
/**
* An initial value for the option.
*/
defaultValue?: any;
/**
* One or more group names the option belongs to.
*/
group?: string | string[];
}
}
export = commandLineArgs;
-74
View File
@@ -1,79 +1,5 @@
{
"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
}
}
@@ -0,0 +1,21 @@
import commandLineArgs = require('command-line-args');
const optionDefinitions: commandLineArgs.OptionDefinition[] = [
{
name: 'something',
alias: 's',
type: String,
defaultValue: '1',
multiple: true,
defaultOption: true,
group: 'one'
}
];
const options = commandLineArgs(optionDefinitions, {
argv: [ '--one', '1' ],
partial: true
});
const unknown = options._unknown;
const something = options.something;
+73
View File
@@ -0,0 +1,73 @@
// Type definitions for command-line-args 4.0
// Project: https://github.com/75lb/command-line-args
// Definitions by: CzBuCHi <https://github.com/CzBuCHi>, Lloyd Brookes <https://github.com/75lb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/**
* Returns an object containing option values parsed from the command line. By default it parses the global `process.argv` array.
*/
declare function commandLineArgs(optionDefinitions: commandLineArgs.OptionDefinition[], options?: commandLineArgs.ParseOptions): commandLineArgs.CommandLineOptions;
declare namespace commandLineArgs {
interface CommandLineOptions {
/**
* Command-line arguments not parsed by `commandLineArgs`.
*/
_unknown?: string[];
[propName: string]: any;
}
interface ParseOptions {
/**
* An array of strings which if present will be parsed instead of `process.argv`.
*/
argv?: string[];
/**
* If `true`, `commandLineArgs` will not throw on unknown options or values, instead returning them in the `_unknown` property of the output.
*/
partial?: boolean;
}
interface OptionDefinition {
/**
* The long option name.
*/
name: string;
/**
* A setter function (you receive the output from this) enabling you to be specific about the type and value received. Typical values
* are `String` (the default), `Number` and `Boolean` but you can use a custom function. If no option value was set you will receive `null`.
*/
type?: (input: string) => any;
/**
* A getopt-style short option name. Can be any single character except a digit or hyphen.
*/
alias?: string;
/**
* Set this flag if the option accepts multiple values. In the output, you will receive an array of values each passed through the `type` function.
*/
multiple?: boolean;
/**
* Any values unaccounted for by an option definition will be set on the `defaultOption`. This flag is typically set
* on the most commonly-used option to enable more concise usage.
*/
defaultOption?: boolean;
/**
* An initial value for the option.
*/
defaultValue?: any;
/**
* One or more group names the option belongs to.
*/
group?: string | string[];
}
}
export = commandLineArgs;
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"command-line-args": [ "command-line-args/v4" ]
}
},
"files": [
"index.d.ts",
"command-line-args-tests.ts"
]
}
+5
View File
@@ -0,0 +1,5 @@
{
"extends": "dtslint/dt.json",
"rules": {
}
}
+13 -3
View File
@@ -16,6 +16,9 @@ interface Datum {
}
let dispatch: d3Dispatch.Dispatch<HTMLElement>;
let callback: (this: HTMLElement, ...args: any[]) => void;
let callbackOrUndef: ((this: HTMLElement, ...args: any[]) => void) | undefined;
let undef: undefined;
// Signature Tests ----------------------------------------
@@ -33,9 +36,15 @@ function cbFn2(this: SVGElement, d: Datum, i: number) {
}
dispatch.on('foo', cbFn);
// dispatch.on('foo', cbFn2); // test fails as 'this' context type is mismatched between dispatch and callback function
// $ExpectError
dispatch.on('foo', cbFn2); // test fails as 'this' context type is mismatched between dispatch and callback function
dispatch.on('bar', dispatch.on('bar'));
callback = dispatch.on('bar')!;
callbackOrUndef = dispatch.on('bar');
callbackOrUndef = dispatch.on('unknown');
undef = dispatch.on('unknown') as undefined;
dispatch.on('bar', dispatch.on('bar')!);
dispatch.call('foo');
dispatch.call('foo', document.body);
@@ -49,4 +58,5 @@ dispatch.on('bar', null);
// Copy dispatch -----------------------------------------------
const copy: d3Dispatch.Dispatch<HTMLElement> = dispatch.copy();
// const copy2: d3Dispatch.Dispatch<SVGElement> = dispatch.copy(); // test fails type mismatch of underlying event target
// $ExpectError
const copy2: d3Dispatch.Dispatch<SVGElement> = dispatch.copy(); // test fails type mismatch of underlying event target
+60 -4
View File
@@ -1,18 +1,74 @@
// Type definitions for D3JS d3-dispatch module 1.0
// Project: https://github.com/d3/d3-dispatch/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.1
// Last module patch version validated against: 1.0.3
export interface Dispatch<T extends EventTarget> {
/**
* Like `function.apply`, invokes each registered callback for the specified type,
* passing the callback the specified arguments, with `that` as the `this` context.
*
* @param type A specified event type.
* @param that The `this` context for the callback.
* @param args Additional arguments to be passed to the callback.
* @throws "unknown type" on unknown event type.
*/
apply(type: string, that?: T, args?: any[]): void;
call(type: string, that?: T, ...args: any[]): void;
/**
* Like `function.call`, invokes each registered callback for the specified type,
* passing the callback the specified arguments, with `that` as the `this` context.
* See dispatch.apply for more information.
*
* @param type A specified event type.
* @param that The `this` context for the callback.
* @param args Additional arguments to be passed to the callback.
* @throws "unknown type" on unknown event type.
*/
call(type: string, that?: T, ...args: any[]): void;
/**
* Returns a copy of this dispatch object.
* Changes to this dispatch do not affect the returned copy and vice versa.
*/
copy(): Dispatch<T>;
on(typenames: string): (this: T, ...args: any[]) => void;
/**
* Returns the callback for the specified typenames, if any.
* If multiple typenames are specified, the first matching callback is returned.
*
* @param types An event typename.
* @param callback A callback.
*/
on(typenames: string): ((this: T, ...args: any[]) => void) | undefined;
/**
* Removes the callback for the specified typenames.
* To remove all callbacks for a given name `foo`, say `dispatch.on(".foo", null).`
*
* @param types An event typename.
*/
on(typenames: string, callback: null): this;
/**
* Adds the callback for the specified typenames.
* The callback is registered for the specified (fully-qualified) typenames.
* If a callback was already registered for the given typenames,
* the existing callback is removed before the new callback is added.
*
* @param types An event typename.
* @param callback A callback.
*/
on(typenames: string, callback: (this: T, ...args: any[]) => void): this;
}
/**
* Creates a new dispatch for the specified event types. Each type is a string, such as "start" or "end".
*
* @param types The event types.
* @throws "illegal type" on empty string or duplicated event types.
*/
export function dispatch<T extends EventTarget>(...types: string[]): Dispatch<T>;
+1 -1
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
+38 -9
View File
@@ -6,19 +6,23 @@
* are not intended as functional tests.
*/
import { hsv, HSVColor } from 'd3-hsv';
import { rgb, RGBColor } from 'd3-color';
import { hsv, HSVColor, interpolateHsv, interpolateHsvLong } from 'd3-hsv';
import { rgb, hcl, RGBColor } from 'd3-color';
let c: RGBColor;
let cRGB: RGBColor;
let cHSV: HSVColor;
let displayable: boolean;
let cString: string;
let iString: (t: number) => string;
let nil: null;
// Hsv signature
// hsv signature
cHSV = hsv(120, 0.4, 0.5);
cHSV = hsv(120, 0.4, 0.5, 0.5);
// specifier signature
// Specifier signature
cHSV = hsv('rgb(255, 255, 255)');
cHSV = hsv('rgb(10%, 20%, 30%)');
cHSV = hsv('rgba(255, 255, 255, 0.4)');
@@ -28,13 +32,16 @@ cHSV = hsv('hsla(120, 50%, 20%, 0.4)');
cHSV = hsv('#ffeeaa');
cHSV = hsv('#fea');
cHSV = hsv('steelblue');
cHSV = hsv('');
// color signature
c = rgb('steelblue');
cHSV = hsv(c);
// Color signature
cRGB = rgb('steelblue');
cHSV = hsv(cRGB);
cHSV = hsv(cHSV);
// method signatures
// Method signatures
cHSV = cHSV.brighter();
cHSV = cHSV.brighter(0.2);
cHSV = cHSV.darker();
@@ -43,3 +50,25 @@ displayable = cHSV.displayable();
cString = cHSV.toString();
console.log('Channels = (h : %d, s: %d, v: %d)', cHSV.h, cHSV.s, cHSV.v);
console.log('Opacity = %d', cHSV.opacity);
// Interpolater
iString = interpolateHsv('seagreen', 'steelblue');
iString = interpolateHsv(rgb('seagreen'), hcl('steelblue'));
iString = interpolateHsv(rgb('seagreen'), hsv('steelblue'));
iString = interpolateHsvLong('seagreen', 'steelblue');
iString = interpolateHsvLong(rgb('seagreen'), hcl('steelblue'));
iString = interpolateHsvLong(rgb('seagreen'), hsv('steelblue'));
// Prototype, instanceof and typeguard
declare let color: RGBColor | HSVColor | null;
if (color instanceof rgb) {
cRGB = color;
} else if (color instanceof hsv) {
cHSV = color;
} else {
nil = color;
}
+64 -3
View File
@@ -1,28 +1,89 @@
// Type definitions for D3JS d3-hsv module 0.0
// Type definitions for D3JS d3-hsv module 0.1
// Project: https://github.com/d3/d3-hsv/
// Definitions by: Yuri Feldman <https://github.com/arrayjam>
// Definitions by: Yuri Feldman <https://github.com/arrayjam>, denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 0.0.3
// Last module patch version validated against: 0.1.0
import { Color, RGBColor, ColorSpaceObject, ColorCommonInstance } from 'd3-color';
export type ColorSpaceObjectWithHSV = ColorSpaceObject | HSVColor;
export interface HSVColorFactory extends Function {
/**
* Constructs a new HSV color.
* @param h The hue of the returned color.
* @param s The saturation of the returned color.
* @param v The value of the returned color.
* @param opacity The opacity of the returned color.
*/
(h: number, s: number, v: number, opacity?: number): HSVColor;
/**
* Constructs a new HSV color.
* @param cssColorSpecifier A CSS Color Module Level 3 specifier string,
* it is parsed and then converted to the HSV color space.
*/
(cssColorSpecifier: string): HSVColor;
/**
* Constructs a new HSV color.
* @param color A color instance, it will be converted to the RGB color space
* using `color.rgb` and then converted to HSV.
*/
(color: HSVColor | ColorSpaceObject | ColorCommonInstance): HSVColor;
readonly prototype: HSVColor;
}
export interface HSVColor extends Color {
/**
* The color hue.
*/
h: number;
/**
* The color saturation.
*/
s: number;
/**
* The color value.
*/
v: number;
/**
* The color opacity.
*/
opacity: number;
/**
* Returns a brighter copy of this color.
* @param k Controls how much brighter the returned color should be (defaults to 1).
*/
brighter(k?: number): this;
/**
* Returns a darker copy of this color.
* @param k Controls how much darker the returned color should be (defaults to 1).
*/
darker(k?: number): this;
/**
* Returns the RGB equivalent of this color.
*/
rgb(): RGBColor;
}
export const hsv: HSVColorFactory;
/**
* Returns an HSV color space interpolator between the two colors a and b.
* If either color’s hue or chroma is NaN, the opposing color’s channel value is used.
* The shortest path between hues is used. The return value of the interpolator is an RGB string.
* @param a The starting color; it will be converted to HSV using `d3.hsv`.
* @param b The ending color; it will be converted to HSV using `d3.hsv`.
*/
export function interpolateHsv(a: string | ColorCommonInstance, b: string | ColorCommonInstance): (t: number) => string;
/**
* Like `interpolateHsv`, but does not use the shortest path between hues.
* @param a The starting color; it will be converted to HSV using `d3.hsv`.
* @param b The ending color; it will be converted to HSV using `d3.hsv`.
*/
export function interpolateHsvLong(a: string | ColorCommonInstance, b: string | ColorCommonInstance): (t: number) => string;
+1 -1
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
+3
View File
@@ -610,6 +610,7 @@ declare namespace Draft {
import DraftBlockType = Draft.Model.Constants.DraftBlockType;
import DraftEntityMutability = Draft.Model.Constants.DraftEntityMutability;
import DraftEntityType = Draft.Model.Constants.DraftEntityType;
import DraftEntityInstance = Draft.Model.Entity.DraftEntityInstance;
import DraftDecoratorType = Draft.Model.Decorators.DraftDecoratorType;
@@ -754,6 +755,8 @@ declare namespace Draft {
getEntity(key: string): EntityInstance;
getLastCreatedEntityKey(): string;
mergeEntityData(key: string, toMerge: { [key: string]: any }): ContentState;
replaceEntityData(key: string, toMerge: { [key: string]: any }): ContentState;
addEntity(instance: DraftEntityInstance): ContentState;
getBlockMap(): BlockMap;
@@ -1,10 +1,22 @@
import * as elasticsearch from "elasticsearch";
import HttpConnector = require("elasticsearch/src/lib/connectors/http");
class MyHttpConnector extends HttpConnector {
constructor(host: any, config: any) {
super(host, config);
}
}
let client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
});
client = new elasticsearch.Client({
host: 'localhost:9200',
connectionClass: MyHttpConnector
});
client = new elasticsearch.Client({
hosts: [
'box1.server.org',
+3 -1
View File
@@ -12,6 +12,8 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import HttpConnector = require("./src/lib/connectors/http");
export class Client {
constructor(params: ConfigOptions);
cat: Cat;
@@ -111,7 +113,7 @@ export interface ConfigOptions {
keepAlive?: boolean;
maxSockets?: number;
suggestCompression?: boolean;
connectionClass?: string;
connectionClass?: string | typeof HttpConnector;
sniffedNodesProtocol?: string;
ssl?: object;
selector?: any;
+13
View File
@@ -0,0 +1,13 @@
// HttpConnector for elasticsearch
export = HttpConnector;
declare class HttpConnector {
constructor(host: any, config: any);
// onStatusSet(handler: (status: any) => void): void;
createAgent(config: any): any;
makeAgentConfig(config: any): any;
makeReqParams(params: any): any;
request(params: any, callback: (error: any, response: any, status: any, headers: any) => void): void;
}
+1
View File
@@ -29,6 +29,7 @@ program = esprima.parseScript('answer = 42 // TODO: why', { comment: true, range
// Tokenizing
token = esprima.tokenize('code')[0];
token = esprima.tokenize('code', {range: true})[0];
token = esprima.tokenize('/E\/\w*/.exec("e")', { tolerant: true })[0];
// Syntax Delegate
esprima.parseScript('answer = 42', {}, (node) => {
+1
View File
@@ -30,6 +30,7 @@ export interface ParseOptions {
}
export interface TokenizeOptions {
tolerant?: boolean;
range?: boolean;
loc?: boolean;
comment?: boolean;
+26 -6
View File
@@ -1,7 +1,27 @@
import Evaporate = require("evaporate");
import Evaporate = require('evaporate');
function test_upload() {
var evaporate = new Evaporate({});
var uploadId = evaporate.add({});
evaporate.cancel(uploadId);
}
const newEvaporate = new Evaporate({
bucket: 'abc',
});
Evaporate.create({
bucket: 'abc',
})
.then((evaporate) => {
evaporate.add({
name: 'gwejlf',
file: new File(['abcd'], 'efg'),
started: (file_key) => {
evaporate.pause(file_key);
},
paused: (file_key) => {
evaporate.resume(file_key);
},
resumed: (file_key) => {
evaporate.cancel(file_key);
}
})
.then((awsS3ObjectKey) => {
console.log(awsS3ObjectKey + '!!!');
});
});
+105 -5
View File
@@ -1,12 +1,112 @@
// Type definitions for EvaporateJS
// Type definitions for EvaporateJS 2.1
// Project: https://github.com/TTLabs/EvaporateJS
// Definitions by: Andrew Kuklewicz <https://github.com/kookster>, Chris Rhoden <https://github.com/chrisrhoden>
// Definitions by: Andrew Kuklewicz <https://github.com/kookster>
// Chris Rhoden <https://github.com/chrisrhoden>
// Junyoung Clare Jang <https://github.com/ailrun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
export = Evaporate;
declare class Evaporate {
cancel(id:string): boolean;
constructor(config:any);
add(config:any): string;
constructor(config: Evaporate.CreateConfig);
supported: boolean;
add(config: Evaporate.AddConfig, options?: Evaporate.AddOverrideOptions): Promise<string>;
pause(file_key?: string, options?: object): Promise<undefined[]>;
resume(file_key?: string): Promise<undefined[]>;
cancel(file_key?: string): Promise<undefined[]>;
}
declare namespace Evaporate {
function create(config: CreateConfig): Promise<Evaporate>;
interface CreateConfig {
readableStreams?: boolean;
readableStreamPartMethod?: null | ((file: File, start: number, end: number) => ReadableStream);
bucket: string;
logging?: boolean;
maxConcurrentParts?: number;
partSize?: number;
retryBackoffPower?: number;
maxRetryBackoffSecs?: number;
progressIntervalMS?: number;
cloudfront?: boolean;
s3Acceleration?: boolean;
mockLocalStorage?: boolean;
encodeFilename?: boolean;
computeContentMd5?: false;
allowS3ExistenceOptimization?: boolean;
onlyRetryForSameFileName?: boolean;
timeUrl?: string;
cryptoMd5Method?: null | ((data: ArrayBuffer) => string);
cryptoHexEncodedHash256?: null | ((data: ArrayBuffer) => string);
aws_url?: string;
aws_key?: string;
awsRegion?: string;
awsSignatureVersion?: '2' | '4';
signerUrl?: string;
sendCanonicalRequestToSignerUrl?: boolean;
s3FileCacheHoursAgo?: null | number;
signParams?: object;
signHeaders?: object;
customAuthMethod?: null | ((
signParams: string,
signHeaders: string,
stringToSign: () => string | undefined,
signatureDateTime: string,
canonicalRequest: string
) => Promise<string>);
maxFileSize?: number;
signResponseHandler?: null | ((response: any, stringToSign: string, signatureDateTime: string) => Promise<string>);
xhrWithCredentials?: boolean;
localTimeOffset?: number;
evaporateChanged?: (evaporate: Evaporate, evaporatingCount: number) => void;
abortCompletionThrottlingMs?: number;
}
interface TransferStats {
speed: number;
readableSpeed: string;
loaded: number;
totalUploaded: number;
remainingSize: number;
secondsLeft: number;
fileSize: number;
}
interface AddConfig {
name: string;
file: File;
xAmzHeadersAtInitiate?: { [key: string]: string };
notSignedHeadersAtInitiate?: { [key: string]: string };
xAmzHeadersAtUpload?: { [key: string]: string };
xAmzHeadersAtComplete?: { [key: string]: string };
xAmzHeadersCommon?: { [key: string]: string };
started?: (file_key: string) => void;
uploadInitiated?: (s3UploadId?: string) => void;
paused?: (file_key: string) => void;
resumed?: (file_key: string) => void;
pausing?: (file_key: string) => void;
cancelled?: () => void;
complete?: (xhr: XMLHttpRequest, awsObjectKey: string, stats: TransferStats) => void;
nameChanged?: (awsObjectKey: string) => void;
info?: (msg: string) => void;
warn?: (msg: string) => void;
error?: (msg: string) => void;
progress?: (p: number, stats: TransferStats) => void;
contentType?: string;
beforeSigner?: (xhr: XMLHttpRequest, url: string) => void;
}
type ImmutableOptionKeys =
| 'maxConcurrentParts' | 'logging' | 'cloudfront' | 'encodeFilename'
| 'computeContentMd5' | 'allowS3ExistenceOptimization' | 'onlyRetryForSameFileName'
| 'timeUrl' | 'cryptoMd5Method' | 'cryptoHexEncodedHash256' | 'awsRegion' | 'awsSignatureVersion'
| 'evaporateChanged';
type AddOverrideOptionKeys = Exclude<keyof CreateConfig, ImmutableOptionKeys>;
interface AddOverrideOptions extends Pick<CreateConfig, AddOverrideOptionKeys> {}
interface PauseConfig {
force?: boolean;
}
}
+9 -8
View File
@@ -1,23 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"baseUrl": "../",
"forceConsistentCasingInFileNames": true,
"lib": [
"es6"
"es6",
"dom"
],
"module": "commonjs",
"noEmit": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
"types": []
},
"files": [
"index.d.ts",
"evaporate-tests.ts"
]
}
}
+1 -77
View File
@@ -1,79 +1,3 @@
{
"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"
}
+2
View File
@@ -600,6 +600,8 @@ Permissions.CONTACTS === 'contacts';
Permissions.NOTIFICATIONS === 'remoteNotifications';
Permissions.REMOTE_NOTIFICATIONS === 'remoteNotifications';
Permissions.SYSTEM_BRIGHTNESS === 'systemBrightness';
Permissions.USER_FACING_NOTIFICATIONS === 'userFacingNotifications';
Permissions.REMINDERS === 'reminders';
async () => {
const result = await Permissions.askAsync(Permissions.CAMERA);
+12 -9
View File
@@ -1778,8 +1778,9 @@ export namespace Pedometer {
* Permissions
*/
export namespace Permissions {
type PermissionType = 'remoteNotifications' | 'location' |
'camera' | 'contacts' | 'audioRecording' | 'calendar';
type PermissionType = 'audioRecording' | 'calendar' |
'cameraRoll' | 'camera' | 'contacts' | 'location' | 'reminders' |
'remoteNotifications' | 'systemBrightness' | 'userFacingNotifications';
type PermissionStatus = 'undetermined' | 'granted' | 'denied';
type PermissionExpires = 'never';
@@ -1803,15 +1804,17 @@ export namespace Permissions {
type RemoteNotificationPermission = 'remoteNotifications';
const CAMERA: 'camera';
const CAMERA_ROLL: 'cameraRoll';
const AUDIO_RECORDING: 'audioRecording';
const LOCATION: 'location';
const REMOTE_NOTIFICATIONS: RemoteNotificationPermission;
const NOTIFICATIONS: RemoteNotificationPermission;
const CONTACTS: 'contacts';
const SYSTEM_BRIGHTNESS: 'systemBrightness';
const CALENDAR: 'calendar';
const CAMERA_ROLL: 'cameraRoll';
const CAMERA: 'camera';
const CONTACTS: 'contacts';
const LOCATION: 'location';
const NOTIFICATIONS: RemoteNotificationPermission;
const REMINDERS = 'reminders';
const REMOTE_NOTIFICATIONS: RemoteNotificationPermission;
const SYSTEM_BRIGHTNESS: 'systemBrightness';
const USER_FACING_NOTIFICATIONS = 'userFacingNotifications';
}
/**
@@ -0,0 +1,71 @@
import {
JsonSchemaCustomPropertyError,
JsonSchemaValidation,
addSchemaProperties,
validate,
} from "express-jsonschema";
import { Request, Response, NextFunction } from "express";
import { JSONSchema4 } from "json-schema";
let jsonSchema: JSONSchema4;
let expressMiddleware: (req: Request, res: Response, next: NextFunction) => void;
jsonSchema = {
id: 'foo',
$ref: 'foo/bar',
$schema: 'http://json-schema.org/schema#',
title: 'foo',
description: 'bar',
default: 42,
multipleOf: 3,
maximum: 4,
exclusiveMaximum: true,
minimum: 5,
exclusiveMinimum: false,
maxLength: 6,
minLength: 7,
pattern: 'baz',
additionalItems: true,
items: [
{ items: [{ minLength: 4 }] }
],
maxItems: 4,
minItems: 5,
uniqueItems: true,
maxProperties: 10,
minProperties: 11,
required: ['foo', 'bar'],
additionalProperties: false,
definitions: {
foo: { type: 'string' }
},
properties: {
bar: { type: 'boolean' }
},
patternProperties: {
foo: { type: 'integer' }
},
dependencies: {
baz: { type: 'integer' }
},
enum: ['foo', 42],
type: 'string',
allOf: [{}],
anyOf: [{}],
oneOf: [{}],
not: {},
extends: 'foo',
bar: 4,
format: 'date-time',
};
expressMiddleware = validate({ test: jsonSchema }, [ jsonSchema ]);
addSchemaProperties({
test: () => "This is an error with message...",
conditional: (instance: any, schema: JSONSchema4) => {
if (!instance) {
return "An instance should be present";
}
}
});
+54
View File
@@ -0,0 +1,54 @@
// Type definitions for express-jsonschema 1.1
// Project: https://github.com/trainiac/express-jsonschema#readme
// Definitions by: Arne Schubert <https://github.com/atd-schubert>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Request, Response, NextFunction } from "express";
import { JSONSchema4 } from "json-schema";
export class JsonSchemaCustomPropertyError {
name: string;
message: string;
constructor(propertyName: string);
}
export class JsonSchemaValidation {
name: string;
message: string;
validations: {[requestProperty: string]: Array<{ value: any, property: string, messages: string[]}> };
constructor(validations: { [requestProperty: string]: { instance: any, property: string, message: string }});
}
/**
* Updates customProperties with the newProperties param. Provides a way for client to extend JSON Schema validations.
*
* @param newProperties - An object where the keys are the
* names of the new schema properties and the values are the respective
* functions that implement the validation.
* @throws Client tries to override an existing JSON Schema property.
*/
export function addSchemaProperties(newProperties: { [attribute: string]: (instance: any, schema: JSONSchema4, options: any, ctx: any) => void | string }): void;
/**
* Accepts an object where the keys are request properties and the
* values are their respective schemas. Optionally, you may provide
* dependency schemas that are referenced by your schemas using `$ref`
* (see https://www.npmjs.com/package/jsonschema#complex-example-with-split-schemas-and-references
* for more details).
* Returns a middleware function that validates the given
* request properties when a request is made. If there is any invalid
* data a JsonSchemaValidation instance is passed to the next middleware.
* If the data is valid the next middleware is called with no params.
*
* @param schemas - An object where the keys are request properties
* and the values are their respective schemas.
* @param schemaDependencies - A list of schemas on which
* schemas in `schemas` parameter are dependent. These will be added
* to the `jsonschema` validator.
* @returns A middleware function.
*/
export function validate(
schemas: { [requestProperty: string]: JSONSchema4 },
schemaDependencies?: JSONSchema4[],
): (req: Request, res: Response, next: NextFunction) => void;
+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",
"express-jsonschema-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,7 @@
import express = require('express');
import displayRoutes = require('express-routemap');
const server = express();
server.listen(3000, () => {
displayRoutes(server); // $ExpectType void
});
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for express-routemap 1.1
// Project: https://github.com/izelnakri/express-routemap#readme
// Definitions by: icopp <https://github.com/icopp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Application } from 'express';
declare function displayRoutes(app: Application, filename?: string): void;
export = displayRoutes;
+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",
"express-routemap-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,7 @@
import * as feather from "feather-icons";
feather.replace(); // $ExpectType void
feather.icons[""].toSvg(); // $ExpectType string
feather.icons[""].name; // $ExpectType string
feather.icons[""].contents; // $ExpectType string
feather.icons[""].tags; // $ExpectType string[]
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for feather-icons 4.7
// Project: https://github.com/feathericons/feather#readme
// Definitions by: Jinesh Shah <https://github.com/jineshshah36>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace feather;
export interface FeatherAttributes {
[key: string]: string | number;
}
export function replace(options?: FeatherAttributes): void;
export const icons: {
[key: string]: {
name: string;
contents: string;
tags: string[];
attrs: FeatherAttributes;
toSvg: (options?: FeatherAttributes) => string;
};
};
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": ["index.d.ts", "feather-icons-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -4,7 +4,7 @@
var flowObject: flowjs.IFlow;
var bool: boolean = flowObject.support;
bool = flowObject.supportDirectory;
var obj: Object = flowObject.opts;
var flowOpts: flowjs.IFlowOptions = flowObject.opts;
var flowFileArray: flowjs.IFlowFile[] = flowObject.files;
flowObject.assignBrowse(<HTMLElement[]> [], false, false, {});
+1 -1
View File
@@ -7,7 +7,7 @@ declare namespace flowjs {
interface IFlow {
support: boolean;
supportDirectory: boolean;
opts: Object;
opts: IFlowOptions;
files: IFlowFile[];
assignBrowse(domNodes: HTMLElement[], isDirectory: boolean, singleFile: boolean, attributes: Object): void;
@@ -0,0 +1,24 @@
import { Configuration } from 'webpack';
import * as ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
let config: Configuration = {
plugins: [
new ForkTsCheckerWebpackPlugin()
]
};
config = {
plugins: [
new ForkTsCheckerWebpackPlugin({})
]
};
config = {
plugins: [
new ForkTsCheckerWebpackPlugin({
vue: true
})
]
};
export default config;
+104
View File
@@ -0,0 +1,104 @@
// Type definitions for fork-ts-checker-webpack-plugin 0.4
// Project: https://github.com/Realytics/fork-ts-checker-webpack-plugin#readme
// Definitions by: JounQin <https://github.com/JounQin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
import { RuleFailure } from 'tslint';
import { Diagnostic } from 'typescript';
import { Plugin } from 'webpack';
declare namespace ForkTsCheckerWebpackPlugin {
type ErrorType = 'diagnostic' | 'lint';
type Severity = 'error' | 'warning';
interface NormalizedMessageJson {
type: ErrorType;
code: string | number;
severity: Severity;
content: string;
file: string;
line: number;
character: number;
}
class NormalizedMessage {
static TYPE_DIAGNOSTIC: ErrorType;
static TYPE_LINT: ErrorType;
static SEVERITY_ERROR: Severity;
static SEVERITY_WARNING: Severity;
type: ErrorType;
code: string | number;
severity: Severity;
content: string;
file: string;
line: number;
character: number;
constructor(data: NormalizedMessageJson);
static createFromDiagnostic(diagnostic: Diagnostic): NormalizedMessage;
static createFromLint(lint: RuleFailure): NormalizedMessage;
static createFromJSON(json: NormalizedMessageJson): NormalizedMessage;
static compare(
messageA: NormalizedMessage,
messageB: NormalizedMessage,
): number;
static equals(
messageA: NormalizedMessage,
messageB: NormalizedMessage,
): boolean;
static deduplicate(messages: NormalizedMessage[]): NormalizedMessage[];
static compareTypes(typeA: ErrorType, typeB: ErrorType): number;
static compareSeverities(
severityA: Severity,
severityB: Severity,
): number;
static compareOptionalStrings(stringA: string, stringB: string): number;
static compareNumbers(numberA: number, numberB: number): number;
toJSON(): NormalizedMessageJson;
getType(): ErrorType;
isDiagnosticType(): boolean;
isLintType(): boolean;
getCode(): string | number;
getFormattedCode(): string | number;
getSeverity(): Severity;
isErrorSeverity(): boolean;
isWarningSeverity(): boolean;
getContent(): string;
getFile(): string;
getLine(): number;
getCharacter(): number;
}
type Formatter = (message: NormalizedMessage, useColors: boolean) => string;
interface Options {
tsconfig?: string;
tslint?: string | true;
watch?: string | string[];
async?: boolean;
ignoreDiagnostics?: number[];
ignoreLints?: string[];
colors?: boolean;
logger?: Console;
formatter?: 'default' | 'codeframe' | Formatter;
formatterOptions?: {
highlightCode?: boolean
linesAbove?: number
linesBelow?: number
forceColor?: boolean
};
silent?: boolean;
checkSyntacticErrors?: boolean;
memoryLimit?: number;
workers?: number;
vue?: boolean;
}
}
declare class ForkTsCheckerWebpackPlugin extends Plugin {
constructor(options?: ForkTsCheckerWebpackPlugin.Options);
}
export = ForkTsCheckerWebpackPlugin;
@@ -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",
"fork-ts-checker-webpack-plugin-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -14,7 +14,7 @@ declare const dir: string;
declare const path: string;
declare const data: any;
declare const object: any;
let buffer: NodeBuffer;
let buffer: Buffer;
declare const modeNum: number;
declare const modeStr: string;
declare const encoding: string;
@@ -148,19 +148,19 @@ fs.futimes(fd, atime, mtime, errorCallback);
fs.futimesSync(fd, atime, mtime);
fs.fsync(fd, errorCallback);
fs.fsyncSync(fd);
fs.write(fd, buffer, offset, length, position, (err: Error, written: number, buffer: NodeBuffer) => {
fs.write(fd, buffer, offset, length, position, (err: Error, written: number, buffer: Buffer) => {
});
num = fs.writeSync(fd, buffer, offset, length, position);
fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: NodeBuffer) => {
fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: Buffer) => {
});
num = fs.readSync(fd, buffer, offset, length, position);
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
fs.readFile(filename, (err: Error, data: Buffer) => {
});
fs.readFile(filename, encoding, (err: Error, data: string) => {
});
fs.readFile(filename, openOpts, (err: Error, data: string) => {
});
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
fs.readFile(filename, (err: Error, data: Buffer) => {
});
buffer = fs.readFileSync(filename);
str = fs.readFileSync(filename, encoding);
+9 -9
View File
@@ -113,13 +113,13 @@ export function futimes(fd: number, atime: number, mtime: number, callback?: (er
export function futimesSync(fd: number, atime: number, mtime: number): void;
export function fsync(fd: number, callback?: (err: Error) => void): void;
export function fsyncSync(fd: number): void;
export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void;
export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void;
export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: Buffer) => void): void;
export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: Buffer) => void): void;
export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number;
export function readFile(filename: string, options: OpenOptions | string, callback: (err: Error, data: string) => void): void;
export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void): void;
export function readFileSync(filename: string): NodeBuffer;
export function readFile(filename: string, callback: (err: Error, data: Buffer) => void): void;
export function readFileSync(filename: string): Buffer;
export function readFileSync(filename: string, options: OpenOptions | string): string;
export function writeFile(filename: string, data: any, callback?: (err: Error) => void): void;
export function writeFile(filename: string, data: any, options: OpenOptions | string, callback?: (err: Error) => void): void;
@@ -201,10 +201,10 @@ export function openAsync(path: string, flags: string, mode?: string): Promise<n
export function utimesAsync(path: string, atime: number, mtime: number): Promise<void>;
export function futimesAsync(fd: number, atime: number, mtime: number): Promise<void>;
export function fsyncAsync(fd: number): Promise<void>;
export function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export function writeAsync(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>;
export function readAsync(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>;
export function readFileAsync(filename: string, options: OpenOptions | string): Promise<string>;
export function readFileAsync(filename: string): Promise<NodeBuffer>;
export function readFileAsync(filename: string): Promise<Buffer>;
export function writeFileAsync(filename: string, data: any, options?: OpenOptions | string): Promise<void>;
export function appendFileAsync(filename: string, data: any, option?: OpenOptions | string): Promise<void>;
@@ -16,7 +16,7 @@ declare const data: any;
declare const object: object;
declare const buf: Buffer;
let strOrBuf: string | Buffer;
let buffer: NodeBuffer;
let buffer: Buffer;
declare const modeNum: number;
declare const modeStr: string;
declare const encoding: string;
@@ -148,19 +148,19 @@ fs.futimes(fd, atime, mtime, errorCallback);
fs.futimesSync(fd, atime, mtime);
fs.fsync(fd, errorCallback);
fs.fsyncSync(fd);
fs.write(fd, buffer, offset, length, position, (err: Error, written: number, buffer: NodeBuffer) => {
fs.write(fd, buffer, offset, length, position, (err: Error, written: number, buffer: Buffer) => {
});
num = fs.writeSync(fd, buffer, offset, length, position);
fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: NodeBuffer) => {
fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: Buffer) => {
});
num = fs.readSync(fd, buffer, offset, length, position);
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
fs.readFile(filename, (err: Error, data: Buffer) => {
});
fs.readFile(filename, encoding, (err: Error, data: string) => {
});
fs.readFile(filename, openOpts, (err: NodeJS.ErrnoException, data: Buffer) => {
});
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
fs.readFile(filename, (err: Error, data: Buffer) => {
});
buffer = fs.readFileSync(filename);
str = fs.readFileSync(filename, encoding);
+3 -3
View File
@@ -65,10 +65,10 @@ export function openAsync(path: string, flags: string, mode?: string): Promise<n
export function utimesAsync(path: string, atime: number, mtime: number): Promise<void>;
export function futimesAsync(fd: number, atime: number, mtime: number): Promise<void>;
export function fsyncAsync(fd: number): Promise<void>;
export function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export function writeAsync(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>;
export function readAsync(fd: number, buffer: Buffer, offset: number, length: number, position: number): Promise<[number, Buffer]>;
export function readFileAsync(filename: string, options: string | ReadOptions): Promise<string>;
export function readFileAsync(filename: string): Promise<NodeBuffer>;
export function readFileAsync(filename: string): Promise<Buffer>;
export function writeFileAsync(filename: string, data: any, options?: string | WriteOptions): Promise<void>;
export function appendFileAsync(filename: string, data: any, option?: string | WriteOptions): Promise<void>;
+3 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for Google Apps Script 2017-05-12
// Type definitions for Google Apps Script 2018-05-03
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// linlex <https://github.com/linlex/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
@@ -24,6 +25,7 @@ declare namespace GoogleAppsScript {
deleteCalendar(): void;
getColor(): string;
getDescription(): string;
getEventById(iCalId: string): CalendarEvent;
getEventSeriesById(iCalId: string): CalendarEventSeries;
getEvents(startTime: Date, endTime: Date): CalendarEvent[];
getEvents(startTime: Date, endTime: Date, options: Object): CalendarEvent[];
+401 -7
View File
@@ -1,6 +1,7 @@
// Type definitions for Google Apps Script 2017-05-12
// Type definitions for Google Apps Script 2018-05-03
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// linlex <https://github.com/linlex/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
@@ -11,7 +12,7 @@
declare namespace GoogleAppsScript {
/**
* This service allows scripts to create, access, and modify Google Sheets files. See also the guide to storing data in spreadsheets.
*
*
* https://developers.google.com/apps-script/guides/sheets
*/
export module Spreadsheet {
@@ -858,6 +859,7 @@ declare namespace GoogleAppsScript {
autoResizeColumn(columnPosition: Integer): Sheet;
clear(): Sheet;
clear(options: Object): Sheet;
clearConditionalFormatRules(): void;
clearContents(): Sheet;
clearFormats(): Sheet;
clearNotes(): Sheet;
@@ -870,6 +872,7 @@ declare namespace GoogleAppsScript {
getActiveRange(): Range;
getCharts(): EmbeddedChart[];
getColumnWidth(columnPosition: Integer): Integer;
getConditionalFormatRules(): ConditionalFormatRule[];
getDataRange(): Range;
getFrozenColumns(): Integer;
getFrozenRows(): Integer;
@@ -923,6 +926,8 @@ declare namespace GoogleAppsScript {
setActiveSelection(range: Range): Range;
setActiveSelection(a1Notation: string): Range;
setColumnWidth(columnPosition: Integer, width: Integer): Sheet;
setConditionalFormatRules(rules: ReadonlyArray<ConditionalFormatRule>): void;
setCurrentCell(cell: Range): void;
setFrozenColumns(columns: Integer): void;
setFrozenRows(rows: Integer): void;
setName(name: string): Sheet;
@@ -1066,6 +1071,14 @@ declare namespace GoogleAppsScript {
* An enumeration representing the data-validation criteria that can be set on a range.
*/
DataValidationCriteria: typeof DataValidationCriteria;
/**
* An enumeration representing the interpolation options for calculating a value to be used in a GradientCondition in a ConditionalFormatRule.
*/
InterpolationType: typeof InterpolationType;
/**
* An enumeration representing the boolean criteria that can be used in conditional format or filter.
*/
BooleanCriteria: typeof BooleanCriteria;
/**
* An enumeration representing the parts of a spreadsheet that can be protected from edits.
*/
@@ -1111,27 +1124,408 @@ declare namespace GoogleAppsScript {
*/
open(file: Drive.File): Spreadsheet;
/**
* Opens the spreadsheet with the given ID.
* Opens the spreadsheet with the given ID.
*/
openById(id: string): Spreadsheet;
/**
* Opens the spreadsheet with the given url.
* Opens the spreadsheet with the given url.
*/
openByUrl(url: string): Spreadsheet;
/**
* Sets the active range for the application.
* Sets the active range for the application.
*/
setActiveRange(range: Range): Range;
/**
* Sets the active sheet in a spreadsheet.
* Sets the active sheet in a spreadsheet.
*/
setActiveSheet(sheet: Sheet): Sheet;
/**
* Sets the active spreadsheet.
* Sets the active spreadsheet.
*/
setActiveSpreadsheet(newActiveSpreadsheet: Spreadsheet): void;
/**
* Creates a builder for a conditional formatting rule.
*/
newConditionalFormatRule(): ConditionalFormatRuleBuilder;
}
/**
* Access conditional formatting rules. To create a new rule, use SpreadsheetApp.newConditionalFormatRule() and
* ConditionalFormatRuleBuilder. You can use Sheet.setConditionalFormatRules(rules) to set the rules for a given
* sheet.
*/
export interface ConditionalFormatRule {
/**
* Returns a rule builder preset with this rule's settings.
*/
copy(): ConditionalFormatRuleBuilder;
/**
* Retrieves the rule's BooleanCondition information if this rule uses boolean condition criteria.
*/
getBooleanCondition(): BooleanCondition;
/**
* Retrieves the rule's GradientCondition information, if this rule uses gradient condition criteria.
*/
getGradientCondition(): GradientCondition;
/**
* Retrieves the ranges to which this conditional format rule is applied.
*/
getRanges(): Range[];
}
/**
* Builder for conditional format rules.
*/
export interface ConditionalFormatRuleBuilder {
/**
* Constructs a conditional format rule from the settings applied to the builder.
*/
build(): ConditionalFormatRule;
/**
* Returns a rule builder preset with this rule's settings.
*/
copy(): ConditionalFormatRuleBuilder;
/**
* Retrieves the rule's BooleanCondition information if this rule uses boolean condition criteria.
*/
getBooleanCondition(): BooleanCondition;
/**
* Retrieves the rule's GradientCondition information, if this rule uses gradient condition criteria.
*/
getGradientCondition(): GradientCondition;
/**
* Retrieves the ranges to which this conditional format rule is applied.
*/
getRanges(): Range[];
/**
* Sets the background color for the conditional format rule's format.
*/
setBackground(color: string): ConditionalFormatRuleBuilder;
/**
* Sets text bolding for the conditional format rule's format.
*/
setBold(bold: boolean): ConditionalFormatRuleBuilder;
/**
* Sets the font color for the conditional format rule's format.
*/
setFontColor(color: string): ConditionalFormatRuleBuilder;
/**
* Clears the conditional format rule's gradient maxpoint value, and instead uses the maximum value in the rule's ranges.
*/
setGradientMaxpoint(color: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule's gradient maxpoint fields.
*/
setGradientMaxpointWithValue(color: string, type: InterpolationType, value: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule's gradient midpoint fields.
*/
setGradientMidpointWithValue(color: string, type: InterpolationType, value: string): ConditionalFormatRuleBuilder;
/**
* Clears the conditional format rule's gradient minpoint value, and instead uses the minimum value in the rule's ranges.
*/
setGradientMinpoint(color: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule's gradient minpoint fields.
*/
setGradientMinpointWithValue(color: string, type: SpreadsheetApp.InterpolationType, value: string): ConditionalFormatRuleBuilder;
/**
* Sets text italics for the conditional format rule's format.
*/
setItalic(italic: boolean): ConditionalFormatRuleBuilder;
/**
* Sets one or more ranges to which this conditional format rule is applied.
*/
setRanges(ranges: ReadonlyArray<Range>): ConditionalFormatRuleBuilder;
/**
* Sets text strikethrough for the conditional format rule's format.
*/
setStrikethrough(strikethrough: boolean): ConditionalFormatRuleBuilder;
/**
* Sets text underlining for the conditional format rule's format.
*/
setUnderline(underline: boolean): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when the cell is empty.
*/
whenCellEmpty(): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when the cell is not empty.
*/
whenCellNotEmpty(): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a date is after the given value.
*/
whenDateAfter(date: Date): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a date is after the given relative date.
*/
whenDateAfter(date: Date): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a date is before the given date.
*/
whenDateBefore(date: Date): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a date is before the given relative date.
*/
whenDateBefore(date: Date): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a date is equal to the given date.
*/
whenDateEqualTo(date: Date): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a date is equal to the given relative date.
*/
whenDateEqualTo(date: Date): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when that the given formula evaluates to true.
*/
whenFormulaSatisfied(formula: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.
*/
whenNumberBetween(start: number, end: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number is equal to the given value.
*/
whenNumberEqualTo(number: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number is greater than the given value.
*/
whenNumberGreaterThan(number: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number is greater than or equal to the given value.
*/
whenNumberGreaterThanOrEqualTo(number: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional conditional format rule to trigger when a number less than the given value.
*/
whenNumberLessThan(number: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number less than or equal to the given value.
*/
whenNumberLessThanOrEqualTo(number: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.
*/
whenNumberNotBetween(start: number, end: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when a number is not equal to the given value.
*/
whenNumberNotEqualTo(number: number): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when that the input contains the given value.
*/
whenTextContains(text: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when that the input does not contain the given value.
*/
whenTextDoesNotContain(text: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when that the input ends with the given value.
*/
whenTextEndsWith(text: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when that the input is equal to the given value.
*/
whenTextEqualTo(text: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to trigger when that the input starts with the given value.
*/
whenTextStartsWith(text: string): ConditionalFormatRuleBuilder;
/**
* Sets the conditional format rule to criteria defined by BooleanCriteria values, typically taken from the criteria and arguments of an existing rule.
*/
withCriteria(criteria: BooleanCriteria, args: ReadonlyArray<number|string|Date>): ConditionalFormatRuleBuilder;
}
/**
* An enumeration representing the boolean criteria that can be used in conditional format or filter.
*/
export enum BooleanCriteria {
/**
* The criteria is met when a cell is empty.
*/
CELL_EMPTY,
/**
* The criteria is met when a cell is not empty.
*/
CELL_NOT_EMPTY,
/**
* The criteria is met when a date is after the given value.
*/
DATE_AFTER,
/**
* The criteria is met when a date is before the given value.
*/
DATE_BEFORE,
/**
* The criteria is met when a date is equal to the given value.
*/
DATE_EQUAL_TO,
/**
* The criteria is met when a date is after the relative date value.
*/
DATE_AFTER_RELATIVE,
/**
* The criteria is met when a date is before the relative date value.
*/
DATE_BEFORE_RELATIVE,
/**
* The criteria is met when a date is equal to the relative date value.
*/
DATE_EQUAL_TO_RELATIVE,
/**
* The criteria is met when a number that is between the given values.
*/
NUMBER_BETWEEN,
/**
* The criteria is met when a number that is equal to the given value.
*/
NUMBER_EQUAL_TO,
/**
* The criteria is met when a number that is greater than the given value.
*/
NUMBER_GREATER_THAN,
/**
* The criteria is met when a number that is greater than or equal to the given value.
*/
NUMBER_GREATER_THAN_OR_EQUAL_TO,
/**
* The criteria is met when a number that is less than the given value.
*/
NUMBER_LESS_THAN,
/**
* The criteria is met when a number that is less than or equal to the given value.
*/
NUMBER_LESS_THAN_OR_EQUAL_TO,
/**
* The criteria is met when a number that is not between the given values.
*/
NUMBER_NOT_BETWEEN,
/**
* The criteria is met when a number that is not equal to the given value.
*/
NUMBER_NOT_EQUAL_TO,
/**
* The criteria is met when the input contains the given value.
*/
TEXT_CONTAINS,
/**
* The criteria is met when the input does not contain the given value.
*/
TEXT_DOES_NOT_CONTAIN,
/**
* The criteria is met when the input is equal to the given value.
*/
TEXT_EQUAL_TO,
/**
* The criteria is met when the input begins with the given value.
*/
TEXT_STARTS_WITH,
/**
* The criteria is met when the input ends with the given value.
*/
TEXT_ENDS_WITH,
/**
* The criteria is met when the input makes the given formula evaluate to true.
*/
CUSTOM_FORMULA
}
/**
* An enumeration representing the interpolation options for calculating a value to be used in a GradientCondition in a ConditionalFormatRule.
*/
export enum InterpolationType {
/**
* Use the number as as specific interpolation point for a gradient condition.
*/
NUMBER,
/**
* Use the number as a percentage interpolation point for a gradient condition.
*/
PERCENT,
/**
* Use the number as a percentile interpolation point for a gradient condition.
*/
PERCENTILE,
/**
* Infer the minimum number as a specific interpolation point for a gradient condition.
*/
MIN,
/**
* Infer the maximum number as a specific interpolation point for a gradient condition.
*/
MAX
}
}
}
+11 -1
View File
@@ -1,10 +1,12 @@
import got = require('got');
import cookie = require('cookie');
import FormData = require('form-data');
import Keyv = require('keyv');
import * as fs from 'fs';
import * as http from 'http';
import * as https from 'https';
import * as url from 'url';
import QuickLRU = require('quick-lru');
let str: string;
let buf: Buffer;
@@ -242,7 +244,15 @@ got('todomvc', {
});
got('todomvc', {
cache: new Map()
cache: new Map(),
}).then(res => res.fromCache);
got('todomvc', {
cache: new Keyv(),
}).then(res => res.fromCache);
got('todomvc', {
cache: new QuickLRU(),
}).then(res => res.fromCache);
got(new url.URL('http://todomvc.com'));
+7 -1
View File
@@ -119,7 +119,7 @@ declare namespace got {
followRedirect?: boolean;
decompress?: boolean;
useElectronNet?: boolean;
cache?: Map<string, any>;
cache?: Cache;
agent?: http.Agent | boolean | AgentOptions;
throwHttpErrors?: boolean;
}
@@ -137,6 +137,12 @@ declare namespace got {
type RetryFunction = (retry: number, error: any) => number;
interface Cache {
set(key: string, value: any, ttl?: number): any;
get(key: string): any;
delete(key: string): any;
}
interface Response<B extends Buffer | string | object> extends http.IncomingMessage {
body: B;
url: string;
+1 -1
View File
@@ -544,7 +544,7 @@ export interface Request extends Podium {
* @return void
* [See docs](https://hapijs.com/api/17.0.1#-requestseturlurl-striptrailingslash)
*/
setUrl(url: string | url.URL, stripTrailingSlash?: boolean): void;
setUrl(url: string | url.Url, stripTrailingSlash?: boolean): void;
}
/* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+8
View File
@@ -24,3 +24,11 @@ proxy.on("start", (req, res, target) => {
http.createServer((req, res) => {
proxy.web(req, res);
});
const newProxy = HttpProxy.createProxyServer({
target: {
host: 'localhost',
port: '9015'
},
ws: true
});

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