Merge branch 'master' into react-default-type-arguments

This commit is contained in:
Tanguy Krotoff
2017-06-20 22:39:06 +02:00
committed by GitHub
152 changed files with 5534 additions and 2857 deletions

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/squaremo/amqp.node
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>, Nicolás Fantone <https://github.com/nfantone>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />

View File

@@ -367,8 +367,7 @@ namespace TestQ {
let result: angular.IPromise<TResult>;
result = $q.resolve<TResult>(tResult);
result = $q.resolve<TResult>(promiseTResult);
result = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
result = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther);
let result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
}
// $q.when
@@ -378,7 +377,8 @@ namespace TestQ {
}
{
let result: angular.IPromise<TResult>;
let resultOther: angular.IPromise<TOther>;
let other: angular.IPromise<TOther>;
let resultOther: angular.IPromise<TResult | TOther>;
result = $q.when<TResult>(tResult);
result = $q.when<TResult>(promiseTResult);
@@ -388,20 +388,21 @@ namespace TestQ {
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => tOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => tResult, (any) => promiseTOther, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther);
result = resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => tOther, (any) => any);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther);
resultOther = $q.when<TResult, TOther, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => promiseTOther, (any) => any);
}
}
@@ -547,7 +548,7 @@ namespace TestPromise {
assertPromiseType<TResult>(promise.then((result) => result, (any) => any, (any) => any));
assertPromiseType<TResult>(promise.then((result) => result, (any) => reject, (any) => any));
assertPromiseType<TResult>(promise.then((result) => anyOf2(reject, result)));
assertPromiseType<angular.IPromise<never> | TResult>(promise.then((result) => anyOf2(reject, result)));
assertPromiseType<TResult>(promise.then((result) => anyOf3(result, tresultPromise, reject)));
assertPromiseType<TResult>(promise.then(
(result) => anyOf3(reject, result, tresultPromise),
@@ -557,7 +558,7 @@ namespace TestPromise {
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult>>(promise.then((result) => tresultHttpPromise));
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
assertPromiseType<TResult | TOther>(promise.then(
assertPromiseType<TResult | angular.IPromise<TResult> | angular.IPromise<never> | TOther | angular.IPromise<TOther>>(promise.then(
(result) => anyOf3(reject, result, totherPromise),
(reason) => anyOf3(reject, tother, tresultPromise)
));
@@ -588,7 +589,7 @@ namespace TestPromise {
assertPromiseType<any>(promise.catch((err) => err));
assertPromiseType<any>(promise.catch((err) => any));
assertPromiseType<TResult>(promise.catch((err) => tresult));
assertPromiseType<TResult>(promise.catch((err) => anyOf2(tresult, reject)));
assertPromiseType<TResult | angular.IPromise<never>>(promise.catch((err) => anyOf2(tresult, reject)));
assertPromiseType<TResult>(promise.catch((err) => anyOf3(tresult, tresultPromise, reject)));
assertPromiseType<TResult>(promise.catch((err) => tresultPromise));
assertPromiseType<TResult | ng.IHttpPromiseCallbackArg<TResult>>(promise.catch((err) => tresultHttpPromise));

View File

@@ -1049,6 +1049,10 @@ declare namespace angular {
* @param value Value or a promise
*/
resolve<T>(value: IPromise<T>|T): IPromise<T>;
/**
* @deprecated Since TS 2.4, inference is stricter and no longer produces the desired type when T1 !== T2.
* To use resolve with two different types, pass a union type to the single-type-argument overload.
*/
resolve<T1, T2>(value: IPromise<T1>|T2): IPromise<T1|T2>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
@@ -1846,6 +1850,10 @@ declare namespace angular {
* different in Angular 1 there is no direct mapping and care should be taken when upgrading.
*/
$postLink?(): void;
// IController implementations frequently do not implement any of its methods.
// A string indexer indicates to TypeScript not to issue a weak type error in this case.
[s: string]: any;
}
/**

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/spion/anydb-sql-migrations
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import Promise = require('bluebird');
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/Asana/node-asana
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="bluebird" />

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/auth0/node-auth0
// Definitions by: Wilson Hobbs <https://github.com/wbhob>, Seth Westphal <https://github.com/westy92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as Promise from 'bluebird';

View File

@@ -1,24 +1,24 @@
import "./index"
namespace BMapTests {
export class TestFixture {
//document: http://lbsyun.baidu.com/index.php?title=jspopular
public createMap(container: string | HTMLElement) {
navigator.geolocation.getCurrentPosition((position: Position) => {
let point = new BMap.Point(position.coords.longitude, position.coords.latitude);
let map = new BMap.Map(container);
map.centerAndZoom(point, 15);
}, console.log, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });
}
public addControl(map: BMap.Map) {
map.addControl(new BMap.ScaleControl({ anchor: BMAP_ANCHOR_TOP_LEFT }));
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.MapTypeControl({ mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP] }));
map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT }));
}
public addMarker(map: BMap.Map, point: BMap.Point) {
var marker = new BMap.Marker(point);
map.addOverlay(marker);
marker.setAnimation(BMAP_ANIMATION_BOUNCE);
}
}
}
import "./index"
namespace BMapTests {
export class TestFixture {
//document: http://lbsyun.baidu.com/index.php?title=jspopular
public createMap(container: string | HTMLElement) {
navigator.geolocation.getCurrentPosition((position: Position) => {
let point = new BMap.Point(position.coords.longitude, position.coords.latitude);
let map = new BMap.Map(container);
map.centerAndZoom(point, 15);
}, console.log, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true });
}
public addControl(map: BMap.Map) {
map.addControl(new BMap.ScaleControl({ anchor: BMAP_ANCHOR_TOP_LEFT }));
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.MapTypeControl({ mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP] }));
map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT }));
}
public addMarker(map: BMap.Map, point: BMap.Point) {
var marker = new BMap.Marker(point);
map.addOverlay(marker);
marker.setAnimation(BMAP_ANIMATION_BOUNCE);
}
}
}

View File

@@ -1,56 +1,56 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
declare namespace BMap {
class Point {
constructor (lng: number, lat: number)
lng: number
lat: number
equals(other: Point): boolean
}
class Pixel {
constructor (x: number, y: number)
x: number
y: number
equals(other: Pixel): boolean
}
class Size {
constructor (width: number, height: number)
width: number
height: number
equals(other: Size): boolean
}
class Bounds {
constructor (minX: number, minY: number, maxX: number, maxY: number)
constructor (sw: Point, ne: Point)
minX: number
minY: number
maxX: number
maxY: number
equals(other: Bounds): boolean
containsPoint(point: Point): boolean
containsBounds(bounds: Bounds): boolean
intersects(other: Bounds): boolean
extend(point: Point): void
getCenter(): Point
isEmpty(): boolean
getSouthWest(): Point
getNorthEast(): Point
toSpan(): Point
}
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
declare namespace BMap {
class Point {
constructor (lng: number, lat: number)
lng: number
lat: number
equals(other: Point): boolean
}
class Pixel {
constructor (x: number, y: number)
x: number
y: number
equals(other: Pixel): boolean
}
class Size {
constructor (width: number, height: number)
width: number
height: number
equals(other: Size): boolean
}
class Bounds {
constructor (minX: number, minY: number, maxX: number, maxY: number)
constructor (sw: Point, ne: Point)
minX: number
minY: number
maxX: number
maxY: number
equals(other: Bounds): boolean
containsPoint(point: Point): boolean
containsBounds(bounds: Bounds): boolean
intersects(other: Bounds): boolean
extend(point: Point): void
getCenter(): Point
isEmpty(): boolean
getSouthWest(): Point
getNorthEast(): Point
toSpan(): Point
}
}

View File

@@ -1,132 +1,132 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.maptype.d.ts" />
/// <reference path="./baidumap.overlay.d.ts" />
declare namespace BMap {
class Control {
constructor()
defaultAnchor: ControlAnchor
defaultOffset: Size
initialize(map: Map): HTMLElement
setAnchor(anchor: ControlAnchor): void
getAnchor(): ControlAnchor
setOffset(offset: Size): void
getOffset(): Size
show(): void
hide(): void
isVisible(): boolean
}
interface NavigationControlOptions {
anchor?: ControlAnchor
offset?: Size
type?: NavigationControlType
showZoomInfo?: boolean
enableGeolocation?: boolean
}
interface ScaleControlOptions {
anchor?: ControlAnchor
offset?: Size
}
interface CopyrightControlOptions {
anchor?: ControlAnchor
offset?: Size
}
type ControlAnchor = number
class OverviewMapControl extends Control {
constructor(opts: OverviewMapControlOptions)
changeView(): void
setSize(size: Size): void
getSize(): Size
onviewchanged: (event: { type: string, target: any, isOpen: boolean }) => void
onviewchanging: (event: { type: string, target: any }) => void
}
type LengthUnit = string
class MapTypeControl extends Control {
constructor(opts?: MapTypeControlOptions)
}
class NavigationControl extends Control {
constructor(opts?: NavigationControlOptions)
getType(): NavigationControlOptions
setType(type: NavigationControlType): void
}
interface OverviewMapControlOptions {
anchor?: ControlAnchor
offset?: Size
size?: Size
isOpen?: boolean
}
class CopyrightControl extends Control {
constructor(opts?: CopyrightControlOptions)
addCopyright(copyright: Copyright): void
removeCopyright(id: number): void
getCopyright(id: number): Copyright
getCopyrightCollection(): Copyright[]
}
interface MapTypeControlOptions {
type?: MapTypeControlType,
mapTypes?: MapType[]
}
type NavigationControlType = number
class ScaleControl extends Control {
constructor(opts?: ScaleControlOptions)
getUnit(): LengthUnit
setUnit(unit: LengthUnit): void
}
interface Copyright {
id?: number
content?: string
bounds?: Bounds
}
type MapTypeControlType = number
class GeolocationControl extends Control {
constructor(opts?: GeolocationControlOptions)
}
interface GeolocationControlOptions {
anchor?: ControlAnchor
offset?: Size
showAddressBar?: boolean
enableAutoLocation?: boolean
locationIcon?: Icon
}
type StatusCode = number
class PanoramaControl extends Control {
constructor()
}
}
declare const BMAP_UNIT_METRIC: BMap.LengthUnit
declare const BMAP_UNIT_IMPERIAL: BMap.LengthUnit
declare const BMAP_ANCHOR_TOP_LEFT: BMap.ControlAnchor
declare const BMAP_ANCHOR_TOP_RIGHT: BMap.ControlAnchor
declare const BMAP_ANCHOR_BOTTOM_LEFT: BMap.ControlAnchor
declare const BMAP_ANCHOR_BOTTOM_RIGHT: BMap.ControlAnchor
declare const BMAP_NAVIGATION_CONTROL_LARGE: BMap.NavigationControlType
declare const BMAP_NAVIGATION_CONTROL_SMALL: BMap.NavigationControlType
declare const BMAP_NAVIGATION_CONTROL_PAN: BMap.NavigationControlType
declare const BMAP_NAVIGATION_CONTROL_ZOOM: BMap.NavigationControlType
declare const BMAP_MAPTYPE_CONTROL_HORIZONTAL: BMap.MapTypeControlType
declare const BMAP_MAPTYPE_CONTROL_DROPDOWN: BMap.MapTypeControlType
declare const BMAP_MAPTYPE_CONTROL_MAP: BMap.MapTypeControlType
declare const BMAP_STATUS_PERMISSION_DENIED: BMap.StatusCode
declare const BMAP_STATUS_SERVICE_UNAVAILABLE: BMap.StatusCode
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.maptype.d.ts" />
/// <reference path="./baidumap.overlay.d.ts" />
declare namespace BMap {
class Control {
constructor()
defaultAnchor: ControlAnchor
defaultOffset: Size
initialize(map: Map): HTMLElement
setAnchor(anchor: ControlAnchor): void
getAnchor(): ControlAnchor
setOffset(offset: Size): void
getOffset(): Size
show(): void
hide(): void
isVisible(): boolean
}
interface NavigationControlOptions {
anchor?: ControlAnchor
offset?: Size
type?: NavigationControlType
showZoomInfo?: boolean
enableGeolocation?: boolean
}
interface ScaleControlOptions {
anchor?: ControlAnchor
offset?: Size
}
interface CopyrightControlOptions {
anchor?: ControlAnchor
offset?: Size
}
type ControlAnchor = number
class OverviewMapControl extends Control {
constructor(opts: OverviewMapControlOptions)
changeView(): void
setSize(size: Size): void
getSize(): Size
onviewchanged: (event: { type: string, target: any, isOpen: boolean }) => void
onviewchanging: (event: { type: string, target: any }) => void
}
type LengthUnit = string
class MapTypeControl extends Control {
constructor(opts?: MapTypeControlOptions)
}
class NavigationControl extends Control {
constructor(opts?: NavigationControlOptions)
getType(): NavigationControlOptions
setType(type: NavigationControlType): void
}
interface OverviewMapControlOptions {
anchor?: ControlAnchor
offset?: Size
size?: Size
isOpen?: boolean
}
class CopyrightControl extends Control {
constructor(opts?: CopyrightControlOptions)
addCopyright(copyright: Copyright): void
removeCopyright(id: number): void
getCopyright(id: number): Copyright
getCopyrightCollection(): Copyright[]
}
interface MapTypeControlOptions {
type?: MapTypeControlType,
mapTypes?: MapType[]
}
type NavigationControlType = number
class ScaleControl extends Control {
constructor(opts?: ScaleControlOptions)
getUnit(): LengthUnit
setUnit(unit: LengthUnit): void
}
interface Copyright {
id?: number
content?: string
bounds?: Bounds
}
type MapTypeControlType = number
class GeolocationControl extends Control {
constructor(opts?: GeolocationControlOptions)
}
interface GeolocationControlOptions {
anchor?: ControlAnchor
offset?: Size
showAddressBar?: boolean
enableAutoLocation?: boolean
locationIcon?: Icon
}
type StatusCode = number
class PanoramaControl extends Control {
constructor()
}
}
declare const BMAP_UNIT_METRIC: BMap.LengthUnit
declare const BMAP_UNIT_IMPERIAL: BMap.LengthUnit
declare const BMAP_ANCHOR_TOP_LEFT: BMap.ControlAnchor
declare const BMAP_ANCHOR_TOP_RIGHT: BMap.ControlAnchor
declare const BMAP_ANCHOR_BOTTOM_LEFT: BMap.ControlAnchor
declare const BMAP_ANCHOR_BOTTOM_RIGHT: BMap.ControlAnchor
declare const BMAP_NAVIGATION_CONTROL_LARGE: BMap.NavigationControlType
declare const BMAP_NAVIGATION_CONTROL_SMALL: BMap.NavigationControlType
declare const BMAP_NAVIGATION_CONTROL_PAN: BMap.NavigationControlType
declare const BMAP_NAVIGATION_CONTROL_ZOOM: BMap.NavigationControlType
declare const BMAP_MAPTYPE_CONTROL_HORIZONTAL: BMap.MapTypeControlType
declare const BMAP_MAPTYPE_CONTROL_DROPDOWN: BMap.MapTypeControlType
declare const BMAP_MAPTYPE_CONTROL_MAP: BMap.MapTypeControlType
declare const BMAP_STATUS_PERMISSION_DENIED: BMap.StatusCode
declare const BMAP_STATUS_SERVICE_UNAVAILABLE: BMap.StatusCode
declare const BMAP_STATUS_TIMEOUT: BMap.StatusCode

View File

@@ -1,154 +1,154 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.maptype.d.ts" />
/// <reference path="./baidumap.panorama.d.ts" />
declare namespace BMap {
class Map {
constructor(container: string | HTMLElement, opts?: MapOptions)
enableDragging(): void
disableDragging(): void
enableScrollWheelZoom(): void
disableScrollWheelZoom(): void
enableDoubleClickZoom(): void
disableDoubleClickZoom(): void
enableKeyboard(): void
disableKeyboard(): void
enableInertialDragging(): void
disableInertialDragging(): void
enableContinuousZoom(): void
disableContinuousZoom(): void
enablePinchToZoom(): void
disablePinchToZoom(): void
enableAutoResize(): void
disableAutoResize(): void
setDefaultCursor(cursor: string): void
getDefaultCursor(): string
setDraggingCursor(cursor: string): void
getDraggingCursor(): string
setMinZoom(zoom: number): void
setMaxZoom(zoom: number): void
setMapStyle(mapStyle: MapStyle): void
setPanorama(pano: Panorama): void
disable3DBuilding(): void
getBounds(): Bounds
getCenter(): Point
getDistance(start: Point, end: Point): number
getMapType(): MapType
getSize(): Size
getViewport(view: Point[], viewportOptions?: ViewportOptions): Viewport
getZoom(): number
getPanorama(): Panorama
centerAndZoom(center: Point, zoom: number): void
panTo(center: Point, opts?: PanOptions): void
panBy(x: number, y: number, opts?: PanOptions): void
reset(): void
setCenter(center: Point | string): void
setCurrentCity(city: string): void
setMapType(mapType: MapType): void
setViewport(view: Point[], viewportOptions?: ViewportOptions): void
setZoom(zoom: number): void
highResolutionEnabled(): boolean
zoomIn(): void
zoomOut(): void
addHotspot(hotspot: Hotspot): void
removeHotspot(hotspot: Hotspot): void
clearHotspots(): void
addControl(control: Control): void
removeControl(control: Control): void
getContainer(): HTMLElement
addContextMenu(menu: ContextMenu): void
removeContextMenu(menu: ContextMenu): void
addOverlay(overlay: Overlay): void
removeOverlay(overlay: Overlay): void
clearOverlays(): void
openInfoWindow(infoWnd: InfoWindow, point: Point): void
closeInfoWindow(): void
pointToOverlayPixel(point: Point): Pixel
overlayPixelToPoint(pixel: Pixel): Point
getInfoWindow(): InfoWindow
getOverlays(): Overlay[]
getPanes(): MapPanes
addTileLayer(tileLayer: TileLayer): void
removeTileLayer(tilelayer: TileLayer): void
getTileLayer(mapType: string): TileLayer
pixelToPoint(pixel: Pixel): Point
pointToPixel(point: Point): Pixel
onclick: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onrightclick: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
onrightdblclick: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
onmaptypechange: (event: { type: string, target: any }) => void
onmousemove: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
onmouseover: (event: { type: string, target: any }) => void
onmouseout: (event: { type: string, target: any }) => void
onmovestart: (event: { type: string, target: any }) => void
onmoving: (event: { type: string, target: any }) => void
onmoveend: (event: { type: string, target: any }) => void
onzoomstart: (event: { type: string, target: any }) => void
onzoomend: (event: { type: string, target: any }) => void
onaddoverlay: (event: { type: string, target: any }) => void
onaddcontrol: (event: { type: string, target: any }) => void
onremovecontrol: (event: { type: string, target: any }) => void
onremoveoverlay: (event: { type: string, target: any }) => void
onclearoverlays: (event: { type: string, target: any }) => void
ondragstart: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ondragging: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ondragend: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onaddtilelayer: (event: { type: string, target: any }) => void
onremovetilelayer: (event: { type: string, target: any }) => void
onload: (event: { type: string, target: any, point: Point, pixel: Pixel, zoom: number }) => void
onresize: (event: { type: string, target: any, size: Size }) => void
onhotspotclick: (event: { type: string, target: any, spots: HotspotOptions }) => void
onhotspotover: (event: { type: string, target: any, spots: HotspotOptions }) => void
onhotspotout: (event: { type: string, target: any, spots: HotspotOptions }) => void
ontilesloaded: (event: { type: string, target: any }) => void
ontouchstart: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ontouchmove: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ontouchend: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onlongpress: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
}
interface PanOptions {
noAnimation?: boolean
}
interface MapOptions {
minZoom?: number
maxZoom?: number
mapType?: MapType
enableHighResolution?: boolean
enableAutoResize?: boolean
enableMapClick?: boolean
}
interface Viewport {
center: Point
zoom: number
}
interface ViewportOptions {
enableAnimation?: boolean
margins?: number[]
zoomFactor?: number
delay?: number
}
type APIVersion = number
interface MapStyle {
features: any[]
style: string
}
}
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.maptype.d.ts" />
/// <reference path="./baidumap.panorama.d.ts" />
declare namespace BMap {
class Map {
constructor(container: string | HTMLElement, opts?: MapOptions)
enableDragging(): void
disableDragging(): void
enableScrollWheelZoom(): void
disableScrollWheelZoom(): void
enableDoubleClickZoom(): void
disableDoubleClickZoom(): void
enableKeyboard(): void
disableKeyboard(): void
enableInertialDragging(): void
disableInertialDragging(): void
enableContinuousZoom(): void
disableContinuousZoom(): void
enablePinchToZoom(): void
disablePinchToZoom(): void
enableAutoResize(): void
disableAutoResize(): void
setDefaultCursor(cursor: string): void
getDefaultCursor(): string
setDraggingCursor(cursor: string): void
getDraggingCursor(): string
setMinZoom(zoom: number): void
setMaxZoom(zoom: number): void
setMapStyle(mapStyle: MapStyle): void
setPanorama(pano: Panorama): void
disable3DBuilding(): void
getBounds(): Bounds
getCenter(): Point
getDistance(start: Point, end: Point): number
getMapType(): MapType
getSize(): Size
getViewport(view: Point[], viewportOptions?: ViewportOptions): Viewport
getZoom(): number
getPanorama(): Panorama
centerAndZoom(center: Point, zoom: number): void
panTo(center: Point, opts?: PanOptions): void
panBy(x: number, y: number, opts?: PanOptions): void
reset(): void
setCenter(center: Point | string): void
setCurrentCity(city: string): void
setMapType(mapType: MapType): void
setViewport(view: Point[], viewportOptions?: ViewportOptions): void
setZoom(zoom: number): void
highResolutionEnabled(): boolean
zoomIn(): void
zoomOut(): void
addHotspot(hotspot: Hotspot): void
removeHotspot(hotspot: Hotspot): void
clearHotspots(): void
addControl(control: Control): void
removeControl(control: Control): void
getContainer(): HTMLElement
addContextMenu(menu: ContextMenu): void
removeContextMenu(menu: ContextMenu): void
addOverlay(overlay: Overlay): void
removeOverlay(overlay: Overlay): void
clearOverlays(): void
openInfoWindow(infoWnd: InfoWindow, point: Point): void
closeInfoWindow(): void
pointToOverlayPixel(point: Point): Pixel
overlayPixelToPoint(pixel: Pixel): Point
getInfoWindow(): InfoWindow
getOverlays(): Overlay[]
getPanes(): MapPanes
addTileLayer(tileLayer: TileLayer): void
removeTileLayer(tilelayer: TileLayer): void
getTileLayer(mapType: string): TileLayer
pixelToPoint(pixel: Pixel): Point
pointToPixel(point: Point): Pixel
onclick: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onrightclick: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
onrightdblclick: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
onmaptypechange: (event: { type: string, target: any }) => void
onmousemove: (event: { type: string, target: any, point: Point, pixel: Pixel, overlay: Overlay }) => void
onmouseover: (event: { type: string, target: any }) => void
onmouseout: (event: { type: string, target: any }) => void
onmovestart: (event: { type: string, target: any }) => void
onmoving: (event: { type: string, target: any }) => void
onmoveend: (event: { type: string, target: any }) => void
onzoomstart: (event: { type: string, target: any }) => void
onzoomend: (event: { type: string, target: any }) => void
onaddoverlay: (event: { type: string, target: any }) => void
onaddcontrol: (event: { type: string, target: any }) => void
onremovecontrol: (event: { type: string, target: any }) => void
onremoveoverlay: (event: { type: string, target: any }) => void
onclearoverlays: (event: { type: string, target: any }) => void
ondragstart: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ondragging: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ondragend: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onaddtilelayer: (event: { type: string, target: any }) => void
onremovetilelayer: (event: { type: string, target: any }) => void
onload: (event: { type: string, target: any, point: Point, pixel: Pixel, zoom: number }) => void
onresize: (event: { type: string, target: any, size: Size }) => void
onhotspotclick: (event: { type: string, target: any, spots: HotspotOptions }) => void
onhotspotover: (event: { type: string, target: any, spots: HotspotOptions }) => void
onhotspotout: (event: { type: string, target: any, spots: HotspotOptions }) => void
ontilesloaded: (event: { type: string, target: any }) => void
ontouchstart: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ontouchmove: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ontouchend: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onlongpress: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
}
interface PanOptions {
noAnimation?: boolean
}
interface MapOptions {
minZoom?: number
maxZoom?: number
mapType?: MapType
enableHighResolution?: boolean
enableAutoResize?: boolean
enableMapClick?: boolean
}
interface Viewport {
center: Point
zoom: number
}
interface ViewportOptions {
enableAnimation?: boolean
margins?: number[]
zoomFactor?: number
delay?: number
}
type APIVersion = number
interface MapStyle {
features: any[]
style: string
}
}
declare const BMAP_API_VERSION: BMap.APIVersion

View File

@@ -1,82 +1,82 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.control.d.ts" />
declare namespace BMap {
class TileLayer {
constructor(opts?: TileLayerOptions)
getTilesUrl(tileCoord: Pixel, zoom: number): string
getCopyright(): Copyright
isTransparentPng(): boolean
}
interface TileLayerOptions {
transparentPng?: boolean
tileUrlTemplate?: string
copyright?: Copyright
zIndex?: number
}
class TrafficLayer extends TileLayer {
constructor(opts?: TrafficLayerOptions)
}
interface TrafficLayerOptions {
predictDate?: PredictDate
}
interface PredictDate {
weekday: number
hour: number
}
class CustomLayer extends TileLayer {
constructor(opts: CustomLayerOptions)
onhotspotclick: (event: { type: string, target: any, content: any }) => void
}
interface Custompoi {
poiId: string
databoxId: string
title: string
address: string
phoneNumber: string
postcode: string
provinceCode: number
province: string
cityCode: number
city: string
districtCode: number
district: string
point: Point
tags: string[]
typeId: number
extendedData: any
}
class PanoramaCoverageLayer extends TileLayer {
constructor()
}
interface CustomLayerOptions {
databoxId?: string
geotableId?: string
q?: string
tags?: string
filter?: string
pointDensityType?: PointDensityType
}
type PointDensityType = number
}
declare const BMAP_POINT_DENSITY_HIGH: BMap.PointDensityType
declare const BMAP_POINT_DENSITY_MEDIUM: BMap.PointDensityType
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.control.d.ts" />
declare namespace BMap {
class TileLayer {
constructor(opts?: TileLayerOptions)
getTilesUrl(tileCoord: Pixel, zoom: number): string
getCopyright(): Copyright
isTransparentPng(): boolean
}
interface TileLayerOptions {
transparentPng?: boolean
tileUrlTemplate?: string
copyright?: Copyright
zIndex?: number
}
class TrafficLayer extends TileLayer {
constructor(opts?: TrafficLayerOptions)
}
interface TrafficLayerOptions {
predictDate?: PredictDate
}
interface PredictDate {
weekday: number
hour: number
}
class CustomLayer extends TileLayer {
constructor(opts: CustomLayerOptions)
onhotspotclick: (event: { type: string, target: any, content: any }) => void
}
interface Custompoi {
poiId: string
databoxId: string
title: string
address: string
phoneNumber: string
postcode: string
provinceCode: number
province: string
cityCode: number
city: string
districtCode: number
district: string
point: Point
tags: string[]
typeId: number
extendedData: any
}
class PanoramaCoverageLayer extends TileLayer {
constructor()
}
interface CustomLayerOptions {
databoxId?: string
geotableId?: string
q?: string
tags?: string
filter?: string
pointDensityType?: PointDensityType
}
type PointDensityType = number
}
declare const BMAP_POINT_DENSITY_HIGH: BMap.PointDensityType
declare const BMAP_POINT_DENSITY_MEDIUM: BMap.PointDensityType
declare const BMAP_POINT_DENSITY_LOW: BMap.PointDensityType

View File

@@ -1,51 +1,51 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.maplayer.d.ts" />
declare namespace BMap {
class MapType {
constructor(name: string, layers: TileLayer | TileLayer[], opts?: MapTypeOptions)
getName(): string
getTileLayer(): TileLayer
getMinZoom(): number
getMaxZoom(): number
getProjection(): Projection
getTextColor(): string
getTips(): string
}
interface MapTypeOptions {
minZoom?: number
maxZoom?: number
errorImageUrl?: string
textColor?: number
tips?: string
}
interface Projection {
lngLatToPoint(lngLat: Point): Pixel
pointToLngLat(point: Pixel): Point
}
interface MercatorProjection extends Projection {
}
interface PerspectiveProjection extends Projection {
}
}
declare const BMAP_NORMAL_MAP: BMap.MapType
declare const BMAP_PERSPECTIVE_MAP: BMap.MapType
declare const BMAP_SATELLITE_MAP: BMap.MapType
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.maplayer.d.ts" />
declare namespace BMap {
class MapType {
constructor(name: string, layers: TileLayer | TileLayer[], opts?: MapTypeOptions)
getName(): string
getTileLayer(): TileLayer
getMinZoom(): number
getMaxZoom(): number
getProjection(): Projection
getTextColor(): string
getTips(): string
}
interface MapTypeOptions {
minZoom?: number
maxZoom?: number
errorImageUrl?: string
textColor?: number
tips?: string
}
interface Projection {
lngLatToPoint(lngLat: Point): Pixel
pointToLngLat(point: Pixel): Point
}
interface MercatorProjection extends Projection {
}
interface PerspectiveProjection extends Projection {
}
}
declare const BMAP_NORMAL_MAP: BMap.MapType
declare const BMAP_PERSPECTIVE_MAP: BMap.MapType
declare const BMAP_SATELLITE_MAP: BMap.MapType
declare const BMAP_HYBRID_MAP: BMap.MapType

View File

@@ -1,438 +1,438 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
/// <reference path="./baidumap.rightmenu.d.ts" />
declare namespace BMap {
interface Overlay {
initialize?(map: Map): HTMLElement
isVisible?(): boolean
draw?(): void
show?(): void
hide?(): void
}
type SymbolShapeType = number
interface PolylineOptions {
strokeColor?: string
strokeWeight?: number
strokeOpacity?: number
strokeStyle?: string
enableMassClear?: boolean
enableEditing?: boolean
enableClicking?: boolean
}
interface GroundOverlayOptions {
opacity?: number
imageURL?: string
displayOnMinLevel?: number
displayOnMaxLevel?: number
}
class Marker implements Overlay {
constructor(point: Point, opts?: MarkerOptions)
openInfoWindow(infoWnd: InfoWindow): void
closeInfoWindow(): void
setIcon(icon: Icon): void
getIcon(): Icon
setPosition(position: Point): void
getPosition(): Point
setOffset(offset: Size): void
getOffset(): Size
setLabel(label: Label): void
getLabel(): Label
setTitle(title: string): void
getTitle(): string
setTop(isTop: boolean): void
enableDragging(): void
disableDragging(): void
enableMassClear(): void
disableMassClear(): void
setZIndex(zIndex: number): void
getMap(): Map
addContextMenu(menu: ContextMenu): void
removeContextMenu(menu: ContextMenu): void
setAnimation(animation?: Animation): void
setRotation(rotation: number): void
getRotation(): number
setShadow(shadow: Icon): void
getShadow(): void
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
oninfowindowclose: (event: { type: string, target: any }) => void
oninfowindowopen: (event: { type: string, target: any }) => void
ondragstart: (event: { type: string, target: any }) => void
ondragging: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ondragend: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onrightclick: (event: { type: string, target: any }) => void
}
interface SymbolOptions {
anchor?: Size
fillColor?: string
fillOpacity?: number
scale?: number
rotation?: number
strokeColor?: string
strokeOpacity?: number
strokeWeight?: number
}
class IconSequence {
constructor(symbol: Symbol, offset?: string, repeat?: string, fixedRotation?: boolean)
}
class PointCollection implements Overlay {
constructor(points: Point[], opts?: PointCollectionOption)
setPoints(points: Point[]): void
setStyles(styles: PointCollectionOption): void
clear(): void
onclick: (event: { type: string, target: any, point: Point }) => void
onmouseover: (event: { type: string, target: any, point: Point }) => void
onmouseout: (event: { type: string, target: any, point: Point }) => void
}
interface MarkerOptions {
offset?: Size
icon?: Icon
enableMassClear?: boolean
enableDragging?: boolean
enableClicking?: boolean
raiseOnDrag?: boolean
draggingCursor?: string
rotation?: number
shadow?: Icon
title?: string
}
class InfoWindow implements Overlay {
constructor(content: string | HTMLElement, opts?: InfoWindowOptions)
setWidth(width: number): void
setHeight(height: number): void
redraw(): void
setTitle(title: string | HTMLElement): void
getTitle(): string | HTMLElement
setContent(content: string | HTMLElement): void
getContent(): string | HTMLElement
getPosition(): Point
enableMaximize(): void
disableMaximize(): void
isOpen(): boolean
setMaxContent(content: string): void
maximize(): void
restore(): void
enableAutoPan(): void
disableAutoPan(): void
enableCloseOnClick(): void
disableCloseOnClick(): void
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclose: (event: { type: string, target: any, point: Point }) => void
onopen: (event: { type: string, target: any, point: Point }) => void
onmaximize: (event: { type: string, target: any }) => void
onrestore: (event: { type: string, target: any }) => void
onclickclose: (event: { type: string, target: any }) => void
}
class Polygon implements Overlay {
constructor(points: Array<Point>, opts?: PolygonOptions)
setPath(path: Point[]): void
getPath(): Point[]
setStrokeColor(color: string): void
getStrokeColor(): string
setFillColor(color: string): void
getFillColor(): string
setStrokeOpacity(opacity: number): void
getStrokeOpacity(): number
setFillOpacity(opacity: number): void
getFillOpacity(): number
setStrokeWeight(weight: number): void
getStrokeWeight(): number
setStrokeStyle(style: string): void
getStrokeStyle(): string
getBounds(): Bounds
enableEditing(): void
disableEditing(): void
enableMassClear(): void
disableMassClear(): void
setPointAt(index: number, point: Point): void
setPositionAt(index: number, point: Point): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
onlineupdate: (event: { type: string, target: any }) => void
}
interface PointCollectionOption {
shape?: ShapeType
color?: string
size?: SizeType
}
type Animation = number
interface InfoWindowOptions {
width?: number
height?: number
maxWidth?: number
offset?: Size
title?: string
enableAutoPan?: boolean
enableCloseOnClick?: boolean
enableMessage?: boolean
message?: string
}
interface PolygonOptions {
strokeColor?: string
fillColor?: string
strokeWeight?: number
strokeOpacity?: number
fillOpacity?: number
strokeStyle?: number
enableMassClear?: boolean
enableEditing?: boolean
enableClicking?: boolean
}
type ShapeType = number
class Icon implements Overlay {
constructor(url: string, size: Size, opts?: IconOptions)
anchor: Size
size: Size
imageOffset: Size
imageSize: Size
imageUrl: Size
infoWindowAnchor: Size
printImageUrl: string
setImageUrl(imageUrl: string): void
setSize(size: Size): void
setImageSize(offset: Size): void
setAnchor(anchor: Size): void
setImageOffset(offset: Size): void
setInfoWindowAnchor(anchor: Size): void
setPrintImageUrl(url: string): void
}
class Label implements Overlay {
constructor(content: string, opts?: LabelOptions)
setStyle(styles: Object): void
setContent(content: string): void
setPosition(position: Point): void
getPosition(): Point
setOffset(offset: Size): void
getOffset(): Size
setTitle(title: string): void
getTitle(): string
enableMassClear(): void
disableMassClear(): void
setZIndex(zIndex: number): void
setPosition(position: Point): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any }) => void
onmousedown: (event: { type: string, target: any }) => void
onmouseup: (event: { type: string, target: any }) => void
onmouseout: (event: { type: string, target: any }) => void
onmouseover: (event: { type: string, target: any }) => void
onremove: (event: { type: string, target: any }) => void
onrightclick: (event: { type: string, target: any }) => void
}
class Circle implements Overlay {
constructor(center: Point, radius: number, opts?: CircleOptions)
setCenter(center: Point): void
getCenter(): Point
setRadius(radius: number): void
getRadius(): number
getBounds(): Bounds
setStrokeColor(color: string): void
getStrokeColor(): string
setFillColor(color: string): void
getFillColor(): string
setStrokeOpacity(opacity: number): void
getStrokeOpacity(): number
setFillOpacity(opacity: number): void
getFillOpacity(): number
setStrokeWeight(weight: number): void
getStrokeWeight(): number
setStrokeStyle(style: string): void
getStrokeStyle(): string
getBounds(): Bounds
enableEditing(): void
disableEditing(): void
enableMassClear(): void
disableMassClear(): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
onlineupdate: (event: { type: string, target: any }) => void
}
type SizeType = number
interface IconOptions {
anchor?: Size
imageOffset?: Size
infoWindowAnchor?: Size
printImageUrl?: string
}
interface LabelOptions {
offset?: Size
position?: Point
enableMassClear?: boolean
}
interface CircleOptions {
strokeColor?: string
fillColor?: string
strokeWeight?: number
strokeOpacity?: number
fillOpacity?: number
strokeStyle?: string
enableMassClear?: boolean
enableEditing?: boolean
enableClicking?: boolean
}
class Hotspot implements Overlay {
constructor(position: Point, opts?: HotspotOptions)
setPosition(position: Point): void
getPosition(): Point
setText(text: string): void
getText(): string
setUserData(data: any): void
getUserData(): any
}
class Symbol implements Overlay {
constructor(path: string | SymbolShapeType, opts?: SymbolOptions)
setPath(path: string | SymbolShapeType): void
setAnchor(anchor: Size): void
setRotation(rotation: number): void
setScale(scale: number): void
setStrokeWeight(strokeWeight: number): void
setStrokeColor(color: string): void
setStrokeOpacity(opacity: number): void
setFillOpacity(opacity: number): void
setFillColor(color: string): void
}
class Polyline implements Overlay {
constructor(points: Point[], opts?: PolylineOptions)
setPath(path: Point[]): void
getPath(): Point[]
setStrokeColor(color: string): void
getStrokeColor(): string
setFillColor(color: string): void
getFillColor(): string
setStrokeOpacity(opacity: number): void
getStrokeOpacity(): number
setFillOpacity(opacity: number): void
getFillOpacity(): number
setStrokeWeight(weight: number): void
getStrokeWeight(): number
setStrokeStyle(style: string): void
getStrokeStyle(): string
getBounds(): Bounds
enableEditing(): void
disableEditing(): void
enableMassClear(): void
disableMassClear(): void
setPointAt(index: number, point: Point): void
setPositionAt(index: number, point: Point): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
onlineupdate: (event: { type: string, target: any }) => void
}
class GroundOverlay implements Overlay {
constructor(bounds: Bounds, opts?: GroundOverlayOptions)
setBounds(bounds: Bounds): void
getBounds(): Bounds
setOpacity(opcity: number): void
getOpacity(): number
setImageURL(url: string): void
getImageURL(): string
setDisplayOnMinLevel(level: number): void
getDisplayOnMinLevel(): number
setDispalyOnMaxLevel(level: number): void
getDispalyOnMaxLevel(): number
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any }) => void
}
interface HotspotOptions {
text?: string
offsets?: number[]
userData?: any
minZoom?: number
maxZoom?: number
}
interface MapPanes {
floatPane?: HTMLElement
markerMouseTarget?: HTMLElement
floatShadow?: HTMLElement
labelPane?: HTMLElement
markerPane?: HTMLElement
markerShadow?: HTMLElement
mapPane?: HTMLElement
}
}
declare const BMap_Symbol_SHAPE_CIRCLE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_RECTANGLE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_RHOMBUS: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_STAR: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_POINT: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_PLANE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_CAMERA: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_WARNING: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_SMILE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_CLOCK: BMap.SymbolShapeType
declare const BMAP_ANIMATION_DROP: BMap.Animation
declare const BMAP_ANIMATION_BOUNCE: BMap.Animation
declare const BMAP_POINT_SHAPE_CIRCLE: BMap.ShapeType
declare const APE_STAR: BMap.ShapeType
declare const APE_SQUARE: BMap.ShapeType
declare const APE_RHOMBUS: BMap.ShapeType
declare const APE_WATERDROP: BMap.ShapeType
declare const BMAP_POINT_SIZE_TINY: BMap.SizeType
declare const BMAP_POINT_SIZE_SMALLER: BMap.SizeType
declare const BMAP_POINT_SIZE_SMALL: BMap.SizeType
declare const BMAP_POINT_SIZE_NORMAL: BMap.SizeType
declare const BMAP_POINT_SIZE_BIG: BMap.SizeType
declare const BMAP_POINT_SIZE_BIGGER: BMap.SizeType
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
/// <reference path="./baidumap.rightmenu.d.ts" />
declare namespace BMap {
interface Overlay {
initialize?(map: Map): HTMLElement
isVisible?(): boolean
draw?(): void
show?(): void
hide?(): void
}
type SymbolShapeType = number
interface PolylineOptions {
strokeColor?: string
strokeWeight?: number
strokeOpacity?: number
strokeStyle?: string
enableMassClear?: boolean
enableEditing?: boolean
enableClicking?: boolean
}
interface GroundOverlayOptions {
opacity?: number
imageURL?: string
displayOnMinLevel?: number
displayOnMaxLevel?: number
}
class Marker implements Overlay {
constructor(point: Point, opts?: MarkerOptions)
openInfoWindow(infoWnd: InfoWindow): void
closeInfoWindow(): void
setIcon(icon: Icon): void
getIcon(): Icon
setPosition(position: Point): void
getPosition(): Point
setOffset(offset: Size): void
getOffset(): Size
setLabel(label: Label): void
getLabel(): Label
setTitle(title: string): void
getTitle(): string
setTop(isTop: boolean): void
enableDragging(): void
disableDragging(): void
enableMassClear(): void
disableMassClear(): void
setZIndex(zIndex: number): void
getMap(): Map
addContextMenu(menu: ContextMenu): void
removeContextMenu(menu: ContextMenu): void
setAnimation(animation?: Animation): void
setRotation(rotation: number): void
getRotation(): number
setShadow(shadow: Icon): void
getShadow(): void
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
oninfowindowclose: (event: { type: string, target: any }) => void
oninfowindowopen: (event: { type: string, target: any }) => void
ondragstart: (event: { type: string, target: any }) => void
ondragging: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
ondragend: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onrightclick: (event: { type: string, target: any }) => void
}
interface SymbolOptions {
anchor?: Size
fillColor?: string
fillOpacity?: number
scale?: number
rotation?: number
strokeColor?: string
strokeOpacity?: number
strokeWeight?: number
}
class IconSequence {
constructor(symbol: Symbol, offset?: string, repeat?: string, fixedRotation?: boolean)
}
class PointCollection implements Overlay {
constructor(points: Point[], opts?: PointCollectionOption)
setPoints(points: Point[]): void
setStyles(styles: PointCollectionOption): void
clear(): void
onclick: (event: { type: string, target: any, point: Point }) => void
onmouseover: (event: { type: string, target: any, point: Point }) => void
onmouseout: (event: { type: string, target: any, point: Point }) => void
}
interface MarkerOptions {
offset?: Size
icon?: Icon
enableMassClear?: boolean
enableDragging?: boolean
enableClicking?: boolean
raiseOnDrag?: boolean
draggingCursor?: string
rotation?: number
shadow?: Icon
title?: string
}
class InfoWindow implements Overlay {
constructor(content: string | HTMLElement, opts?: InfoWindowOptions)
setWidth(width: number): void
setHeight(height: number): void
redraw(): void
setTitle(title: string | HTMLElement): void
getTitle(): string | HTMLElement
setContent(content: string | HTMLElement): void
getContent(): string | HTMLElement
getPosition(): Point
enableMaximize(): void
disableMaximize(): void
isOpen(): boolean
setMaxContent(content: string): void
maximize(): void
restore(): void
enableAutoPan(): void
disableAutoPan(): void
enableCloseOnClick(): void
disableCloseOnClick(): void
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclose: (event: { type: string, target: any, point: Point }) => void
onopen: (event: { type: string, target: any, point: Point }) => void
onmaximize: (event: { type: string, target: any }) => void
onrestore: (event: { type: string, target: any }) => void
onclickclose: (event: { type: string, target: any }) => void
}
class Polygon implements Overlay {
constructor(points: Array<Point>, opts?: PolygonOptions)
setPath(path: Point[]): void
getPath(): Point[]
setStrokeColor(color: string): void
getStrokeColor(): string
setFillColor(color: string): void
getFillColor(): string
setStrokeOpacity(opacity: number): void
getStrokeOpacity(): number
setFillOpacity(opacity: number): void
getFillOpacity(): number
setStrokeWeight(weight: number): void
getStrokeWeight(): number
setStrokeStyle(style: string): void
getStrokeStyle(): string
getBounds(): Bounds
enableEditing(): void
disableEditing(): void
enableMassClear(): void
disableMassClear(): void
setPointAt(index: number, point: Point): void
setPositionAt(index: number, point: Point): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
onlineupdate: (event: { type: string, target: any }) => void
}
interface PointCollectionOption {
shape?: ShapeType
color?: string
size?: SizeType
}
type Animation = number
interface InfoWindowOptions {
width?: number
height?: number
maxWidth?: number
offset?: Size
title?: string
enableAutoPan?: boolean
enableCloseOnClick?: boolean
enableMessage?: boolean
message?: string
}
interface PolygonOptions {
strokeColor?: string
fillColor?: string
strokeWeight?: number
strokeOpacity?: number
fillOpacity?: number
strokeStyle?: number
enableMassClear?: boolean
enableEditing?: boolean
enableClicking?: boolean
}
type ShapeType = number
class Icon implements Overlay {
constructor(url: string, size: Size, opts?: IconOptions)
anchor: Size
size: Size
imageOffset: Size
imageSize: Size
imageUrl: Size
infoWindowAnchor: Size
printImageUrl: string
setImageUrl(imageUrl: string): void
setSize(size: Size): void
setImageSize(offset: Size): void
setAnchor(anchor: Size): void
setImageOffset(offset: Size): void
setInfoWindowAnchor(anchor: Size): void
setPrintImageUrl(url: string): void
}
class Label implements Overlay {
constructor(content: string, opts?: LabelOptions)
setStyle(styles: Object): void
setContent(content: string): void
setPosition(position: Point): void
getPosition(): Point
setOffset(offset: Size): void
getOffset(): Size
setTitle(title: string): void
getTitle(): string
enableMassClear(): void
disableMassClear(): void
setZIndex(zIndex: number): void
setPosition(position: Point): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any }) => void
onmousedown: (event: { type: string, target: any }) => void
onmouseup: (event: { type: string, target: any }) => void
onmouseout: (event: { type: string, target: any }) => void
onmouseover: (event: { type: string, target: any }) => void
onremove: (event: { type: string, target: any }) => void
onrightclick: (event: { type: string, target: any }) => void
}
class Circle implements Overlay {
constructor(center: Point, radius: number, opts?: CircleOptions)
setCenter(center: Point): void
getCenter(): Point
setRadius(radius: number): void
getRadius(): number
getBounds(): Bounds
setStrokeColor(color: string): void
getStrokeColor(): string
setFillColor(color: string): void
getFillColor(): string
setStrokeOpacity(opacity: number): void
getStrokeOpacity(): number
setFillOpacity(opacity: number): void
getFillOpacity(): number
setStrokeWeight(weight: number): void
getStrokeWeight(): number
setStrokeStyle(style: string): void
getStrokeStyle(): string
getBounds(): Bounds
enableEditing(): void
disableEditing(): void
enableMassClear(): void
disableMassClear(): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
onlineupdate: (event: { type: string, target: any }) => void
}
type SizeType = number
interface IconOptions {
anchor?: Size
imageOffset?: Size
infoWindowAnchor?: Size
printImageUrl?: string
}
interface LabelOptions {
offset?: Size
position?: Point
enableMassClear?: boolean
}
interface CircleOptions {
strokeColor?: string
fillColor?: string
strokeWeight?: number
strokeOpacity?: number
fillOpacity?: number
strokeStyle?: string
enableMassClear?: boolean
enableEditing?: boolean
enableClicking?: boolean
}
class Hotspot implements Overlay {
constructor(position: Point, opts?: HotspotOptions)
setPosition(position: Point): void
getPosition(): Point
setText(text: string): void
getText(): string
setUserData(data: any): void
getUserData(): any
}
class Symbol implements Overlay {
constructor(path: string | SymbolShapeType, opts?: SymbolOptions)
setPath(path: string | SymbolShapeType): void
setAnchor(anchor: Size): void
setRotation(rotation: number): void
setScale(scale: number): void
setStrokeWeight(strokeWeight: number): void
setStrokeColor(color: string): void
setStrokeOpacity(opacity: number): void
setFillOpacity(opacity: number): void
setFillColor(color: string): void
}
class Polyline implements Overlay {
constructor(points: Point[], opts?: PolylineOptions)
setPath(path: Point[]): void
getPath(): Point[]
setStrokeColor(color: string): void
getStrokeColor(): string
setFillColor(color: string): void
getFillColor(): string
setStrokeOpacity(opacity: number): void
getStrokeOpacity(): number
setFillOpacity(opacity: number): void
getFillOpacity(): number
setStrokeWeight(weight: number): void
getStrokeWeight(): number
setStrokeStyle(style: string): void
getStrokeStyle(): string
getBounds(): Bounds
enableEditing(): void
disableEditing(): void
enableMassClear(): void
disableMassClear(): void
setPointAt(index: number, point: Point): void
setPositionAt(index: number, point: Point): void
getMap(): Map
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmousedown: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseup: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseout: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onmouseover: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onremove: (event: { type: string, target: any }) => void
onlineupdate: (event: { type: string, target: any }) => void
}
class GroundOverlay implements Overlay {
constructor(bounds: Bounds, opts?: GroundOverlayOptions)
setBounds(bounds: Bounds): void
getBounds(): Bounds
setOpacity(opcity: number): void
getOpacity(): number
setImageURL(url: string): void
getImageURL(): string
setDisplayOnMinLevel(level: number): void
getDisplayOnMinLevel(): number
setDispalyOnMaxLevel(level: number): void
getDispalyOnMaxLevel(): number
onclick: (event: { type: string, target: any }) => void
ondblclick: (event: { type: string, target: any }) => void
}
interface HotspotOptions {
text?: string
offsets?: number[]
userData?: any
minZoom?: number
maxZoom?: number
}
interface MapPanes {
floatPane?: HTMLElement
markerMouseTarget?: HTMLElement
floatShadow?: HTMLElement
labelPane?: HTMLElement
markerPane?: HTMLElement
markerShadow?: HTMLElement
mapPane?: HTMLElement
}
}
declare const BMap_Symbol_SHAPE_CIRCLE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_RECTANGLE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_RHOMBUS: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_STAR: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_BACKWARD_CLOSED_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_FORWARD_CLOSED_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_BACKWARD_OPEN_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_FORWARD_OPEN_ARROW: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_POINT: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_PLANE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_CAMERA: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_WARNING: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_SMILE: BMap.SymbolShapeType
declare const BMap_Symbol_SHAPE_CLOCK: BMap.SymbolShapeType
declare const BMAP_ANIMATION_DROP: BMap.Animation
declare const BMAP_ANIMATION_BOUNCE: BMap.Animation
declare const BMAP_POINT_SHAPE_CIRCLE: BMap.ShapeType
declare const APE_STAR: BMap.ShapeType
declare const APE_SQUARE: BMap.ShapeType
declare const APE_RHOMBUS: BMap.ShapeType
declare const APE_WATERDROP: BMap.ShapeType
declare const BMAP_POINT_SIZE_TINY: BMap.SizeType
declare const BMAP_POINT_SIZE_SMALLER: BMap.SizeType
declare const BMAP_POINT_SIZE_SMALL: BMap.SizeType
declare const BMAP_POINT_SIZE_NORMAL: BMap.SizeType
declare const BMAP_POINT_SIZE_BIG: BMap.SizeType
declare const BMAP_POINT_SIZE_BIGGER: BMap.SizeType
declare const BMAP_POINT_SIZE_HUGE: BMap.SizeType

View File

@@ -1,121 +1,121 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.control.d.ts" />
declare namespace BMap {
class Panorama {
constructor(container: string | HTMLElement, opts?: PanoramaOptions)
getLinks(): PanoramaLink[]
getId(): string
getPosition(): Point
getPov(): PanoramaPov
getZoom(): number
setId(id: string): void
setPosition(position: Point): void
setPov(pov: PanoramaPov): void
setZoom(zoom: number): void
enableScrollWheelZoom(): void
disableScrollWheelZoom(): void
show(): void
hide(): void
addOverlay(overlay: PanoramaLabel): void
removeOverlay(overlay: PanoramaLabel): void
getSceneType(): PanoramaSceneType
setOptions(opts?: PanoramaOptions): void
setPanoramaPOIType(): PanoramaPOIType
onposition_changed: () => void
onlinks_changed: () => void
onpov_changed: () => void
onzoom_changed: () => void
onscene_type_changed: () => void
}
interface PanoramaOptions {
navigationControl?: boolean
linksControl?: boolean
indoorSceneSwitchControl?: boolean
albumsControl?: boolean
albumsControlOptions?: AlbumsControlOptions
}
interface PanoramaLink {
description: string
heading: string
id: string
}
interface PanoramaPov {
heading: number
pitch: number
}
class PanoramaService {
constructor()
getPanoramaById(id: string, callback: (data: PanoramaData) => void): void
getPanoramaByLocation(point: Point, radius?: number, callback?: (data: PanoramaData) => void): void
}
interface PanoramaData {
id: string
description: string
links: PanoramaLink[]
position: Point
tiles: PanoramaTileData
}
interface PanoramaTileData {
centerHeading: number
tileSize: Size
worldSize: Size
}
class PanoramaLabel {
constructor(content: string, opts?: PanoramaLabelOptions)
setPosition(position: Point): void
getPosition(): Point
getPov(): PanoramaPov
setContent(content: string): void
getContent(): string
show(): void
hide(): void
setAltitude(altitude: number): void
getAltitude(): number
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
onmouseover: (event: { type: string, target: any }) => void
onmouseout: (event: { type: string, target: any }) => void
onremove: (event: { type: string, target: any }) => void
}
interface PanoramaLabelOptions {
position?: Point
altitude?: number
}
interface AlbumsControlOptions {
anchor?: ControlAnchor
offset?: Size
maxWidth?: number | string
imageHeight?: number
}
type PanoramaSceneType = string
type PanoramaPOIType = string
}
declare const BMAP_PANORAMA_INDOOR_SCENE: string
declare const BMAP_PANORAMA_STREET_SCENE: string
declare const BMAP_PANORAMA_POI_HOTEL: string
declare const BMAP_PANORAMA_POI_CATERING: string
declare const BMAP_PANORAMA_POI_MOVIE: string
declare const BMAP_PANORAMA_POI_TRANSIT: string
declare const BMAP_PANORAMA_POI_INDOOR_SCENE: string
declare const BMAP_PANORAMA_POI_NONE: string
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.control.d.ts" />
declare namespace BMap {
class Panorama {
constructor(container: string | HTMLElement, opts?: PanoramaOptions)
getLinks(): PanoramaLink[]
getId(): string
getPosition(): Point
getPov(): PanoramaPov
getZoom(): number
setId(id: string): void
setPosition(position: Point): void
setPov(pov: PanoramaPov): void
setZoom(zoom: number): void
enableScrollWheelZoom(): void
disableScrollWheelZoom(): void
show(): void
hide(): void
addOverlay(overlay: PanoramaLabel): void
removeOverlay(overlay: PanoramaLabel): void
getSceneType(): PanoramaSceneType
setOptions(opts?: PanoramaOptions): void
setPanoramaPOIType(): PanoramaPOIType
onposition_changed: () => void
onlinks_changed: () => void
onpov_changed: () => void
onzoom_changed: () => void
onscene_type_changed: () => void
}
interface PanoramaOptions {
navigationControl?: boolean
linksControl?: boolean
indoorSceneSwitchControl?: boolean
albumsControl?: boolean
albumsControlOptions?: AlbumsControlOptions
}
interface PanoramaLink {
description: string
heading: string
id: string
}
interface PanoramaPov {
heading: number
pitch: number
}
class PanoramaService {
constructor()
getPanoramaById(id: string, callback: (data: PanoramaData) => void): void
getPanoramaByLocation(point: Point, radius?: number, callback?: (data: PanoramaData) => void): void
}
interface PanoramaData {
id: string
description: string
links: PanoramaLink[]
position: Point
tiles: PanoramaTileData
}
interface PanoramaTileData {
centerHeading: number
tileSize: Size
worldSize: Size
}
class PanoramaLabel {
constructor(content: string, opts?: PanoramaLabelOptions)
setPosition(position: Point): void
getPosition(): Point
getPov(): PanoramaPov
setContent(content: string): void
getContent(): string
show(): void
hide(): void
setAltitude(altitude: number): void
getAltitude(): number
addEventListener(event: string, handler: Function): void
removeEventListener(event: string, handler: Function): void
onclick: (event: { type: string, target: any }) => void
onmouseover: (event: { type: string, target: any }) => void
onmouseout: (event: { type: string, target: any }) => void
onremove: (event: { type: string, target: any }) => void
}
interface PanoramaLabelOptions {
position?: Point
altitude?: number
}
interface AlbumsControlOptions {
anchor?: ControlAnchor
offset?: Size
maxWidth?: number | string
imageHeight?: number
}
type PanoramaSceneType = string
type PanoramaPOIType = string
}
declare const BMAP_PANORAMA_INDOOR_SCENE: string
declare const BMAP_PANORAMA_STREET_SCENE: string
declare const BMAP_PANORAMA_POI_HOTEL: string
declare const BMAP_PANORAMA_POI_CATERING: string
declare const BMAP_PANORAMA_POI_MOVIE: string
declare const BMAP_PANORAMA_POI_TRANSIT: string
declare const BMAP_PANORAMA_POI_INDOOR_SCENE: string
declare const BMAP_PANORAMA_POI_NONE: string

View File

@@ -1,47 +1,47 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
declare namespace BMap {
type ContextMenuIcon = string
interface MenuItemOptions {
width?: number
id?: string
iconUrl?: string
}
class MenuItem {
constructor(text: string, callback: (point: Point) => void, opts?: MenuItemOptions)
setText(text: string): void
setIcon(iconUrl: string): void
enable(): void
disable(): void
}
class ContextMenu {
constructor()
addItem(item: MenuItem): void
getItem(index: number): MenuItem
removeItem(item: MenuItem): void
addSeparator(): void
removeSeparator(index: number): void
onopen: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onclose: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
}
}
declare const BMAP_CONTEXT_MENU_ICON_ZOOMIN: string
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
declare namespace BMap {
type ContextMenuIcon = string
interface MenuItemOptions {
width?: number
id?: string
iconUrl?: string
}
class MenuItem {
constructor(text: string, callback: (point: Point) => void, opts?: MenuItemOptions)
setText(text: string): void
setIcon(iconUrl: string): void
enable(): void
disable(): void
}
class ContextMenu {
constructor()
addItem(item: MenuItem): void
getItem(index: number): MenuItem
removeItem(item: MenuItem): void
addSeparator(): void
removeSeparator(index: number): void
onopen: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
onclose: (event: { type: string, target: any, point: Point, pixel: Pixel }) => void
}
}
declare const BMAP_CONTEXT_MENU_ICON_ZOOMIN: string
declare const BMAP_CONTEXT_MENU_ICON_ZOOMOUT: string

View File

@@ -1,432 +1,432 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
declare namespace BMap {
class LocalSearch {
constructor(location: Map | Point | string, opts?: LocalSearchOptions)
search(keyword: string | Array<string>, option?: Object): void
searchInBounds(keyword: string | Array<string>, bounds: Bounds, option?: Object): void
searchNearby(keyword: string | Array<string>, center: LocalResultPoi | string | Point, radius: number, option?: Object): void
getResults(): LocalResult | LocalResult[]
clearResults(): void
gotoPage(page: number): void
enableAutoViewport(): void
disableAutoViewport(): void
enableFirstResultSelection(): void
disableFirstResultSelection(): void
setLocation(location: Map | Point | string): void
setPageCapacity(capacity: number): void
getPageCapacity(): number
setSearchCompleteCallback(callback: (results: LocalResult | LocalResult[]) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
}
type LineType = number
interface WalkingRouteResult {
city: string
getStart(): LocalResultPoi
getEnd(): LocalResultPoi
getNumPlans(): number
getPlan(i: number): RoutePlan
}
class BusLineSearch {
constructor(location: Map | Point | string, opts?: BusLineSearchOptions)
getBusList(keyword: string): void
getBusLine(busLstItem: BusListItem): void
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setLocation(location: Map | Point | string): void
getStatus(): ServiceStatusCode
toString(): string
setGetBusListCompleteCallback(callback: (rs: BusListResult) => void): void
setGetBusLineCompleteCallback(callback: (rs: BusLine) => void): void
setBusListHtmlSetCallback(callback: (container: HTMLElement) => void): void
setBusLineHtmlSetCallback(callback: (container: HTMLElement) => void): void
setPolylinesSetCallback(callback: (ply: Polyline) => void): void
setMarkersSetCallback(callback: (markers: Marker[]) => void): void
}
interface LocalSearchOptions {
renderOptions?: RenderOptions
onMarkersSet?: (pois: LocalResultPoi[]) => void
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void
onResultsHtmlSet?: (container: HTMLElement) => void
pageCapacity?: number
onSearchComplete?: (results: LocalResult[]) => void
}
class DrivingRoute {
constructor(location: Map | Point | string, opts?: DrivingRouteOptions)
search(start: string | Point | LocalResultPoi, end: string | Point | LocalResultPoi, opts?: Object): void
getResults(): DrivingRouteResult
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setLocation(location: Map | Point | string): void
setPolicy(policy: DrivingPolicy): void
setSearchCompleteCallback(callback: (results: DrivingRouteResult) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setPolylinesSetCallback(callback: (routes: Route[]) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
toString(): string
}
class Geocoder {
constructor()
getPoint(address: string, callback: (point: Point) => void, city: string): void
getLocation(point: Point, callback: (result: GeocoderResult) => void, opts?: LocationOptions): void
}
interface BusLineSearchOptions {
renderOptions?: RenderOptions
onGetBusListComplete?: (rs: BusListResult) => void
onGetBusLineComplete?: (rs: BusLine) => void
onBusListHtmlSet?: (container: HTMLElement) => void
onBusLineHtmlSet?: (container: HTMLElement) => void
onPolylinesSet?: (ply: Polyline) => void
onMarkersSet?: (sts: Marker[]) => void
}
interface CustomData {
geotableId: number
tags: string
filter: string
}
interface DrivingRouteOptions {
renderOptions?: RenderOptions
policy?: DrivingPolicy
onSearchComplete?: (results: DrivingRouteResult) => void
onMarkersSet?: (pois: LocalResultPoi[]) => void
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void
onPolylinesSet?: (routes: Route[]) => void
onResultsHtmlSet?: (container: HTMLElement) => void
}
interface GeocoderResult {
point: Point
address: string
addressComponents: AddressComponent
surroundingPoi: LocalResultPoi[]
business: string
}
interface BusListResult {
keyword: string
city: string
moreResultsUrl: string
getNumBusList(): number
getBusListItem(i: number): BusListItem
}
interface RenderOptions {
map: Map
panel?: string | HTMLElement
selectFirstResult?: boolean
autoViewport?: boolean
highlightMode?: HighlightModes
}
type DrivingPolicy = number
interface AddressComponent {
streetNumber: string
street: string
district: string
city: string
province: string
}
interface BusLine {
name: string
startTime: string
endTime: string
company: string
getNumBusStations(): string
getBusStation(i: number): BusStation
getPath(): Point[]
getPolyline(): Polyline
}
interface LocalResult {
keyword: string
center: LocalResultPoi
radius: number
bounds: Bounds
city: string
moreResultsUrl: string
province: string
suggestions: string[]
getPoi(i: number): LocalResultPoi
getCurrentNumPois(): number
getNumPois(): number
getNumPages(): number
getPageIndex(): number
getCityList(): any[]
}
interface DrivingRouteResult {
policy: DrivingPolicy
city: string
moreResultsUrl: string
taxiFare: TaxiFare
getStart(): LocalResultPoi
getEnd(): LocalResultPoi
getNumPlans(): number
getPlan(i: number): RoutePlan
}
interface LocationOptions {
poiRadius?: number
numPois?: number
}
interface BusListItem {
name: string
}
interface LocalResultPoi {
title: string
point: Point
url: string
address: string
city: string
phoneNumber: string
postcode: string
type: PoiType
isAccurate: boolean
province: string
tags: string[]
detailUrl: string
}
interface TaxiFare {
day: TaxiFareDetail
night: TaxiFareDetail
distance: number
remark: string
}
class LocalCity {
constructor(opts?: LocalCityOptions)
get(callback: (result: LocalCityResult) => void): void
}
interface BusStation {
name: string
position: Point
}
type PoiType = number
interface TaxiFareDetail {
initialFare: number
unitFare: number
totalFare: number
}
interface LocalCityOptions {
renderOptions?: RenderOptions
}
class Autocomplete {
constructor(opts?: AutocompleteOptions)
show(): void
hide(): void
setTypes(types: string[]): void
setLocation(location: string | Map | Point): void
search(keywords: string): void
getResults(): AutocompleteResult
setInputValue(keyword: string): void
dispose(): void
onconfirm: (event: { type: string, target: any, item: any }) => void
onhighlight: (event: { type: string, target: any, fromitem: any, toitem: any }) => void
}
class TransitRoute {
constructor(location: Map | Point | string, opts?: TransitRouteOptions)
search(start: string | Point | LocalResultPoi, end: string | Point | LocalResultPoi): void
getResults(): TransitRouteResult
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setPageCapacity(capacity: number): void
setLocation(location: Map | Point | string): void
setPolicy(policy: TransitPolicy): void
setSearchCompleteCallback(callback: (results: TransitRouteResult) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setPolylinesSetCallback(callback: (lines: Line[], routes: Route[]) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
toString(): string
}
interface RoutePlan {
getNumRoutes(): number
getRoute(i: number): Route
getDistance(format?: boolean): string | number
getDuration(format?: boolean): string | number
getDragPois(): LocalResultPoi[]
}
interface LocalCityResult {
center: Point
level: number
name: string
}
interface AutocompleteOptions {
location?: string | Map | Point
types?: string[]
onSearchComplete?: (result: AutocompleteResult) => void
input?: string | HTMLElement
}
interface TransitRouteOptions {
renderOptions?: RenderOptions
policy?: TransitPolicy
pageCapacity?: number
onSearchComplete?: (result: TransitRouteResult) => void
onMarkersSet?: (pois: LocalResultPoi[], transfers: LocalResultPoi[]) => void
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void
onPolylinesSet?: (lines: Line[]) => void
onResultsHtmlSet?: (container: HTMLElement) => void
}
interface Route {
getNumRoutes(): number
getStep(i: number): Step
getDistance(format?: boolean): string | number
getIndex(): number
getPolyline(): Polyline
getPoints(): Point[]
getPath(): Point[]
getRouteType(): RouteType
}
class TrafficControl {
constructor()
setPanelOffset(offset: Size): void
show(): void
hide(): void
}
interface AutocompleteResultPoi {
province: string
City: string//wtf
district: string
street: string
streetNumber: string
business: string
}
type TransitPolicy = number
type RouteType = number
class Geolocation {
constructor()
getCurrentPosition(callback: (result: GeolocationResult) => void, opts?: PositionOptions): void
getStatus(): ServiceStatusCode
}
interface AutocompleteResult {
keyword: string
getPoi(i: number): AutocompleteResultPoi
getNumPois(): number
}
interface TransitRouteResult {
policy: TransitPolicy
city: string
moreResultsUrl: string
getStart(): LocalResultPoi
getEnd(): LocalResultPoi
getNumPlans(): number
getPlan(i: number): TransitRoutePlan
}
interface Step {
getPoint(): Point
getPosition(): Point
getIndex(): number
getDescription(includeHtml: boolean): string
getDistance(format?: boolean): string | number
}
interface GeolocationResult {
point: Point
accuracy: number
}
class Boundary {
constructor()
get(name: string, callback: (result: string[]) => void): void
}
interface TransitRoutePlan {
getNumLines(): number
getLine(i: number): Line
getNumRoutes(): number
getRoute(i: number): Route
getDistance(format?: boolean): string | number
getDuration(format?: boolean): string | number
getDescription(includeHtml: boolean): string
}
class WalkingRoute {
constructor(location: Map | Point | string, opts?: WalkingRouteOptions)
search(start: string | Point | LocalResultPoi, end: string | Point | LocalResultPoi): void
getResults(): WalkingRouteResult
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setLocation(location: Map | Point | string): void
setSearchCompleteCallback(callback: (result: WalkingRouteResult) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setPolylinesSetCallback(callback: (routes: Route[]) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
toString(): string
}
interface PositionOptions {
enableHighAccuracy?: boolean
timeout?: number
maximumAge?: number
}
interface Line {
title: string
type: LineType
getNumViaStops(): number
getGetOnStop(): LocalResultPoi
getGetOffStop(): LocalResultPoi
getPoints(): Point[]
getPath(): Point[]
getPolyline(): Polyline
getDistance(format?: boolean): string | number
}
interface WalkingRouteOptions {
renderOptions?: RenderOptions,
onSearchComplete?: (result: WalkingRouteResult) => void,
onMarkersSet?: (pois: LocalResultPoi[]) => void,
onPolylinesSet?: (routes: Route[]) => void,
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void,
onResultsHtmlSet?: (container: HTMLElement) => void
}
type HighlightModes = number
type ServiceStatusCode = number
}
declare const BMAP_LINE_TYPE_BUS: BMap.LineType
declare const BMAP_LINE_TYPE_SUBWAY: BMap.LineType
declare const BMAP_LINE_TYPE_FERRY: BMap.LineType
declare const BMAP_DRIVING_POLICY_LEAST_TIME: BMap.DrivingPolicy
declare const BMAP_DRIVING_POLICY_LEAST_DISTANCE: BMap.DrivingPolicy
declare const BMAP_DRIVING_POLICY_AVOID_HIGHWAYS: BMap.DrivingPolicy
declare const BMAP_POI_TYPE_NORMAL: BMap.PoiType
declare const BMAP_POI_TYPE_BUSSTOP: BMap.PoiType
declare const BMAP_POI_TYPE_SUBSTOP: BMap.PoiType
declare const BMAP_TRANSIT_POLICY_LEAST_TIME: BMap.TransitPolicy
declare const BMAP_TRANSIT_POLICY_LEAST_TRANSFER: BMap.TransitPolicy
declare const BMAP_TRANSIT_POLICY_LEAST_WALKING: BMap.TransitPolicy
declare const BMAP_TRANSIT_POLICY_AVOID_SUBWAYS: BMap.TransitPolicy
declare const BMAP_ROUTE_TYPE_DRIVING: BMap.RouteType
declare const BMAP_ROUTE_TYPE_WALKING: BMap.RouteType
declare const BMAP_HIGHLIGHT_STEP: BMap.HighlightModes
declare const BMAP_HIGHLIGHT_ROUTE: BMap.HighlightModes
declare const BMAP_STATUS_SUCCESS: BMap.ServiceStatusCode
declare const BMAP_STATUS_CITY_LIST: BMap.ServiceStatusCode
declare const BMAP_STATUS_UNKNOWN_LOCATION: BMap.ServiceStatusCode
declare const BMAP_STATUS_UNKNOWN_ROUTE: BMap.ServiceStatusCode
declare const BMAP_STATUS_INVALID_KEY: BMap.ServiceStatusCode
declare const BMAP_STATUS_INVALID_REQUEST: BMap.ServiceStatusCode
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
declare namespace BMap {
class LocalSearch {
constructor(location: Map | Point | string, opts?: LocalSearchOptions)
search(keyword: string | Array<string>, option?: Object): void
searchInBounds(keyword: string | Array<string>, bounds: Bounds, option?: Object): void
searchNearby(keyword: string | Array<string>, center: LocalResultPoi | string | Point, radius: number, option?: Object): void
getResults(): LocalResult | LocalResult[]
clearResults(): void
gotoPage(page: number): void
enableAutoViewport(): void
disableAutoViewport(): void
enableFirstResultSelection(): void
disableFirstResultSelection(): void
setLocation(location: Map | Point | string): void
setPageCapacity(capacity: number): void
getPageCapacity(): number
setSearchCompleteCallback(callback: (results: LocalResult | LocalResult[]) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
}
type LineType = number
interface WalkingRouteResult {
city: string
getStart(): LocalResultPoi
getEnd(): LocalResultPoi
getNumPlans(): number
getPlan(i: number): RoutePlan
}
class BusLineSearch {
constructor(location: Map | Point | string, opts?: BusLineSearchOptions)
getBusList(keyword: string): void
getBusLine(busLstItem: BusListItem): void
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setLocation(location: Map | Point | string): void
getStatus(): ServiceStatusCode
toString(): string
setGetBusListCompleteCallback(callback: (rs: BusListResult) => void): void
setGetBusLineCompleteCallback(callback: (rs: BusLine) => void): void
setBusListHtmlSetCallback(callback: (container: HTMLElement) => void): void
setBusLineHtmlSetCallback(callback: (container: HTMLElement) => void): void
setPolylinesSetCallback(callback: (ply: Polyline) => void): void
setMarkersSetCallback(callback: (markers: Marker[]) => void): void
}
interface LocalSearchOptions {
renderOptions?: RenderOptions
onMarkersSet?: (pois: LocalResultPoi[]) => void
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void
onResultsHtmlSet?: (container: HTMLElement) => void
pageCapacity?: number
onSearchComplete?: (results: LocalResult[]) => void
}
class DrivingRoute {
constructor(location: Map | Point | string, opts?: DrivingRouteOptions)
search(start: string | Point | LocalResultPoi, end: string | Point | LocalResultPoi, opts?: Object): void
getResults(): DrivingRouteResult
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setLocation(location: Map | Point | string): void
setPolicy(policy: DrivingPolicy): void
setSearchCompleteCallback(callback: (results: DrivingRouteResult) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setPolylinesSetCallback(callback: (routes: Route[]) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
toString(): string
}
class Geocoder {
constructor()
getPoint(address: string, callback: (point: Point) => void, city: string): void
getLocation(point: Point, callback: (result: GeocoderResult) => void, opts?: LocationOptions): void
}
interface BusLineSearchOptions {
renderOptions?: RenderOptions
onGetBusListComplete?: (rs: BusListResult) => void
onGetBusLineComplete?: (rs: BusLine) => void
onBusListHtmlSet?: (container: HTMLElement) => void
onBusLineHtmlSet?: (container: HTMLElement) => void
onPolylinesSet?: (ply: Polyline) => void
onMarkersSet?: (sts: Marker[]) => void
}
interface CustomData {
geotableId: number
tags: string
filter: string
}
interface DrivingRouteOptions {
renderOptions?: RenderOptions
policy?: DrivingPolicy
onSearchComplete?: (results: DrivingRouteResult) => void
onMarkersSet?: (pois: LocalResultPoi[]) => void
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void
onPolylinesSet?: (routes: Route[]) => void
onResultsHtmlSet?: (container: HTMLElement) => void
}
interface GeocoderResult {
point: Point
address: string
addressComponents: AddressComponent
surroundingPoi: LocalResultPoi[]
business: string
}
interface BusListResult {
keyword: string
city: string
moreResultsUrl: string
getNumBusList(): number
getBusListItem(i: number): BusListItem
}
interface RenderOptions {
map: Map
panel?: string | HTMLElement
selectFirstResult?: boolean
autoViewport?: boolean
highlightMode?: HighlightModes
}
type DrivingPolicy = number
interface AddressComponent {
streetNumber: string
street: string
district: string
city: string
province: string
}
interface BusLine {
name: string
startTime: string
endTime: string
company: string
getNumBusStations(): string
getBusStation(i: number): BusStation
getPath(): Point[]
getPolyline(): Polyline
}
interface LocalResult {
keyword: string
center: LocalResultPoi
radius: number
bounds: Bounds
city: string
moreResultsUrl: string
province: string
suggestions: string[]
getPoi(i: number): LocalResultPoi
getCurrentNumPois(): number
getNumPois(): number
getNumPages(): number
getPageIndex(): number
getCityList(): any[]
}
interface DrivingRouteResult {
policy: DrivingPolicy
city: string
moreResultsUrl: string
taxiFare: TaxiFare
getStart(): LocalResultPoi
getEnd(): LocalResultPoi
getNumPlans(): number
getPlan(i: number): RoutePlan
}
interface LocationOptions {
poiRadius?: number
numPois?: number
}
interface BusListItem {
name: string
}
interface LocalResultPoi {
title: string
point: Point
url: string
address: string
city: string
phoneNumber: string
postcode: string
type: PoiType
isAccurate: boolean
province: string
tags: string[]
detailUrl: string
}
interface TaxiFare {
day: TaxiFareDetail
night: TaxiFareDetail
distance: number
remark: string
}
class LocalCity {
constructor(opts?: LocalCityOptions)
get(callback: (result: LocalCityResult) => void): void
}
interface BusStation {
name: string
position: Point
}
type PoiType = number
interface TaxiFareDetail {
initialFare: number
unitFare: number
totalFare: number
}
interface LocalCityOptions {
renderOptions?: RenderOptions
}
class Autocomplete {
constructor(opts?: AutocompleteOptions)
show(): void
hide(): void
setTypes(types: string[]): void
setLocation(location: string | Map | Point): void
search(keywords: string): void
getResults(): AutocompleteResult
setInputValue(keyword: string): void
dispose(): void
onconfirm: (event: { type: string, target: any, item: any }) => void
onhighlight: (event: { type: string, target: any, fromitem: any, toitem: any }) => void
}
class TransitRoute {
constructor(location: Map | Point | string, opts?: TransitRouteOptions)
search(start: string | Point | LocalResultPoi, end: string | Point | LocalResultPoi): void
getResults(): TransitRouteResult
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setPageCapacity(capacity: number): void
setLocation(location: Map | Point | string): void
setPolicy(policy: TransitPolicy): void
setSearchCompleteCallback(callback: (results: TransitRouteResult) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setPolylinesSetCallback(callback: (lines: Line[], routes: Route[]) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
toString(): string
}
interface RoutePlan {
getNumRoutes(): number
getRoute(i: number): Route
getDistance(format?: boolean): string | number
getDuration(format?: boolean): string | number
getDragPois(): LocalResultPoi[]
}
interface LocalCityResult {
center: Point
level: number
name: string
}
interface AutocompleteOptions {
location?: string | Map | Point
types?: string[]
onSearchComplete?: (result: AutocompleteResult) => void
input?: string | HTMLElement
}
interface TransitRouteOptions {
renderOptions?: RenderOptions
policy?: TransitPolicy
pageCapacity?: number
onSearchComplete?: (result: TransitRouteResult) => void
onMarkersSet?: (pois: LocalResultPoi[], transfers: LocalResultPoi[]) => void
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void
onPolylinesSet?: (lines: Line[]) => void
onResultsHtmlSet?: (container: HTMLElement) => void
}
interface Route {
getNumRoutes(): number
getStep(i: number): Step
getDistance(format?: boolean): string | number
getIndex(): number
getPolyline(): Polyline
getPoints(): Point[]
getPath(): Point[]
getRouteType(): RouteType
}
class TrafficControl {
constructor()
setPanelOffset(offset: Size): void
show(): void
hide(): void
}
interface AutocompleteResultPoi {
province: string
City: string//wtf
district: string
street: string
streetNumber: string
business: string
}
type TransitPolicy = number
type RouteType = number
class Geolocation {
constructor()
getCurrentPosition(callback: (result: GeolocationResult) => void, opts?: PositionOptions): void
getStatus(): ServiceStatusCode
}
interface AutocompleteResult {
keyword: string
getPoi(i: number): AutocompleteResultPoi
getNumPois(): number
}
interface TransitRouteResult {
policy: TransitPolicy
city: string
moreResultsUrl: string
getStart(): LocalResultPoi
getEnd(): LocalResultPoi
getNumPlans(): number
getPlan(i: number): TransitRoutePlan
}
interface Step {
getPoint(): Point
getPosition(): Point
getIndex(): number
getDescription(includeHtml: boolean): string
getDistance(format?: boolean): string | number
}
interface GeolocationResult {
point: Point
accuracy: number
}
class Boundary {
constructor()
get(name: string, callback: (result: string[]) => void): void
}
interface TransitRoutePlan {
getNumLines(): number
getLine(i: number): Line
getNumRoutes(): number
getRoute(i: number): Route
getDistance(format?: boolean): string | number
getDuration(format?: boolean): string | number
getDescription(includeHtml: boolean): string
}
class WalkingRoute {
constructor(location: Map | Point | string, opts?: WalkingRouteOptions)
search(start: string | Point | LocalResultPoi, end: string | Point | LocalResultPoi): void
getResults(): WalkingRouteResult
clearResults(): void
enableAutoViewport(): void
disableAutoViewport(): void
setLocation(location: Map | Point | string): void
setSearchCompleteCallback(callback: (result: WalkingRouteResult) => void): void
setMarkersSetCallback(callback: (pois: LocalResultPoi[]) => void): void
setInfoHtmlSetCallback(callback: (poi: LocalResultPoi, html: HTMLElement) => void): void
setPolylinesSetCallback(callback: (routes: Route[]) => void): void
setResultsHtmlSetCallback(callback: (container: HTMLElement) => void): void
getStatus(): ServiceStatusCode
toString(): string
}
interface PositionOptions {
enableHighAccuracy?: boolean
timeout?: number
maximumAge?: number
}
interface Line {
title: string
type: LineType
getNumViaStops(): number
getGetOnStop(): LocalResultPoi
getGetOffStop(): LocalResultPoi
getPoints(): Point[]
getPath(): Point[]
getPolyline(): Polyline
getDistance(format?: boolean): string | number
}
interface WalkingRouteOptions {
renderOptions?: RenderOptions,
onSearchComplete?: (result: WalkingRouteResult) => void,
onMarkersSet?: (pois: LocalResultPoi[]) => void,
onPolylinesSet?: (routes: Route[]) => void,
onInfoHtmlSet?: (poi: LocalResultPoi, html: HTMLElement) => void,
onResultsHtmlSet?: (container: HTMLElement) => void
}
type HighlightModes = number
type ServiceStatusCode = number
}
declare const BMAP_LINE_TYPE_BUS: BMap.LineType
declare const BMAP_LINE_TYPE_SUBWAY: BMap.LineType
declare const BMAP_LINE_TYPE_FERRY: BMap.LineType
declare const BMAP_DRIVING_POLICY_LEAST_TIME: BMap.DrivingPolicy
declare const BMAP_DRIVING_POLICY_LEAST_DISTANCE: BMap.DrivingPolicy
declare const BMAP_DRIVING_POLICY_AVOID_HIGHWAYS: BMap.DrivingPolicy
declare const BMAP_POI_TYPE_NORMAL: BMap.PoiType
declare const BMAP_POI_TYPE_BUSSTOP: BMap.PoiType
declare const BMAP_POI_TYPE_SUBSTOP: BMap.PoiType
declare const BMAP_TRANSIT_POLICY_LEAST_TIME: BMap.TransitPolicy
declare const BMAP_TRANSIT_POLICY_LEAST_TRANSFER: BMap.TransitPolicy
declare const BMAP_TRANSIT_POLICY_LEAST_WALKING: BMap.TransitPolicy
declare const BMAP_TRANSIT_POLICY_AVOID_SUBWAYS: BMap.TransitPolicy
declare const BMAP_ROUTE_TYPE_DRIVING: BMap.RouteType
declare const BMAP_ROUTE_TYPE_WALKING: BMap.RouteType
declare const BMAP_HIGHLIGHT_STEP: BMap.HighlightModes
declare const BMAP_HIGHLIGHT_ROUTE: BMap.HighlightModes
declare const BMAP_STATUS_SUCCESS: BMap.ServiceStatusCode
declare const BMAP_STATUS_CITY_LIST: BMap.ServiceStatusCode
declare const BMAP_STATUS_UNKNOWN_LOCATION: BMap.ServiceStatusCode
declare const BMAP_STATUS_UNKNOWN_ROUTE: BMap.ServiceStatusCode
declare const BMAP_STATUS_INVALID_KEY: BMap.ServiceStatusCode
declare const BMAP_STATUS_INVALID_REQUEST: BMap.ServiceStatusCode

View File

@@ -1,61 +1,61 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
/// <reference path="./baidumap.overlay.d.ts" />
declare namespace BMap {
class PushpinTool {
constructor(map: Map, opts?: PushpinToolOptions)
open(): boolean
close(): boolean
setIcon(icon: Icon): Icon
getIcon(): Icon
setCursor(cursor: string): string
getCursor(): string
toString(): string
onmarkend: (event: { type: string, target: any, marker: Marker }) => void
}
interface PushpinToolOptions {
icon?: Icon
cursor?: string
followText?: string
}
class DistanceTool {
constructor(map: Map)
open(): boolean
close(): void
toString(): string
ondrawend: (event: { type: string, target: any, points: Point[], polylines: Polyline[], distance: number }) => void
}
class DragAndZoomTool {
constructor(map: Map, opts?: DragAndZoomToolOptions)
open(): boolean
close(): void
toString(): string
ondrawend: (event: { type: string, target: any, bounds: Bounds[] }) => void
}
interface DragAndZoomToolOptions {
zoomType?: ZoomType,
autoClose?: boolean,
followText?: string
}
type ZoomType = number
}
declare const BMAP_ZOOM_IN: BMap.ZoomType
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
/// <reference path="./baidumap.overlay.d.ts" />
declare namespace BMap {
class PushpinTool {
constructor(map: Map, opts?: PushpinToolOptions)
open(): boolean
close(): boolean
setIcon(icon: Icon): Icon
getIcon(): Icon
setCursor(cursor: string): string
getCursor(): string
toString(): string
onmarkend: (event: { type: string, target: any, marker: Marker }) => void
}
interface PushpinToolOptions {
icon?: Icon
cursor?: string
followText?: string
}
class DistanceTool {
constructor(map: Map)
open(): boolean
close(): void
toString(): string
ondrawend: (event: { type: string, target: any, points: Point[], polylines: Polyline[], distance: number }) => void
}
class DragAndZoomTool {
constructor(map: Map, opts?: DragAndZoomToolOptions)
open(): boolean
close(): void
toString(): string
ondrawend: (event: { type: string, target: any, bounds: Bounds[] }) => void
}
interface DragAndZoomToolOptions {
zoomType?: ZoomType,
autoClose?: boolean,
followText?: string
}
type ZoomType = number
}
declare const BMAP_ZOOM_IN: BMap.ZoomType
declare const BMAP_ZOOM_OUT: BMap.ZoomType

View File

@@ -1,28 +1,28 @@
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.control.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
/// <reference path="./baidumap.maplayer.d.ts" />
/// <reference path="./baidumap.maptype.d.ts" />
/// <reference path="./baidumap.overlay.d.ts" />
/// <reference path="./baidumap.panorama.d.ts" />
/// <reference path="./baidumap.rightmenu.d.ts" />
/// <reference path="./baidumap.service.d.ts" />
/// <reference path="./baidumap.tools.d.ts" />
// Type definitions for BaiduMap v2.0
// Project: http://lbsyun.baidu.com/index.php?title=jspopular
// Definitions by: Codemonk <http://www.youxianxueche.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* *****************************************************************************
Copyright [Codemonk] [Codemonk@live.cn]
This project is licensed under the MIT license.
Copyrights are respective of each contributor listed at the beginning of each definition file.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************** */
/// <reference path="./baidumap.base.d.ts" />
/// <reference path="./baidumap.control.d.ts" />
/// <reference path="./baidumap.core.d.ts" />
/// <reference path="./baidumap.maplayer.d.ts" />
/// <reference path="./baidumap.maptype.d.ts" />
/// <reference path="./baidumap.overlay.d.ts" />
/// <reference path="./baidumap.panorama.d.ts" />
/// <reference path="./baidumap.rightmenu.d.ts" />
/// <reference path="./baidumap.service.d.ts" />
/// <reference path="./baidumap.tools.d.ts" />

View File

@@ -0,0 +1,15 @@
{
"extends": "dtslint/dt.json",
"rules": {
// All are TODOs
"eofline": false,
"comment-format": false,
"dt-header": false,
"max-line-length": false,
"member-access": false,
"no-namespace": false,
"no-useless-files": false,
"no-var": false,
"semicolon": false
}
}

View File

@@ -81,7 +81,7 @@ declare namespace BittorrentProtocol {
// TODO: bitfield is a bitfield instance
on(event: 'bitfield', listener: (bitfield: any) => void): this;
on(event: string | 'keep-alive' | 'choke' | 'unchoke' | 'interested' | 'uninterested' | 'timeout', listener: () => void): this;
on(event: 'keep-alive' | 'choke' | 'unchoke' | 'interested' | 'uninterested' | 'timeout', listener: () => void): this;
on(event: 'upload' | 'have' | 'download' | 'port', listener: (length: number) => void): this;
on(event: 'handshake', listener: (infoHash: string, peerId: string, extensions: Extension[]) => void): this;
on(event: 'request', listener: (index: number, offset: number, length: number, respond: () => void) => void): this;
@@ -89,6 +89,7 @@ declare namespace BittorrentProtocol {
on(event: 'cancel', listener: (index: number, offset: number, length: number) => void): this;
on(event: 'extended', listener: (ext: 'handshake' | string, buf: any) => void): void;
on(event: 'unknownmessage', listener: (buffer: Buffer) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
}

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/spion/blue-tape
// Definitions by: Haoqun Jiang <https://github.com/sodatea>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/petkaantonov/bluebird
// Definitions by: d-ph <https://github.com/d-ph>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/*
* 1. Why use `bluebird-global` instead of `bluebird`?
@@ -117,19 +118,19 @@ declare global {
*
* @todo Duplication of code is never ideal. See whether there's a better way of achieving this.
*/
catch(predicate: (error: any) => boolean, onReject: (error: any) => T | Bluebird.Thenable<T> | void | Bluebird.Thenable<void>): Bluebird<T>;
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | T>;
catch<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => T | Bluebird.Thenable<T> | void | Bluebird.Thenable<void>): Bluebird<T>;
catch<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | Bluebird.Thenable<U>): Bluebird<U | T>;
catch(predicate: Object, onReject: (error: any) => T | Bluebird.Thenable<T> | void | Bluebird.Thenable<void>): Bluebird<T>;
catch<U>(predicate: Object, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | T>;
catch(predicate: (error: any) => boolean, onReject: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Bluebird<T>;
catch<U>(predicate: (error: any) => boolean, onReject: (error: any) => U | PromiseLike<U>): Bluebird<U | T>;
catch<E extends Error>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => T | PromiseLike<T> | void | PromiseLike<void>): Bluebird<T>;
catch<E extends Error, U>(ErrorClass: new (...args: any[]) => E, onReject: (error: E) => U | PromiseLike<U>): Bluebird<U | T>;
catch(predicate: Object, onReject: (error: any) => T | PromiseLike<T> | void | PromiseLike<void>): Bluebird<T>;
catch<U>(predicate: Object, onReject: (error: any) => U | PromiseLike<U>): Bluebird<U | T>;
}
/*
* Patch all static methods and the constructor
*/
interface PromiseConstructor {
new <T>(callback: (resolve: (thenableOrResult?: T | Bluebird.Thenable<T>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void): Promise<T>;
new <T>(callback: (resolve: (thenableOrResult?: T | PromiseLike<T>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void): Promise<T>;
// all: typeof Bluebird.all;
any: typeof Bluebird.any;

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/jut-io/bluebird-retry
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="bluebird" />

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/petkaantonov/bluebird
// Definitions by: Leonard Hecker <https://github.com/lhecker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/*!
* The code following this comment originates from:
@@ -34,30 +35,29 @@
* THE SOFTWARE.
*/
declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R> {
declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
/**
* Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise.
* If promise cancellation is enabled, passed in function will receive one more function argument `onCancel` that allows to register an optional cancellation callback.
*/
constructor(callback: (resolve: (thenableOrResult?: R | Bluebird.Thenable<R>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void);
constructor(callback: (resolve: (thenableOrResult?: R | PromiseLike<R>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void);
/**
* Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise.
*/
then<U1, U2>(onFulfill: (value: R) => U1 | Bluebird.Thenable<U1>, onReject: (error: any) => U2 | Bluebird.Thenable<U2>): Bluebird<U1 | U2>;
then<U>(onFulfill: (value: R) => U | Bluebird.Thenable<U>, onReject: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U>;
then<U>(onFulfill: (value: R) => U | Bluebird.Thenable<U>): Bluebird<U>;
then(): Bluebird<R>;
// Based on PromiseLike.then, but returns a Bluebird instance.
then<U>(onFulfill?: (value: R) => U | Bluebird.Thenable<U>, onReject?: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U>; // For simpler signature help.
then<TResult1 = R, TResult2 = never>(onfulfilled?: ((value: R) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Bluebird<TResult1 | TResult2>;
/**
* This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler.
*
* Alias `.caught();` for compatibility with earlier ECMAScript version.
*/
catch(onReject?: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
caught(onReject?: (error: any) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>): Bluebird<R>;
catch<U>(onReject?: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
caught<U>(onReject?: (error: any) => U | Bluebird.Thenable<U>): Bluebird<U | R>;
catch(onReject?: (error: any) => R | PromiseLike<R> | void | PromiseLike<void>): Bluebird<R>;
caught(onReject?: (error: any) => R | PromiseLike<R> | void | PromiseLike<void>): Bluebird<R>;
catch<U>(onReject?: (error: any) => U | PromiseLike<U>): Bluebird<U | R>;
caught<U>(onReject?: (error: any) => U | PromiseLike<U>): Bluebird<U | R>;
/**
* This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called.
@@ -74,7 +74,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4 | E5) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2 | E3 | E4 | E5) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
caught<E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error, E5 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
@@ -82,7 +82,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4 | E5) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2 | E3 | E4 | E5) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
catch<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error, E5 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
@@ -90,7 +90,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | PromiseLike<U>,
): Bluebird<U | R>;
caught<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error, E5 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
@@ -98,7 +98,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | PromiseLike<U>,
): Bluebird<U | R>;
catch<E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error>(
@@ -106,106 +106,106 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2 | E3 | E4) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
caught<E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2 | E3 | E4) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
catch<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3 | E4) => U | PromiseLike<U>,
): Bluebird<U | R>;
caught<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3 | E4) => U | PromiseLike<U>,
): Bluebird<U | R>;
catch<E1 extends Error, E2 extends Error, E3 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2 | E3) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
caught<E1 extends Error, E2 extends Error, E3 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2 | E3) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
catch<U, E1 extends Error, E2 extends Error, E3 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3) => U | PromiseLike<U>,
): Bluebird<U | R>;
caught<U, E1 extends Error, E2 extends Error, E3 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3) => U | PromiseLike<U>,
): Bluebird<U | R>;
catch<E1 extends Error, E2 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
caught<E1 extends Error, E2 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1 | E2) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
catch<U, E1 extends Error, E2 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2) => U | PromiseLike<U>,
): Bluebird<U | R>;
caught<U, E1 extends Error, E2 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2) => U | PromiseLike<U>,
): Bluebird<U | R>;
catch<E1 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
onReject: (error: E1) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
caught<E1 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
onReject: (error: E1) => R | Bluebird.Thenable<R> | void | Bluebird.Thenable<void>,
onReject: (error: E1) => R | PromiseLike<R> | void | PromiseLike<void>,
): Bluebird<R>;
catch<U, E1 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
onReject: (error: E1) => U | Bluebird.Thenable<U>,
onReject: (error: E1) => U | PromiseLike<U>,
): Bluebird<U | R>;
caught<U, E1 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
onReject: (error: E1) => U | Bluebird.Thenable<U>,
onReject: (error: E1) => U | PromiseLike<U>,
): Bluebird<U | R>;
/**
* Like `.catch` but instead of catching all types of exceptions, it only catches those that don't originate from thrown errors but rather from explicit rejections.
*/
error<U>(onReject: (reason: any) => U | Bluebird.Thenable<U>): Bluebird<U>;
error<U>(onReject: (reason: any) => U | PromiseLike<U>): Bluebird<U>;
/**
* Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler.
*
* Alias `.lastly();` for compatibility with earlier ECMAScript version.
*/
finally<U>(handler: () => U | Bluebird.Thenable<U>): Bluebird<R>;
finally<U>(handler: () => U | PromiseLike<U>): Bluebird<R>;
lastly<U>(handler: () => U | Bluebird.Thenable<U>): Bluebird<R>;
lastly<U>(handler: () => U | PromiseLike<U>): Bluebird<R>;
/**
* Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise.
@@ -215,19 +215,19 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
/**
* Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error.
*/
done<U>(onFulfilled?: (value: R) => U | Bluebird.Thenable<U>, onRejected?: (error: any) => U | Bluebird.Thenable<U>): void;
done<U>(onFulfilled?: (value: R) => U | PromiseLike<U>, onRejected?: (error: any) => U | PromiseLike<U>): void;
/**
* Like `.finally()`, but not called for rejections.
*/
tap<U>(onFulFill: (value: R) => Bluebird.Thenable<U>): Bluebird<R>;
tap<U>(onFulFill: (value: R) => PromiseLike<U>): Bluebird<R>;
tap<U>(onFulfill: (value: R) => U): Bluebird<R>;
/**
* Like `.catch()` but rethrows the error
* TODO: disallow non-objects
*/
tapCatch<U>(onReject: (error?: any) => U | Bluebird.Thenable<U>): Bluebird<R>;
tapCatch<U>(onReject: (error?: any) => U | PromiseLike<U>): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error, E5 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
@@ -235,29 +235,29 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
filter5: (new (...args: any[]) => E5) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3 | E4 | E5) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error, E3 extends Error, E4 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
filter4: (new (...args: any[]) => E4) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3 | E4) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3 | E4) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error, E3 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
filter3: (new (...args: any[]) => E3) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2 | E3) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2 | E3) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error, E2 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
filter2: (new (...args: any[]) => E2) | ((error: any) => boolean) | Object,
onReject: (error: E1 | E2) => U | Bluebird.Thenable<U>,
onReject: (error: E1 | E2) => U | PromiseLike<U>,
): Bluebird<R>;
tapCatch<U, E1 extends Error>(
filter1: (new (...args: any[]) => E1) | ((error: any) => boolean) | Object,
onReject: (error: E1) => U | Bluebird.Thenable<U>,
onReject: (error: E1) => U | PromiseLike<U>,
): Bluebird<R>;
/**
@@ -488,7 +488,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
/**
* Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers.
*/
spread<U, W>(fulfilledHandler: (...values: W[]) => U | Bluebird.Thenable<U>): Bluebird<U>;
spread<U, W>(fulfilledHandler: (...values: W[]) => U | PromiseLike<U>): Bluebird<U>;
spread<U>(fulfilledHandler: Function): Bluebird<U>;
/**
@@ -525,29 +525,29 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* Same as calling `Bluebird.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
*/
// TODO type inference from array-resolving promise?
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
map<Q, U>(mapper: (item: Q, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
/**
* Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
*/
// TODO type inference from array-resolving promise?
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, initialValue?: U): Bluebird<U>;
reduce<Q, U>(reducer: (memo: U, item: Q, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Bluebird<U>;
/**
* Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
*/
// TODO type inference from array-resolving promise?
filter<U>(filterer: (item: U, index: number, arrayLength: number) => boolean | Bluebird.Thenable<boolean>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
filter<U>(filterer: (item: U, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
/**
* Same as calling ``Bluebird.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
*/
each<R, U>(iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>): Bluebird<R[]>;
each<R, U>(iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<R[]>;
/**
* Same as calling ``Bluebird.mapSeries(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
*/
mapSeries<R, U>(iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>): Bluebird<U[]>;
mapSeries<R, U>(iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<U[]>;
/**
* Cancel this `promise`. Will not do anything if this promise is already settled or if the cancellation feature has not been enabled
@@ -568,8 +568,8 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
*
* Alias for `attempt();` for compatibility with earlier ECMAScript version.
*/
static try<R>(fn: () => R | Bluebird.Thenable<R>): Bluebird<R>;
static attempt<R>(fn: () => R | Bluebird.Thenable<R>): Bluebird<R>;
static try<R>(fn: () => R | PromiseLike<R>): Bluebird<R>;
static attempt<R>(fn: () => R | PromiseLike<R>): Bluebird<R>;
/**
* Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function.
@@ -581,7 +581,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state.
*/
static resolve(): Bluebird<void>;
static resolve<R>(value: R | Bluebird.Thenable<R>): Bluebird<R>;
static resolve<R>(value: R | PromiseLike<R>): Bluebird<R>;
/**
* Create a promise that is rejected with the given `reason`.
@@ -597,7 +597,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
/**
* Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable.
*/
static cast<R>(value: R | Bluebird.Thenable<R>): Bluebird<R>;
static cast<R>(value: R | PromiseLike<R>): Bluebird<R>;
/**
* Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`.
@@ -619,7 +619,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* If value is a promise, the delay will start counting down when it is fulfilled and the returned
* promise will be fulfilled with the fulfillment value of the value promise.
*/
static delay<R>(ms: number, value: R | Bluebird.Thenable<R>): Bluebird<R>;
static delay<R>(ms: number, value: R | PromiseLike<R>): Bluebird<R>;
static delay(ms: number): Bluebird<void>;
/**
@@ -671,13 +671,13 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
*/
// TODO enable more overloads
// array with promises of different types
static all<T1, T2, T3, T4, T5>(values: [Bluebird.Thenable<T1> | T1, Bluebird.Thenable<T2> | T2, Bluebird.Thenable<T3> | T3, Bluebird.Thenable<T4> | T4, Bluebird.Thenable<T5> | T5]): Bluebird<[T1, T2, T3, T4, T5]>;
static all<T1, T2, T3, T4>(values: [Bluebird.Thenable<T1> | T1, Bluebird.Thenable<T2> | T2, Bluebird.Thenable<T3> | T3, Bluebird.Thenable<T4> | T4]): Bluebird<[T1, T2, T3, T4]>;
static all<T1, T2, T3>(values: [Bluebird.Thenable<T1> | T1, Bluebird.Thenable<T2> | T2, Bluebird.Thenable<T3> | T3]): Bluebird<[T1, T2, T3]>;
static all<T1, T2>(values: [Bluebird.Thenable<T1> | T1, Bluebird.Thenable<T2> | T2]): Bluebird<[T1, T2]>;
static all<T1>(values: [Bluebird.Thenable<T1> | T1]): Bluebird<[T1]>;
static all<T1, T2, T3, T4, T5>(values: [PromiseLike<T1> | T1, PromiseLike<T2> | T2, PromiseLike<T3> | T3, PromiseLike<T4> | T4, PromiseLike<T5> | T5]): Bluebird<[T1, T2, T3, T4, T5]>;
static all<T1, T2, T3, T4>(values: [PromiseLike<T1> | T1, PromiseLike<T2> | T2, PromiseLike<T3> | T3, PromiseLike<T4> | T4]): Bluebird<[T1, T2, T3, T4]>;
static all<T1, T2, T3>(values: [PromiseLike<T1> | T1, PromiseLike<T2> | T2, PromiseLike<T3> | T3]): Bluebird<[T1, T2, T3]>;
static all<T1, T2>(values: [PromiseLike<T1> | T1, PromiseLike<T2> | T2]): Bluebird<[T1, T2]>;
static all<T1>(values: [PromiseLike<T1> | T1]): Bluebird<[T1]>;
// array with values
static all<R>(values: Bluebird.Thenable<(Bluebird.Thenable<R> | R)[]> | (Bluebird.Thenable<R> | R)[]): Bluebird<R[]>;
static all<R>(values: PromiseLike<(PromiseLike<R> | R)[]> | (PromiseLike<R> | R)[]): Bluebird<R[]>;
/**
* Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason.
@@ -695,14 +695,14 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
/**
* Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly.
*/
static any<R>(values: Bluebird.Thenable<(Bluebird.Thenable<R> | R)[]> | (Bluebird.Thenable<R> | R)[]): Bluebird<R>;
static any<R>(values: PromiseLike<(PromiseLike<R> | R)[]> | (PromiseLike<R> | R)[]): Bluebird<R>;
/**
* Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value.
*
* **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending.
*/
static race<R>(values: Bluebird.Thenable<(Bluebird.Thenable<R> | R)[]> | (Bluebird.Thenable<R> | R)[]): Bluebird<R>;
static race<R>(values: PromiseLike<(PromiseLike<R> | R)[]> | (PromiseLike<R> | R)[]): Bluebird<R>;
/**
* Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution.
@@ -712,11 +712,11 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* *The original array is not modified.*
*/
// promise of array with promises of value
static some<R>(values: Bluebird.Thenable<Bluebird.Thenable<R>[]>, count: number): Bluebird<R[]>;
static some<R>(values: PromiseLike<PromiseLike<R>[]>, count: number): Bluebird<R[]>;
// promise of array with values
static some<R>(values: Bluebird.Thenable<R[]>, count: number): Bluebird<R[]>;
static some<R>(values: PromiseLike<R[]>, count: number): Bluebird<R[]>;
// array with promises of value
static some<R>(values: Bluebird.Thenable<R>[], count: number): Bluebird<R[]>;
static some<R>(values: PromiseLike<R>[], count: number): Bluebird<R[]>;
// array with values
static some<R>(values: R[], count: number): Bluebird<R[]>;
@@ -729,15 +729,15 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
*
* Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply
*/
static join<R, A1>(arg1: A1 | Bluebird.Thenable<A1>, handler: (arg1: A1) => R | Bluebird.Thenable<R>): Bluebird<R>;
static join<R, A1, A2>(arg1: A1 | Bluebird.Thenable<A1>, arg2: A2 | Bluebird.Thenable<A2>, handler: (arg1: A1, arg2: A2) => R | Bluebird.Thenable<R>): Bluebird<R>;
static join<R, A1, A2, A3>(arg1: A1 | Bluebird.Thenable<A1>, arg2: A2 | Bluebird.Thenable<A2>, arg3: A3 | Bluebird.Thenable<A3>, handler: (arg1: A1, arg2: A2, arg3: A3) => R | Bluebird.Thenable<R>): Bluebird<R>;
static join<R, A1, A2, A3, A4>(arg1: A1 | Bluebird.Thenable<A1>, arg2: A2 | Bluebird.Thenable<A2>, arg3: A3 | Bluebird.Thenable<A3>, arg4: A4 | Bluebird.Thenable<A4>, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | Bluebird.Thenable<R>): Bluebird<R>;
static join<R, A1, A2, A3, A4, A5>(arg1: A1 | Bluebird.Thenable<A1>, arg2: A2 | Bluebird.Thenable<A2>, arg3: A3 | Bluebird.Thenable<A3>, arg4: A4 | Bluebird.Thenable<A4>, arg5: A5 | Bluebird.Thenable<A5>, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | Bluebird.Thenable<R>): Bluebird<R>;
static join<R, A1>(arg1: A1 | PromiseLike<A1>, handler: (arg1: A1) => R | PromiseLike<R>): Bluebird<R>;
static join<R, A1, A2>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, handler: (arg1: A1, arg2: A2) => R | PromiseLike<R>): Bluebird<R>;
static join<R, A1, A2, A3>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, arg3: A3 | PromiseLike<A3>, handler: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike<R>): Bluebird<R>;
static join<R, A1, A2, A3, A4>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, arg3: A3 | PromiseLike<A3>, arg4: A4 | PromiseLike<A4>, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | PromiseLike<R>): Bluebird<R>;
static join<R, A1, A2, A3, A4, A5>(arg1: A1 | PromiseLike<A1>, arg2: A2 | PromiseLike<A2>, arg3: A3 | PromiseLike<A3>, arg4: A4 | PromiseLike<A4>, arg5: A5 | PromiseLike<A5>, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | PromiseLike<R>): Bluebird<R>;
// variadic array
/** @deprecated use .all instead */
static join<R>(...values: (R | Bluebird.Thenable<R>)[]): Bluebird<R[]>;
static join<R>(...values: (R | PromiseLike<R>)[]): Bluebird<R[]>;
/**
* Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
@@ -747,16 +747,16 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* *The original array is not modified.*
*/
// promise of array with promises of value
static map<R, U>(values: Bluebird.Thenable<Bluebird.Thenable<R>[]>, mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
static map<R, U>(values: PromiseLike<PromiseLike<R>[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
// promise of array with values
static map<R, U>(values: Bluebird.Thenable<R[]>, mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
static map<R, U>(values: PromiseLike<R[]>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
// array with promises of value
static map<R, U>(values: Bluebird.Thenable<R>[], mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
static map<R, U>(values: PromiseLike<R>[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
// array with values
static map<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
static map<R, U>(values: R[], mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>, options?: Bluebird.ConcurrencyOption): Bluebird<U[]>;
/**
* Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
@@ -766,16 +766,16 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.*
*/
// promise of array with promises of value
static reduce<R, U>(values: Bluebird.Thenable<Bluebird.Thenable<R>[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, initialValue?: U): Bluebird<U>;
static reduce<R, U>(values: PromiseLike<PromiseLike<R>[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Bluebird<U>;
// promise of array with values
static reduce<R, U>(values: Bluebird.Thenable<R[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, initialValue?: U): Bluebird<U>;
static reduce<R, U>(values: PromiseLike<R[]>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Bluebird<U>;
// array with promises of value
static reduce<R, U>(values: Bluebird.Thenable<R>[], reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, initialValue?: U): Bluebird<U>;
static reduce<R, U>(values: PromiseLike<R>[], reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Bluebird<U>;
// array with values
static reduce<R, U>(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>, initialValue?: U): Bluebird<U>;
static reduce<R, U>(values: R[], reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike<U>, initialValue?: U): Bluebird<U>;
/**
* Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well.
@@ -785,16 +785,16 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* *The original array is not modified.
*/
// promise of array with promises of value
static filter<R>(values: Bluebird.Thenable<Bluebird.Thenable<R>[]>, filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
static filter<R>(values: PromiseLike<PromiseLike<R>[]>, filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
// promise of array with values
static filter<R>(values: Bluebird.Thenable<R[]>, filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
static filter<R>(values: PromiseLike<R[]>, filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
// array with promises of value
static filter<R>(values: Bluebird.Thenable<R>[], filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
static filter<R>(values: PromiseLike<R>[], filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
// array with values
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean | Bluebird.Thenable<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
static filter<R>(values: R[], filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike<boolean>, option?: Bluebird.ConcurrencyOption): Bluebird<R[]>;
/**
* Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well.
@@ -802,11 +802,11 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration.
*/
// promise of array with promises of value
static each<R, U>(values: Bluebird.Thenable<Bluebird.Thenable<R>[]>, iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>): Bluebird<R[]>;
static each<R, U>(values: PromiseLike<PromiseLike<R>[]>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<R[]>;
// array with promises of value
static each<R, U>(values: Bluebird.Thenable<R>[], iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>): Bluebird<R[]>;
static each<R, U>(values: PromiseLike<R>[], iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<R[]>;
// array with values OR promise of array with values
static each<R, U>(values: R[] | Bluebird.Thenable<R[]>, iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>): Bluebird<R[]>;
static each<R, U>(values: R[] | PromiseLike<R[]>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<R[]>;
/**
* Given an Iterable(arrays are Iterable), or a promise of an Iterable, which produces promises (or a mix of promises and values), iterate over all the values in the Iterable into an array and iterate over the array serially, in-order.
@@ -815,7 +815,7 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
*
* If any promise in the input array is rejected or any promise returned by the iterator function is rejected, the result will be rejected as well.
*/
static mapSeries<R, U>(values: (R | Bluebird.Thenable<R>)[] | Bluebird.Thenable<(R | Bluebird.Thenable<R>)[]>, iterator: (item: R, index: number, arrayLength: number) => U | Bluebird.Thenable<U>): Bluebird<U[]>;
static mapSeries<R, U>(values: (R | PromiseLike<R>)[] | PromiseLike<(R | PromiseLike<R>)[]>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike<U>): Bluebird<U[]>;
/**
* A meta method used to specify the disposer method that cleans up a resource when using `Promise.using`.
@@ -827,16 +827,16 @@ declare class Bluebird<R> implements Bluebird.Thenable<R>, Bluebird.Inspection<R
* The second argument passed to a disposer is the result promise of the using block, which you can
* inspect synchronously.
*/
disposer(disposeFn: (arg: R, promise: Bluebird<R>) => void | Bluebird.Thenable<void>): Bluebird.Disposer<R>;
disposer(disposeFn: (arg: R, promise: Bluebird<R>) => void | PromiseLike<void>): Bluebird.Disposer<R>;
/**
* In conjunction with `.disposer`, using will make sure that no matter what, the specified disposer
* will be called when the promise returned by the callback passed to using has settled. The disposer is
* necessary because there is no standard interface in node for disposing resources.
*/
static using<R, T>(disposer: Bluebird.Disposer<R>, executor: (transaction: R) => Bluebird.Thenable<T>): Bluebird<T>;
static using<R1, R2, T>(disposer: Bluebird.Disposer<R1>, disposer2: Bluebird.Disposer<R2>, executor: (transaction1: R1, transaction2: R2) => Bluebird.Thenable<T>): Bluebird<T>;
static using<R1, R2, R3, T>(disposer: Bluebird.Disposer<R1>, disposer2: Bluebird.Disposer<R2>, disposer3: Bluebird.Disposer<R3>, executor: (transaction1: R1, transaction2: R2, transaction3: R3) => Bluebird.Thenable<T>): Bluebird<T>;
static using<R, T>(disposer: Bluebird.Disposer<R>, executor: (transaction: R) => PromiseLike<T>): Bluebird<T>;
static using<R1, R2, T>(disposer: Bluebird.Disposer<R1>, disposer2: Bluebird.Disposer<R2>, executor: (transaction1: R1, transaction2: R2) => PromiseLike<T>): Bluebird<T>;
static using<R1, R2, R3, T>(disposer: Bluebird.Disposer<R1>, disposer2: Bluebird.Disposer<R2>, disposer3: Bluebird.Disposer<R3>, executor: (transaction1: R1, transaction2: R2, transaction3: R3) => PromiseLike<T>): Bluebird<T>;
/**
* Add handler as the handler to call when there is a possibly unhandled rejection.
@@ -891,7 +891,7 @@ declare namespace Bluebird {
suffix?: string;
filter?: (name: string, func: Function, target?: any, passesDefaultFilter?: boolean) => boolean;
// The promisifier gets a reference to the original method and should return a function which returns a promise
promisifier?: (originalMethod: Function) => () => Thenable<any>;
promisifier?: (originalMethod: Function) => () => PromiseLike<any>;
}
/**
@@ -951,10 +951,8 @@ declare namespace Bluebird {
export class Disposer<R> {
}
export interface Thenable<R> {
then<U>(onFulfilled: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
then<U>(onFulfilled: (value: R) => U | Thenable<U>, onRejected?: (error: any) => void | Thenable<void>): Thenable<U>;
}
/** @deprecated Use PromiseLike<T> directly. */
export type Thenable<T> = PromiseLike<T>;
export interface Resolver<R> {
/**

View File

@@ -2,7 +2,7 @@
// Project: http://bookshelfjs.org/
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>, Vesa Poikajärvi <https://github.com/vesse>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
import Knex = require('knex');
import knex = require('knex');

View File

@@ -36,13 +36,22 @@ interface FileOptions {
// for each file in a bundle.
type InputFile = string | NodeJS.ReadableStream | FileOptions;
/**
* Core options pertaining to a Browserify instance, extended by user options
*/
interface CustomOptions {
/**
* Custom properties can be defined on Options.
* These options are forwarded along to module-deps and browser-pack directly.
*/
[propName: string]: any;
/** the directory that Browserify starts bundling from for filenames that start with .. */
basedir?: string;
}
/**
* Options pertaining to a Browserify instance.
*/
interface Options {
// Custom properties can be defined on Options.
// These options are forwarded along to module-deps and browser-pack directly.
[propName: string]: any;
interface Options extends CustomOptions {
// String, file object, or array of those types (they may be mixed) specifying entry file(s).
entries?: InputFile | InputFile[];
// an array which will skip all require() and global parsing for each file in the array.
@@ -51,8 +60,6 @@ interface Options {
// an array of optional extra extensions for the module lookup machinery to use when the extension has not been specified.
// By default Browserify considers only .js and .json files in such cases.
extensions?: string[];
// the directory that Browserify starts bundling from for filenames that start with ..
basedir?: string;
// an array of directories that Browserify searches when looking for modules which are not referenced using relative path.
// Can be absolute or relative to basedir. Equivalent of setting NODE_PATH environmental variable when calling Browserify command.
paths?: string[];
@@ -115,32 +122,32 @@ interface BrowserifyObject extends NodeJS.EventEmitter {
* If file is an array, each item in file will be externalized.
* If file is another bundle, that bundle's contents will be read and excluded from the current bundle as the bundle in file gets bundled.
*/
external(file: string[], opts?: { basedir?: string }): BrowserifyObject;
external(file: string, opts?: { basedir?: string }): BrowserifyObject;
external(file: string[], opts?: CustomOptions): BrowserifyObject;
external(file: string, opts?: CustomOptions): BrowserifyObject;
external(file: BrowserifyObject): BrowserifyObject;
/**
* Prevent the module name or file at file from showing up in the output bundle.
* Instead you will get a file with module.exports = {}.
*/
ignore(file: string, opts?: { basedir?: string }): BrowserifyObject;
ignore(file: string, opts?: CustomOptions): BrowserifyObject;
/**
* Prevent the module name or file at file from showing up in the output bundle.
* If your code tries to require() that file it will throw unless you've provided another mechanism for loading it.
*/
exclude(file: string, opts?: { basedir?: string }): BrowserifyObject;
exclude(file: string, opts?: CustomOptions): BrowserifyObject;
/**
* Transform source code before parsing it for require() calls with the transform function or module name tr.
* If tr is a function, it will be called with tr(file) and it should return a through-stream that takes the raw file contents and produces the transformed source.
* If tr is a string, it should be a module name or file path of a transform module
*/
transform<T extends { basedir?: string }>(tr: string, opts?: T): BrowserifyObject;
transform<T extends { basedir?: string }>(tr: (file: string, opts: T) => NodeJS.ReadWriteStream, opts?: T): BrowserifyObject;
transform<T extends CustomOptions>(tr: string, opts?: T): BrowserifyObject;
transform<T extends CustomOptions>(tr: (file: string, opts: T) => NodeJS.ReadWriteStream, opts?: T): BrowserifyObject;
/**
* Register a plugin with opts. Plugins can be a string module name or a function the same as transforms.
* plugin(b, opts) is called with the Browserify instance b.
*/
plugin<T extends { basedir?: string }>(plugin: string, opts?: T): BrowserifyObject;
plugin<T extends { basedir?: string }>(plugin: (b: BrowserifyObject, opts: T) => any, opts?: T): BrowserifyObject;
plugin<T extends CustomOptions>(plugin: string, opts?: T): BrowserifyObject;
plugin<T extends CustomOptions>(plugin: (b: BrowserifyObject, opts: T) => any, opts?: T): BrowserifyObject;
/**
* Reset the pipeline back to a normal state. This function is called automatically when bundle() is called multiple times.
* This function triggers a 'reset' event.

View File

@@ -7,6 +7,23 @@
declare module "bunyan-config" {
import * as bunyan from "bunyan";
interface StreamConfiguration {
name: string,
params?: {
host: string,
port: number
}
}
interface Stream {
type?: string;
level?: bunyan.LogLevel;
path?: string;
stream?: string | StreamConfiguration
closeOnExit?: boolean;
period?: string;
count?: number;
}
/**
* Configuration.
@@ -14,7 +31,7 @@ declare module "bunyan-config" {
*/
interface Configuration {
name: string;
streams?: bunyan.Stream[];
streams?: Stream[];
level?: string | number;
stream?: NodeJS.WritableStream;
serializers?: {};

View File

@@ -1097,7 +1097,7 @@ declare namespace CodeMirror {
* Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless
* the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined.
*/
function overlayMode<T, S>(base: Mode<T>, overlay: Mode<S>, combine?: boolean): Mode<any>
function overlayMode<T, S>(base: Mode<T>, overlay: Mode<S>, combine?: boolean): Mode<any>;
/**
* async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror
@@ -1114,13 +1114,20 @@ declare namespace CodeMirror {
* linter.
*/
interface LintOptions extends LintStateOptions {
getAnnotations: AnnotationsCallback;
getAnnotations: Linter | AsyncLinter;
}
/**
* A function that return errors found during the linting process.
*/
interface Linter {
(content: string, options: LintStateOptions, codeMirror: Editor): Annotation[] | PromiseLike<Annotation[]>;
}
/**
* A function that calls the updateLintingCallback with any errors found during the linting process.
*/
interface AnnotationsCallback {
interface AsyncLinter {
(content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void;
}

View File

@@ -28,7 +28,7 @@ var lintStateOptions: CodeMirror.LintStateOptions = {
hasGutters: true
};
var lintOptions: CodeMirror.LintOptions = {
var asyncLintOptions: CodeMirror.LintOptions = {
async: true,
hasGutters: true,
getAnnotations: (content: string,
@@ -37,6 +37,14 @@ var lintOptions: CodeMirror.LintOptions = {
codeMirror: CodeMirror.Editor) => {}
};
var syncLintOptions: CodeMirror.LintOptions = {
async: false,
hasGutters: true,
getAnnotations: (content: string,
options: CodeMirror.LintStateOptions,
codeMirror: CodeMirror.Editor): CodeMirror.Annotation[] => { return []; }
};
var updateLintingCallback: CodeMirror.UpdateLintingCallback = (codeMirror: CodeMirror.Editor,
annotations: CodeMirror.Annotation[]) => {};

View File

@@ -0,0 +1,32 @@
import SortedSet = require('collections/sorted-set');
interface Person {
name: string;
}
let set = new SortedSet<Person>(
[{name: 'John'}, {name: 'Jack'}, {name: 'Linda'}],
(a: Person, b: Person) => a.name === b.name,
(a: Person, b: Person) => {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
}
);
let p1: Person | undefined = set.max();
let p2: Person | undefined = set.min();
set.push({name: 'Laurie'}, {name: 'Max'});
set.pop();
set.get({name: 'Laurie'});
set.has({name: 'John'});
let a = 1;
set.forEach((p: Person) => a++);

133
types/collections/index.d.ts vendored Normal file
View File

@@ -0,0 +1,133 @@
// Type definitions for collections v5.0.6
// Project: http://www.collectionsjs.com/
// Definitions by: Scarabe Dore <https://github.com/scarabedore>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'collections/sorted-set' {
namespace internal {
// TODO: These methods can be similar in others collection. One's should make some
// class model.
abstract class AbstractSet {
union(...plus: any[]): any;
intersection(...plus: any[]): any;
difference(...plus: any[]): any;
symmetricDifference(...plus: any[]): any;
remove(...plus: any[]): any;
contains(...plus: any[]): any;
toggle(...plus: any[]): any;
addEach(...plus: any[]): any;
deleteEach(...plus: any[]): any;
deleteAll(...plus: any[]): any;
findValue(...plus: any[]): any;
iterator(...plus: any[]): any;
forEach(...plus: any[]): any;
map(...plus: any[]): any;
filter(...plus: any[]): any;
group(...plus: any[]): any;
some(...plus: any[]): any;
every(...plus: any[]): any;
any(...plus: any[]): any;
all(...plus: any[]): any;
only(...plus: any[]): any;
sorted(...plus: any[]): any;
reversed(...plus: any[]): any;
join(...plus: any[]): any;
sum(...plus: any[]): any;
average(...plus: any[]): any;
zip(...plus: any[]): any;
enumerate(...plus: any[]): any;
concat(...plus: any[]): any;
flatten(...plus: any[]): any;
toArray(...plus: any[]): any;
toObject(...plus: any[]): any;
toJSON(...plus: any[]): any;
equals(...plus: any[]): any;
clone(...plus: any[]): any;
contentCompare(...plus: any[]): any;
contentEquals(...plus: any[]): any;
sortedSetLog(...plus: any[]): any;
addRangeChangeListener(...plus: any[]): any;
removeRangeChangeListener(...plus: any[]): any;
dispatchRangeChange(...plus: any[]): any;
addBeforeRangeChangeListener(...plus: any[]): any;
removeBeforeRangeChangeListener(...plus: any[]): any;
dispatchBeforeRangeChange(...plus: any[]): any;
addOwnPropertyChangeListener(...plus: any[]): any;
addBeforeOwnPropertyChangeListener(...plus: any[]): any;
removeOwnPropertyChangeListener(...plus: any[]): any;
removeBeforeOwnPropertyChangeListener(...plus: any[]): any;
dispatchOwnPropertyChange(...plus: any[]): any;
dispatchBeforeOwnPropertyChange(...plus: any[]): any;
makePropertyObservable(...plus: any[]): any;
}
class Node<T> {
reduce(cb: (result?: any, val?: any, key?: any, collection?: any) => any,
basis: any, index: number, thisp: any, tree: any, depth: number): any;
touch(...plus: any[]): void;
checkIntegrity(...plus: any[]): number;
getNext(...plus: any[]): Node<T> | undefined;
getPrevious(...plus: any[]): Node<T> | undefined;
summary(...plus: any[]): string;
log(charmap: any, logNode: any, log: any, logAbove: any): any;
}
class Iterator<T> {
next(): {done: true, value: T | null | undefined};
}
export class SortedSet<T> extends AbstractSet {
constructor(
values?: T[],
equals?: (a: T, b: T) => boolean,
compare?: (a: T, b: T) => number,
getDefault?: any
);
constructClone(values?: T[]): SortedSet<T>;
add(value: T): boolean;
clear(): void;
['delete'](value: T): boolean;
find(value: T): Node<T> | undefined;
findGreatest(n?: Node<T> | undefined): Node<T> | undefined;
findGreatestLessThan(value: T): Node<T> | undefined;
findGreatestLessThanOrEqual(value: T): Node<T> | undefined;
findLeast(n?: Node<T> | undefined): Node<T> | undefined;
findLeastGreaterThan(value: T): Node<T> | undefined;
findLeastGreaterThanOrEqual(value: T): Node<T> | undefined;
max(n?: Node<T>): T | undefined;
min(n?: Node<T>): T | undefined;
one(): T | undefined;
get(elt: T): T | undefined;
has(elt: T): boolean;
indexOf(value: T): number;
pop(): T | undefined;
push(...rest: T[]): void;
shift(): T | undefined;
unshift(...rest: T[]): void;
slice(start?: number, end?: number): T[];
splice(start: Node<T>, length: number, ...values: T[]): T[];
swap(start: number, length: number, values?: T[]): T[];
splay(value: T): void;
splayIndex(index: number): boolean;
reduce(callback: (result?: any, val?: any, key?: any, collection?: any) => any,
basis?: any, thisp?: any): any;
reduceRight(
callback: (result?: any, val?: any, key?: any, collection?: any) => any,
basis?: any, thisp?: any
): any;
iterate(start: number, stop: number): Iterator<T>;
}
}
export = internal.SortedSet;
}

View File

@@ -0,0 +1,16 @@
{
"files": [
"collections-tests.ts",
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": ["es6"],
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"noEmit": true
}
}

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/visionmedia/consolidate.js
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>, Theo Sherry <https://github.com/theosherry>, Nicolas Henry <https://github.com/nicolashenry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Imported from: https://github.com/soywiz/typescript-node-definitions/consolidate.d.ts

View File

@@ -1,10 +1,10 @@
// InAppBrowser plugin
//----------------------------------------------------------------------
// ----------------------------------------------------------------------
// signature of window.open() added by InAppBrowser plugin
// is similar to native window.open signature, so the compiler can's
// select proper overload, but we cast result to InAppBrowser manually.
var iab = <InAppBrowser>window.open('google.com', '_self');
const iab = <InAppBrowser> window.open('google.com', '_self');
iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); });
@@ -30,5 +30,5 @@ iab.removeEventListener('exit', inAppBrowserCallBack);
iab.show();
iab.executeScript(
{ code: "console.log('Injected script in action')" },
()=> { console.log('Script is executed'); }
);
() => { console.log('Script is executed'); }
);

View File

@@ -1,40 +1,14 @@
// Type definitions for Apache Cordova InAppBrowser plugin
// Type definitions for Apache Cordova InAppBrowser plugin 1.7
// Project: https://github.com/apache/cordova-plugin-inappbrowser
// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//
//
// Copyright (c) Microsoft Open Technologies Inc
// Licensed under the MIT license.
// TypeScript Version: 2.3
type channel = "loadstart" | "loadstop" | "loaderror" | "exit";
interface Window {
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_self", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_blank", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
* @param target The target in which to load the URL, an optional parameter that defaults to _self.
* @param options Options for the InAppBrowser. Optional, defaulting to: location=yes.
* The options string must not contain any blank space, and each feature's
* name/value pairs must be separated by a comma. Feature names are case insensitive.
*/
open(url: string, target?: "_system", options?: string): InAppBrowser;
/**
* Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
* @param url The URL to load.
@@ -51,10 +25,10 @@ interface Window {
* NOTE: The InAppBrowser window behaves like a standard web browser, and can't access Cordova APIs.
*/
interface InAppBrowser extends Window {
onloadstart: (type: InAppBrowserEvent) => void;
onloadstop: (type: InAppBrowserEvent) => void;
onloaderror: (type: InAppBrowserEvent) => void;
onexit: (type: InAppBrowserEvent) => void;
onloadstart(type: InAppBrowserEvent): void;
onloadstop(type: InAppBrowserEvent): void;
onloaderror(type: InAppBrowserEvent): void;
onexit(type: InAppBrowserEvent): void;
// addEventListener overloads
/**
* Adds a listener for an event from the InAppBrowser.
@@ -65,7 +39,7 @@ interface InAppBrowser extends Window {
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
addEventListener(type: "loadstart" | "loadstop" | "loaderror" | "exit", callback: (event: InAppBrowserEvent) => void): void;
addEventListener(type: channel, callback: (event: InAppBrowserEvent) => void): void;
// removeEventListener overloads
/**
* Removes a listener for an event from the InAppBrowser.
@@ -77,7 +51,7 @@ interface InAppBrowser extends Window {
* @param callback the function that executes when the event fires. The function is
* passed an InAppBrowserEvent object as a parameter.
*/
removeEventListener(type: "loadstart" | "loadstop" | "loaderror" | "exit", callback: (event: InAppBrowserEvent) => void): void;
removeEventListener(type: channel, callback: (event: InAppBrowserEvent) => void): void;
/** Closes the InAppBrowser window. */
close(): void;
/** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */
@@ -96,29 +70,13 @@ interface InAppBrowser extends Window {
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { code: string }, callback: (result: any) => void): void;
/**
* Injects JavaScript code into the InAppBrowser window.
* @param script Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the JavaScript code is injected.
* If the injected script is of type code, the callback executes with
* a single parameter, which is the return value of the script, wrapped in an Array.
* For multi-line scripts, this is the return value of the last statement,
* or the last expression evaluated.
*/
executeScript(script: { file: string }, callback: (result: any) => void): void;
executeScript(script: { code: string } | { file: string }, callback: (result: any) => void): void;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { code: string }, callback: () => void): void;
/**
* Injects CSS into the InAppBrowser window.
* @param css Details of the script to run, specifying either a file or code key.
* @param callback The function that executes after the CSS is injected.
*/
insertCSS(css: { file: string }, callback: () => void): void;
insertCSS(css: { code: string } | { file: string }, callback: () => void): void;
}
interface InAppBrowserEvent extends Event {
@@ -130,4 +88,8 @@ interface InAppBrowserEvent extends Event {
code: number;
/** the error message, only in the case of loaderror. */
message: string;
}
}
interface Cordova {
InAppBrowser: InAppBrowser;
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -243,15 +243,15 @@ promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => point);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => promiseLikeOfPoint);
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { });
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { });
promiseLikeOfPoint = promiseLikeOfPoint.then(p => point, e => { throw e; });
promiseLikeOfPoint = promiseLikeOfPoint.then(p => promiseLikeOfPoint, e => { throw e; });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => point3d, e => { throw e; });
promiseLikeOfPoint3D = promiseLikeOfPoint.then(p => promiseLikeOfPoint3D, e => { throw e; });
promiseOfPoint.then((point: Point) => { });
promiseOfPoint = promiseOfPoint.then();
promiseOfPoint = promiseOfPoint.then(p => point);
@@ -262,9 +262,9 @@ promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => point);
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => point);
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.then(p => point, e => { });
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { });
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { });
promiseOfPoint = promiseOfPoint.then(p => point, e => { throw e; });
promiseOfPoint = promiseOfPoint.then(p => promiseOfPoint, e => { throw e; });
promiseOfPoint = promiseOfPoint.then(p => promiseLikeOfPoint, e => { throw e; });
promiseOfPoint3D = promiseOfPoint.then(p => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D);
@@ -273,16 +273,16 @@ promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => promiseLikeOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { });
promiseOfPoint3D = promiseOfPoint.then(p => point3d, e => { throw e; });
promiseOfPoint3D = promiseOfPoint.then(p => promiseOfPoint3D, e => { throw e; });
promiseOfPoint3D = promiseOfPoint.then(p => promiseLikeOfPoint3D, e => { throw e; });
promiseOfPoint = promiseOfPoint.catch(e => point);
promiseOfPoint = promiseOfPoint.catch(e => promiseOfPoint);
promiseOfPoint = promiseOfPoint.catch(e => promiseLikeOfPoint);
promiseOfPoint = promiseOfPoint.catch(e => { });
promiseOfPoint3D = promiseOfPoint.catch(e => point3d);
promiseOfPoint3D = promiseOfPoint.catch(e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.catch(e => promiseLikeOfPoint3D);
promiseOfPoint = promiseOfPoint.catch(e => { throw e; });
promiseOfPoint3D = promiseOfPoint.then(p2d => ({ ...p2d, z: 0 })).catch(e => point3d);
promiseOfPoint3D = promiseOfPoint.then(p2d => ({ ...p2d, z: 0 })).catch(e => promiseOfPoint3D);
promiseOfPoint3D = promiseOfPoint.then(p2d => ({ ...p2d, z: 0 })).catch(e => promiseLikeOfPoint3D);
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(point));
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseOfPoint));
promiseOfPoint = new Promise<Point>((resolve, reject) => resolve(promiseLikeOfPoint));

View File

@@ -60,12 +60,35 @@ $(document).ready(function () {
sort: "asc"
};
var colRenderFunc: DataTables.FunctionColumnRender = function (data, type, row, meta) {
var colRenderFunc: DataTables.FunctionColumnRender = (data: any, type: 'filter' | 'display' | 'type' | 'sort' | undefined | any, row: any, meta: DataTables.CellMetaSettings): any => {
meta.col;
meta.row;
meta.settings;
switch (type) {
case undefined:
return data.value;
case 'filter':
return data.filterValue;
case 'display':
return data.displayValue;
case 'type':
return data.typeValue;
case 'sort':
return data.sortValue;
default:
// Extensibility: the render type can be a custom value, useful for plugins that require custom rendering.
// Custom values are declared as any.
return data.valueForPlugin;
}
};
colRenderFunc({}, 'filter', {}, null);
colRenderFunc({}, 'display', {}, null);
colRenderFunc({}, 'type', {}, null);
colRenderFunc({}, 'sort', {}, null);
colRenderFunc({}, undefined, {}, null);
colRenderFunc({}, 'custom value', {}, null);
var col: DataTables.ColumnSettings =
{
cellType: "th",

View File

@@ -1604,7 +1604,7 @@ declare namespace DataTables {
}
interface FunctionColumnRender {
(data: any, t: string, row: any, meta: CellMetaSettings): void;
(data: any, type: 'filter' | 'display' | 'type' | 'sort' | undefined | any, row: any, meta: CellMetaSettings): any;
}
interface CellMetaSettings {

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/db-migrate/db-migrate-base
// Definitions by: nickiannone <https://github.com/nickiannone>
// Definitions: https://github.com/nickiannone/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node"/>

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/db-migrate/pg
// Definitions by: nickiannone <http://github.com/nickiannone>
// Definitions: https://github.com/nickiannone/DefinitelyTyped
// TypeScript Version: 2.3
import * as pg from "pg";
import * as DbMigrateBase from "db-migrate-base";

View File

@@ -1,4 +1,4 @@
import * as settings from 'electron-settings';
import settings = require('electron-settings');
function test_configure() {
settings.configure({
@@ -59,6 +59,7 @@ async function test_clear() {
function test_clearSync() {
settings.clearSync() === undefined;
}
async function test_applyDefaults() {
await settings.applyDefaults({ overwrite: true }) === undefined;
}
@@ -100,3 +101,23 @@ function test_on_write() {
console.log();
}) === settings;
}
function test_settings_type_annotation(s: typeof settings) {
s.getSettingsFilePath();
}
function test_observer_type_annotation(observer: settings.Observer) {
observer.dispose();
}
function test_options_type_annotation(options: settings.Options) {
options.atomicSaving;
}
function test_applyDefaultOptions_type_annotation(options: settings.ApplyDefaultsOptions) {
options.overwrite;
}
function test_changeEvent_type_annotation(e: settings.ChangeEvent) {
e.oldValue === e.newValue;
}

View File

@@ -6,7 +6,10 @@
/// <reference types="node" />
import * as EventEmitter from 'events';
import { EventEmitter } from 'events';
declare const SettingsInstance: Settings;
export = SettingsInstance;
/**
* The Settings class.
@@ -17,7 +20,7 @@ declare class Settings extends EventEmitter {
*
* @throws if options is not an object.
*/
configure(options: ElectronSettings.Options | object): void;
configure(options: ElectronSettings.Options.Param): void;
/**
* Globally configures default settings.
@@ -76,14 +79,14 @@ declare class Settings extends EventEmitter {
* @throws if options is not an object.
* @see setSync
*/
set(keyPath: string, value: any, options?: ElectronSettings.Options | object): Promise<void>;
set(keyPath: string, value: any, options?: ElectronSettings.Options.Param): Promise<void>;
/**
* The synchronous version of set().
*
* @see set
*/
setSync(keyPath: string, value: any, options?: ElectronSettings.Options | object): void;
setSync(keyPath: string, value: any, options?: ElectronSettings.Options.Param): void;
/**
* Deletes the key and value at the chosen key path.
@@ -94,14 +97,14 @@ declare class Settings extends EventEmitter {
* @throws if options is not an object.
* @see deleteSync
*/
delete(keyPath: string, options?: ElectronSettings.Options | object): Promise<void>;
delete(keyPath: string, options?: ElectronSettings.Options.Param): Promise<void>;
/**
* The synchronous version of delete().
*
* @see delete
*/
deleteSync(keyPath: string, options?: ElectronSettings.Options | object): void;
deleteSync(keyPath: string, options?: ElectronSettings.Options.Param): void;
/**
* Clears the entire settings object.
@@ -110,14 +113,14 @@ declare class Settings extends EventEmitter {
* @throws if options is not an object.
* @see clearSync
*/
clear(options?: ElectronSettings.Options | object): Promise<void>;
clear(options?: ElectronSettings.Options.Param): Promise<void>;
/**
* The synchronous version of clear().
*
* @see clear
*/
clearSync(options?: ElectronSettings.Options | object): void;
clearSync(options?: ElectronSettings.Options.Param): void;
/**
* Applies defaults to the current settings object (deep).
@@ -130,14 +133,14 @@ declare class Settings extends EventEmitter {
* @see defaults
* @see applyDefaultsSync
*/
applyDefaults(options?: ElectronSettings.ApplyDefaultsOptions | object): Promise<void>;
applyDefaults(options?: ElectronSettings.ApplyDefaultsOptions.Param): Promise<void>;
/**
* The synchronous version of applyDefaults().
*
* @see applyDefaults
*/
applyDefaultsSync(options?: ElectronSettings.ApplyDefaultsOptions | object): void;
applyDefaultsSync(options?: ElectronSettings.ApplyDefaultsOptions.Param): void;
/**
* Resets all settings to defaults.
@@ -148,14 +151,14 @@ declare class Settings extends EventEmitter {
* @see defaults
* @see resetToDefaultsSync
*/
resetToDefaults(options?: ElectronSettings.Options | object): Promise<void>;
resetToDefaults(options?: ElectronSettings.Options.Param): Promise<void>;
/**
* The synchronous version of resetToDefaults().
*
* @see resetToDefaults
*/
resetToDefaultsSync(options?: ElectronSettings.Options | object): void;
resetToDefaultsSync(options?: ElectronSettings.Options.Param): void;
/**
* Observes the chosen key path for changes and calls the handler if the value changes.
@@ -187,8 +190,12 @@ declare class Settings extends EventEmitter {
on(event: 'write', listener: () => void): this;
}
declare const SettingsInstance: Settings;
export = SettingsInstance;
declare namespace SettingsInstance {
type Observer = ElectronSettings.Observer;
type Options = ElectronSettings.Options;
type ApplyDefaultsOptions = ElectronSettings.ApplyDefaultsOptions;
type ChangeEvent = ElectronSettings.ChangeEvent;
}
declare namespace ElectronSettings {
/**
@@ -205,6 +212,8 @@ declare namespace ElectronSettings {
interface Options extends Pick<Options._Impl, keyof Options._Impl> { }
namespace Options {
type Param = Options | object;
interface _Impl {
/**
* Whether electron-settings should create a tmp file during save to ensure data-write consistency.
@@ -224,6 +233,8 @@ declare namespace ElectronSettings {
interface ApplyDefaultsOptions extends Pick<ApplyDefaultsOptions._Impl, keyof ApplyDefaultsOptions._Impl> { }
namespace ApplyDefaultsOptions {
type Param = ApplyDefaultsOptions | object;
interface _Impl extends Options._Impl {
/**
* Overwrite pre-existing settings with their respective default values.

View File

@@ -57,3 +57,8 @@ request
.post('')
.send({})
.json();
request
.post('')
.append('key', 'value')
.append({key: 'value'});

View File

@@ -1,4 +1,4 @@
// Type definitions for fetch.io 3.1
// Type definitions for fetch.io 4.0
// Project: https://github.com/haoxins/fetch.io
// Definitions by: newraina <https://github.com/newraina>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -95,7 +95,9 @@ export class Request {
/**
* ppend formData
*/
append(key: string, value: string): this;
append(key: string, value: any): this;
append(object: {[key: string]: any}): this;
/**
* Get Response directly

View File

@@ -0,0 +1,3 @@
import * as ffmpegStatic from 'ffmpeg-static';
ffmpegStatic.path;

10
types/ffmpeg-static/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Type definitions for ffmpeg-static 2.0
// Project: https://github.com/eugeneware/ffmpeg-static#readme
// Definitions by: Steve Tran <https://github.com/iamstevetran>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*~ You can declare properties of the module using const, let, or var */
/**
* Binary location
*/
export const path: string;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ffmpeg-static-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,3 @@
import * as ffprobeStatic from 'ffmpeg-static';
ffprobeStatic.path;

10
types/ffprobe-static/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
// Type definitions for ffprobe-static 2.0
// Project: https://github.com/joshwnj/ffprobe-static
// Definitions by: Steve Tran <https://github.com/iamstevetran>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*~ You can declare properties of the module using const, let, or var */
/**
* Binary location
*/
export const path: string;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ffprobe-static-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1,47 +1,48 @@
import fs = require('fs-extra-promise-es6');
import stream = require('stream');
var stats: fs.Stats;
var str: string;
var strArr: string[];
var bool: boolean;
var num: number;
var src: string;
var dest: string;
var file: string;
var filename: string;
var dir: string;
var path: string;
var data: any;
var object: Object;
var buffer: NodeBuffer;
var modeNum: number;
var modeStr: string;
var encoding: string;
var type: string;
var flags: string;
var srcpath: string;
var dstpath: string;
var oldPath: string;
var newPath: string;
var cache: string;
var offset: number;
var length: number;
var position: number;
var cacheBool: boolean;
var cacheStr: string;
var fd: number;
var len: number;
var uid: number;
var gid: number;
var atime: number;
var mtime: number;
var statsCallback: (err: Error, stats: fs.Stats) => void;
var errorCallback: (err: Error) => void;
var openOpts: fs.OpenOptions;
var watcher: fs.FSWatcher;
var readStreeam: stream.Readable;
var writeStream: stream.Writable;
let stats: fs.Stats;
let str: string;
let strArr: string[];
let bool: boolean;
let num: number;
let src: string;
let dest: string;
let file: string;
let filename: string;
let dir: string;
let path: string;
let data: any;
let object: any;
let buffer: NodeBuffer;
let modeNum: number;
let modeStr: string;
let encoding: string;
let type: string;
let flags: string;
let srcpath: string;
let dstpath: string;
let oldPath: string;
let newPath: string;
let cache: string;
let offset: number;
let length: number;
let position: number;
let cacheBool: boolean;
let cacheStr: string;
let fd: number;
let len: number;
let uid: number;
let gid: number;
let atime: number;
let mtime: number;
let statsCallback: (err: Error, stats: fs.Stats) => void;
let errorCallback: (err: Error) => void;
let openOpts: fs.OpenOptions;
let watcher: fs.FSWatcher;
let readStreeam: stream.Readable;
let writeStream: stream.Writable;
let isDirectory: boolean;
fs.copy(src, dest, errorCallback);
fs.copy(src, dest, (src: string) => {
@@ -119,13 +120,10 @@ fs.linkSync(srcpath, dstpath);
fs.symlink(srcpath, dstpath, type, errorCallback);
fs.symlinkSync(srcpath, dstpath, type);
fs.readlink(path, (err: Error, linkString: string) => {
});
fs.realpath(path, (err: Error, resolvedPath: string) => {
});
fs.realpath(path, cache, (err: Error, resolvedPath: string) => {
});
str = fs.realpathSync(path, cacheBool);
fs.unlink(path, errorCallback);
@@ -137,13 +135,11 @@ fs.mkdir(path, modeStr, errorCallback);
fs.mkdirSync(path, modeNum);
fs.mkdirSync(path, modeStr);
fs.readdir(path, (err: Error, files: string[]) => {
});
strArr = fs.readdirSync(path);
fs.close(fd, errorCallback);
fs.closeSync(fd);
fs.open(path, flags, modeStr, (err: Error, fd: number) => {
});
num = fs.openSync(path, flags, modeStr);
fs.utimes(path, atime, mtime, errorCallback);
@@ -153,24 +149,18 @@ 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) => {
});
num = fs.writeSync(fd, buffer, offset, length, position);
fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: NodeBuffer) => {
});
num = fs.readSync(fd, buffer, offset, length, position);
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
});
fs.readFile(filename, encoding, (err: Error, data: string) => {
});
fs.readFile(filename, openOpts, (err: Error, data: string) => {
});
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
});
buffer = fs.readFileSync(filename);
str = fs.readFileSync(filename, encoding);
@@ -203,10 +193,8 @@ fs.watchFile(filename, {
});
fs.unwatchFile(filename);
watcher = fs.watch(filename, { persistent: bool }, (event: string, filename: string) => {
});
fs.exists(path, (exists: boolean) => {
});
bool = fs.existsSync(path);
@@ -222,3 +210,10 @@ writeStream = fs.createWriteStream(path, {
flags: str,
encoding: str
});
let isDirectoryCallback = (err: Error, isDirectory: boolean) => {
};
fs.isDirectory(path, isDirectoryCallback);
fs.isDirectory(path);
isDirectory = fs.isDirectorySync(path);
fs.isDirectoryAsync(path);

View File

@@ -1,158 +1,194 @@
// Type definitions for fs-extra-promise-es6
// Type definitions for fs-extra-promise-es6 0.1
// Project: https://github.com/vinsonchuong/fs-extra-promise-es6
// Definitions by: midknight41 <https://github.com/midknight41>, Jason Swearingen <https://github.com/jasonswearingen>, Joshua DeVinney <https://github.com/geoffreak>
// Definitions by: midknight41 <https://github.com/midknight41>
// Jason Swearingen <https://github.com/jasonswearingen>
// Joshua DeVinney <https://github.com/geoffreak>
// Hiromi Shikata <https://github.com/HiromiShikata>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: fs-extra-promise typings (minus Bluebird)
///<reference types="node"/>
/// <reference types="node"/>
import stream = require("stream");
import fs = require("fs");
export type Stats = fs.Stats
export type Stats = fs.Stats;
export interface FSWatcher {
close(): void;
}
export declare class ReadStream extends stream.Readable { }
export declare class WriteStream extends stream.Writable { }
export class ReadStream extends stream.Readable { }
export class WriteStream extends stream.Writable { }
//extended methods
export declare function copy(src: string, dest: string, callback?: (err: Error) => void): void;
export declare function copy(src: string, dest: string, filter: (src: string) => boolean, callback?: (err: Error) => void): void;
// extended methods
export function copy(src: string, dest: string, callback?: (err: Error) => void): void;
export function copy(src: string, dest: string, filter: (src: string) => boolean, callback?: (err: Error) => void): void;
export declare function copySync(src: string, dest: string): void;
export declare function copySync(src: string, dest: string, filter: (src: string) => boolean): void;
export function copySync(src: string, dest: string, filter?: (src: string) => boolean): void;
export declare function createFile(file: string, callback?: (err: Error) => void): void;
export declare function createFileSync(file: string): void;
export function createFile(file: string, callback?: (err: Error) => void): void;
export function createFileSync(file: string): void;
export declare function mkdirs(dir: string, callback?: (err: Error) => void): void;
export declare function mkdirp(dir: string, callback?: (err: Error) => void): void;
export declare function mkdirsSync(dir: string): void;
export declare function mkdirpSync(dir: string): void;
export function mkdirs(dir: string, callback?: (err: Error) => void): void;
export function mkdirp(dir: string, callback?: (err: Error) => void): void;
export function mkdirsSync(dir: string): void;
export function mkdirpSync(dir: string): void;
export declare function outputFile(file: string, data: any, callback?: (err: Error) => void): void;
export declare function outputFileSync(file: string, data: any): void;
export function outputFile(file: string, data: any, callback?: (err: Error) => void): void;
export function outputFileSync(file: string, data: any): void;
export declare function outputJson(file: string, data: any, callback?: (err: Error) => void): void;
export declare function outputJSON(file: string, data: any, callback?: (err: Error) => void): void;
export declare function outputJsonSync(file: string, data: any): void;
export declare function outputJSONSync(file: string, data: any): void;
export function outputJson(file: string, data: any, callback?: (err: Error) => void): void;
export function outputJSON(file: string, data: any, callback?: (err: Error) => void): void;
export function outputJsonSync(file: string, data: any): void;
export function outputJSONSync(file: string, data: any): void;
export declare function readJson(file: string, callback?: (err: Error) => void): void;
export declare function readJson(file: string, options?: OpenOptions, callback?: (err: Error) => void): void;
export declare function readJSON(file: string, callback?: (err: Error) => void): void;
export declare function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void;
export function readJson(file: string, callback?: (err: Error) => void): void;
export function readJson(file: string, options?: OpenOptions, callback?: (err: Error) => void): void;
export function readJSON(file: string, callback?: (err: Error) => void): void;
export function readJSON(file: string, options?: OpenOptions, callback?: (err: Error) => void): void;
export declare function readJsonSync(file: string, options?: OpenOptions): void;
export declare function readJSONSync(file: string, options?: OpenOptions): void;
export function readJsonSync(file: string, options?: OpenOptions): void;
export function readJSONSync(file: string, options?: OpenOptions): void;
export declare function remove(dir: string, callback?: (err: Error) => void): void;
export declare function removeSync(dir: string): void;
export function remove(dir: string, callback?: (err: Error) => void): void;
export function removeSync(dir: string): void;
// export function delete(dir: string, callback?: (err: Error) => void): void;
// export function deleteSync(dir: string): void;
export declare function writeJson(file: string, object: any, callback?: (err: Error) => void): void;
export declare function writeJson(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
export declare function writeJSON(file: string, object: any, callback?: (err: Error) => void): void;
export declare function writeJSON(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
export function writeJson(file: string, object: any, callback?: (err: Error) => void): void;
export function writeJson(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
export function writeJSON(file: string, object: any, callback?: (err: Error) => void): void;
export function writeJSON(file: string, object: any, options?: OpenOptions, callback?: (err: Error) => void): void;
export declare function writeJsonSync(file: string, object: any, options?: OpenOptions): void;
export declare function writeJSONSync(file: string, object: any, options?: OpenOptions): void;
export function writeJsonSync(file: string, object: any, options?: OpenOptions): void;
export function writeJSONSync(file: string, object: any, options?: OpenOptions): void;
export declare function rename(oldPath: string, newPath: string, callback?: (err: Error) => void): void;
export declare function renameSync(oldPath: string, newPath: string): void;
export declare function truncate(fd: number, len: number, callback?: (err: Error) => void): void;
export declare function truncateSync(fd: number, len: number): void;
export declare function chown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
export declare function chownSync(path: string, uid: number, gid: number): void;
export declare function fchown(fd: number, uid: number, gid: number, callback?: (err: Error) => void): void;
export declare function fchownSync(fd: number, uid: number, gid: number): void;
export declare function lchown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
export declare function lchownSync(path: string, uid: number, gid: number): void;
export declare function chmod(path: string, mode: number, callback?: (err: Error) => void): void;
export declare function chmod(path: string, mode: string, callback?: (err: Error) => void): void;
export declare function chmodSync(path: string, mode: number): void;
export declare function chmodSync(path: string, mode: string): void;
export declare function fchmod(fd: number, mode: number, callback?: (err: Error) => void): void;
export declare function fchmod(fd: number, mode: string, callback?: (err: Error) => void): void;
export declare function fchmodSync(fd: number, mode: number): void;
export declare function fchmodSync(fd: number, mode: string): void;
export declare function lchmod(path: string, mode: string, callback?: (err: Error) => void): void;
export declare function lchmod(path: string, mode: number, callback?: (err: Error) => void): void;
export declare function lchmodSync(path: string, mode: number): void;
export declare function lchmodSync(path: string, mode: string): void;
export declare function stat(path: string, callback?: (err: Error, stats: Stats) => void): void;
export declare function lstat(path: string, callback?: (err: Error, stats: Stats) => void): void;
export declare function fstat(fd: number, callback?: (err: Error, stats: Stats) => void): void;
export declare function statSync(path: string): Stats;
export declare function lstatSync(path: string): Stats;
export declare function fstatSync(fd: number): Stats;
export declare function link(srcpath: string, dstpath: string, callback?: (err: Error) => void): void;
export declare function linkSync(srcpath: string, dstpath: string): void;
export declare function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err: Error) => void): void;
export declare function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
export declare function readlink(path: string, callback?: (err: Error, linkString: string) => void): void;
export declare function realpath(path: string, callback?: (err: Error, resolvedPath: string) => void): void;
export declare function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) => void): void;
export declare function realpathSync(path: string, cache?: boolean): string;
export declare function unlink(path: string, callback?: (err: Error) => void): void;
export declare function unlinkSync(path: string): void;
export declare function rmdir(path: string, callback?: (err: Error) => void): void;
export declare function rmdirSync(path: string): void;
export declare function mkdir(path: string, mode?: number, callback?: (err: Error) => void): void;
export declare function mkdir(path: string, mode?: string, callback?: (err: Error) => void): void;
export declare function mkdirSync(path: string, mode?: number): void;
export declare function mkdirSync(path: string, mode?: string): void;
export declare function readdir(path: string, callback?: (err: Error, files: string[]) => void): void;
export declare function readdirSync(path: string): string[];
export declare function close(fd: number, callback?: (err: Error) => void): void;
export declare function closeSync(fd: number): void;
export declare function open(path: string, flags: string, mode?: string, callback?: (err: Error, fs: number) => void): void;
export declare function openSync(path: string, flags: string, mode?: string): number;
export declare function utimes(path: string, atime: number, mtime: number, callback?: (err: Error) => void): void;
export declare function utimesSync(path: string, atime: number, mtime: number): void;
export declare function futimes(fd: number, atime: number, mtime: number, callback?: (err: Error) => void): void;
export declare function futimesSync(fd: number, atime: number, mtime: number): void;
export declare function fsync(fd: number, callback?: (err: Error) => void): void;
export declare function fsyncSync(fd: number): void;
export declare function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void;
export declare function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
export declare function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void;
export declare function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number;
export declare function readFile(filename: string, encoding: string, callback: (err: Error, data: string) => void): void;
export declare function readFile(filename: string, options: OpenOptions, callback: (err: Error, data: string) => void): void;
export declare function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void): void;
export declare function readFileSync(filename: string): NodeBuffer;
export declare function readFileSync(filename: string, encoding: string): string;
export declare function readFileSync(filename: string, options: OpenOptions): string;
export declare function writeFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void;
export declare function writeFile(filename: string, data: any, options?: OpenOptions, callback?: (err: Error) => void): void;
export declare function writeFileSync(filename: string, data: any, encoding?: string): void;
export declare function writeFileSync(filename: string, data: any, option?: OpenOptions): void;
export declare function appendFile(filename: string, data: any, encoding?: string, callback?: (err: Error) => void): void;
export declare function appendFile(filename: string, data: any, option?: OpenOptions, callback?: (err: Error) => void): void;
export declare function appendFileSync(filename: string, data: any, encoding?: string): void;
export declare function appendFileSync(filename: string, data: any, option?: OpenOptions): void;
export declare function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void;
export declare function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void;
export declare function unwatchFile(filename: string, listener?: Stats): void;
export declare function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
export declare function exists(path: string, callback?: (exists: boolean) => void): void;
export declare function existsSync(path: string): boolean;
export declare function ensureDir(path: string, cb: (err: Error) => void): void;
export declare function ensureDirSync(path: string): void;
export function rename(oldPath: string, newPath: string, callback?: (err: Error) => void): void;
export function renameSync(oldPath: string, newPath: string): void;
export function truncate(fd: number, len: number, callback?: (err: Error) => void): void;
export function truncateSync(fd: number, len: number): void;
export function chown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
export function chownSync(path: string, uid: number, gid: number): void;
export function fchown(fd: number, uid: number, gid: number, callback?: (err: Error) => void): void;
export function fchownSync(fd: number, uid: number, gid: number): void;
export function lchown(path: string, uid: number, gid: number, callback?: (err: Error) => void): void;
export function lchownSync(path: string, uid: number, gid: number): void;
export function chmod(path: string, mode: number | string, callback?: (err: Error) => void): void;
export function chmodSync(path: string, mode: number | string): void;
export function fchmod(fd: number, mode: number | string, callback?: (err: Error) => void): void;
export function fchmodSync(fd: number, mode: number | string): void;
export function lchmod(path: string, mode: number | string, callback?: (err: Error) => void): void;
export function lchmodSync(path: string, mode: number | string): void;
export function stat(path: string, callback?: (err: Error, stats: Stats) => void): void;
export function lstat(path: string, callback?: (err: Error, stats: Stats) => void): void;
export function fstat(fd: number, callback?: (err: Error, stats: Stats) => void): void;
export function statSync(path: string): Stats;
export function lstatSync(path: string): Stats;
export function fstatSync(fd: number): Stats;
export function link(srcpath: string, dstpath: string, callback?: (err: Error) => void): void;
export function linkSync(srcpath: string, dstpath: string): void;
export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err: Error) => void): void;
export function symlinkSync(srcpath: string, dstpath: string, type?: string): void;
export function readlink(path: string, callback?: (err: Error, linkString: string) => void): void;
export function realpath(path: string, callback?: (err: Error, resolvedPath: string) => void): void;
export function realpath(path: string, cache: string, callback: (err: Error, resolvedPath: string) => void): void;
export function realpathSync(path: string, cache?: boolean): string;
export function unlink(path: string, callback?: (err: Error) => void): void;
export function unlinkSync(path: string): void;
export function rmdir(path: string, callback?: (err: Error) => void): void;
export function rmdirSync(path: string): void;
export function mkdir(path: string, mode?: number | string, callback?: (err: Error) => void): void;
export function mkdirSync(path: string, mode?: number | string): void;
export function readdir(path: string, callback?: (err: Error, files: string[]) => void): void;
export function readdirSync(path: string): string[];
export function close(fd: number, callback?: (err: Error) => void): void;
export function closeSync(fd: number): void;
export function open(path: string, flags: string, mode?: string, callback?: (err: Error, fs: number) => void): void;
export function openSync(path: string, flags: string, mode?: string): number;
export function utimes(path: string, atime: number, mtime: number, callback?: (err: Error) => void): void;
export function utimesSync(path: string, atime: number, mtime: number): void;
export function futimes(fd: number, atime: number, mtime: number, callback?: (err: Error) => void): void;
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;
/**
* readFile
* @param filename
* @param options
* string: encoding
* OpenOptions: options
* @param callback
*/
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;
/**
* readFileSync
* @param filename
* @param options
* string: encoding
* OpenOptions: options
*/
export function readFileSync(filename: string, options: OpenOptions | string): string;
/**
* writeFile
* @param filename
* @param data
* @param options
* string: encoding
* OpenOptions: options
* @param callback
*/
export function writeFile(filename: string, data: any, options?: OpenOptions | string, callback?: (err: Error) => void): void;
/**
* writeFileSync
* @param filename
* @param data
* @param option
* string: encoding
* OpenOptions: options
*/
export function writeFileSync(filename: string, data: any, option?: OpenOptions | string): void;
/**
* appendFile
* @param filename
* @param data
* @param option:
* string: encoding
* OpenOptions: options
* @param callback
*/
export function appendFile(filename: string, data: any, option?: OpenOptions | string, callback?: (err: Error) => void): void;
/**
* appendFileSync
* @param filename
* @param data
* @param option
* string: encoding
* OpenOptions: options
*/
export function appendFileSync(filename: string, data: any, option?: OpenOptions | string): void;
export function watchFile(filename: string, listener: { curr: Stats; prev: Stats; }): void;
export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: { curr: Stats; prev: Stats; }): void;
export function unwatchFile(filename: string, listener?: Stats): void;
export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher;
export function exists(path: string, callback?: (exists: boolean) => void): void;
export function existsSync(path: string): boolean;
export function ensureDir(path: string, cb: (err: Error) => void): void;
export function ensureDirSync(path: string): void;
export interface OpenOptions {
encoding?: string;
flag?: string;
}
export declare function createReadStream(path: string | Buffer, options?: {
export function createReadStream(path: string | Buffer, options?: {
flags?: string;
encoding?: string;
fd?: number;
@@ -161,81 +197,90 @@ export declare function createReadStream(path: string | Buffer, options?: {
start?: number;
end?: number;
}): ReadStream;
export declare function createWriteStream(path: string | Buffer, options?: {
export function createWriteStream(path: string | Buffer, options?: {
flags?: string;
encoding?: string;
fd?: number;
mode?: number;
}): WriteStream;
// promisified versions
export function copyAsync(src: string, dest: string, filter?: (src: string) => boolean): Promise<void>;
export function createFileAsync(file: string): Promise<void>;
//promisified versions
export declare function copyAsync(src: string, dest: string): Promise<void>;
export declare function copyAsync(src: string, dest: string, filter: (src: string) => boolean): Promise<void>;
export function mkdirsAsync(dir: string): Promise<void>;
export function mkdirpAsync(dir: string): Promise<void>;
export declare function createFileAsync(file: string): Promise<void>;
export function outputFileAsync(file: string, data: any): Promise<void>;
export declare function mkdirsAsync(dir: string): Promise<void>;
export declare function mkdirpAsync(dir: string): Promise<void>;
export function outputJSONAsync(file: string, data: any): Promise<void>;
export declare function outputFileAsync(file: string, data: any): Promise<void>;
export function readJSONAsync(file: string, options?: OpenOptions): Promise<void>;
export declare function outputJsonAsync(file: string, data: any): Promise<void>;
export declare function outputJSONAsync(file: string, data: any): Promise<void>;
export declare function readJsonAsync(file: string): Promise<void>;
export declare function readJsonAsync(file: string, options?: OpenOptions): Promise<void>;
export declare function readJSONAsync(file: string): Promise<void>;
export declare function readJSONAsync(file: string, options?: OpenOptions): Promise<void>;
export declare function removeAsync(dir: string): Promise<void>;
export function removeAsync(dir: string): Promise<void>;
// export function deleteAsync(dir: string):Promise<void>;
export declare function writeJsonAsync(file: string, object: any): Promise<void>;
export declare function writeJsonAsync(file: string, object: any, options?: OpenOptions): Promise<void>;
export declare function writeJSONAsync(file: string, object: any): Promise<void>;
export declare function writeJSONAsync(file: string, object: any, options?: OpenOptions): Promise<void>;
export function writeJsonAsync(file: string, object: any, options?: OpenOptions): Promise<void>;
export function writeJSONAsync(file: string, object: any, options?: OpenOptions): Promise<void>;
export declare function renameAsync(oldPath: string, newPath: string): Promise<void>;
export declare function truncateAsync(fd: number, len: number): Promise<void>;
export declare function chownAsync(path: string, uid: number, gid: number): Promise<void>;
export declare function fchownAsync(fd: number, uid: number, gid: number): Promise<void>;
export declare function lchownAsync(path: string, uid: number, gid: number): Promise<void>;
export declare function chmodAsync(path: string, mode: number): Promise<void>;
export declare function chmodAsync(path: string, mode: string): Promise<void>;
export declare function fchmodAsync(fd: number, mode: number): Promise<void>;
export declare function fchmodAsync(fd: number, mode: string): Promise<void>;
export declare function lchmodAsync(path: string, mode: string): Promise<void>;
export declare function lchmodAsync(path: string, mode: number): Promise<void>;
export declare function statAsync(path: string): Promise<Stats>;
export declare function lstatAsync(path: string): Promise<Stats>;
export declare function fstatAsync(fd: number): Promise<Stats>;
export declare function linkAsync(srcpath: string, dstpath: string): Promise<void>;
export declare function symlinkAsync(srcpath: string, dstpath: string, type?: string): Promise<void>;
export declare function readlinkAsync(path: string): Promise<string>;
export declare function realpathAsync(path: string): Promise<string>;
export declare function realpathAsync(path: string, cache: string): Promise<string>;
export declare function unlinkAsync(path: string): Promise<void>;
export declare function rmdirAsync(path: string): Promise<void>;
export declare function mkdirAsync(path: string, mode?: number): Promise<void>;
export declare function mkdirAsync(path: string, mode?: string): Promise<void>;
export declare function readdirAsync(path: string): Promise<string[]>;
export declare function closeAsync(fd: number): Promise<void>;
export declare function openAsync(path: string, flags: string, mode?: string): Promise<number>;
export declare function utimesAsync(path: string, atime: number, mtime: number): Promise<void>;
export declare function futimesAsync(fd: number, atime: number, mtime: number): Promise<void>;
export declare function fsyncAsync(fd: number): Promise<void>;
export declare function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export declare function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export declare function readFileAsync(filename: string, encoding: string): Promise<string>;
export declare function readFileAsync(filename: string, options: OpenOptions): Promise<string>;
export declare function readFileAsync(filename: string): Promise<NodeBuffer>;
export declare function writeFileAsync(filename: string, data: any, encoding?: string): Promise<void>;
export declare function writeFileAsync(filename: string, data: any, options?: OpenOptions): Promise<void>;
export declare function appendFileAsync(filename: string, data: any, encoding?: string): Promise<void>;
export declare function appendFileAsync(filename: string, data: any, option?: OpenOptions): Promise<void>;
export function renameAsync(oldPath: string, newPath: string): Promise<void>;
export function truncateAsync(fd: number, len: number): Promise<void>;
export function chownAsync(path: string, uid: number, gid: number): Promise<void>;
export function fchownAsync(fd: number, uid: number, gid: number): Promise<void>;
export function lchownAsync(path: string, uid: number, gid: number): Promise<void>;
export function chmodAsync(path: string, mode: number | string): Promise<void>;
export function fchmodAsync(fd: number, mode: number | string): Promise<void>;
export function lchmodAsync(path: string, mode: number | string): Promise<void>;
export function statAsync(path: string): Promise<Stats>;
export function lstatAsync(path: string): Promise<Stats>;
export function fstatAsync(fd: number): Promise<Stats>;
export function linkAsync(srcpath: string, dstpath: string): Promise<void>;
export function symlinkAsync(srcpath: string, dstpath: string, type?: string): Promise<void>;
export function readlinkAsync(path: string): Promise<string>;
export function realpathAsync(path: string, cache?: string): Promise<string>;
export function unlinkAsync(path: string): Promise<void>;
export function rmdirAsync(path: string): Promise<void>;
export function mkdirAsync(path: string, mode?: number | string): Promise<void>;
export function readdirAsync(path: string): Promise<string[]>;
export function closeAsync(fd: number): Promise<void>;
export function openAsync(path: string, flags: string, mode?: string): Promise<number>;
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]>;
/**
* readFileAsync
* @param filename
* @param options:
* string: encoding
* OpenOptions: options
*/
export function readFileAsync(filename: string, options: OpenOptions | string): Promise<string>;
export function readFileAsync(filename: string): Promise<NodeBuffer>;
/**
* writeFileAsync
* @param filename
* @param data
* @param options:
* string: encoding
* OpenOptions: options
*/
export function writeFileAsync(filename: string, data: any, options?: OpenOptions | string): Promise<void>;
/**
* appendFileAsync
* @param filename
* @param data
* @param option:
* string: encoding
* OpenOptions: option
*/
export function appendFileAsync(filename: string, data: any, option?: OpenOptions | string): Promise<void>;
export declare function existsAsync(path: string): Promise<boolean>;
export declare function ensureDirAsync(path: string): Promise<void>;
export function existsAsync(path: string): Promise<boolean>;
export function ensureDirAsync(path: string): Promise<void>;
export function isDirectory(path: string, callback?: (err: Error, isDirectory: boolean) => void): void;
export function isDirectorySync(path: string): boolean;
export function isDirectoryAsync(path: string): Promise<boolean>;

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@@ -1,48 +1,49 @@
import fs = require('fs-extra-promise');
import stream = require('stream');
var stats: fs.Stats;
var str: string;
var strArr: string[];
var bool: boolean;
var num: number;
var src: string;
var dest: string;
var file: string;
var filename: string;
var dir: string;
var path: string;
var data: any;
var object: Object;
var buf: Buffer;
var buffer: NodeBuffer;
var modeNum: number;
var modeStr: string;
var encoding: string;
var type: string;
var flags: string;
var srcpath: string;
var dstpath: string;
var oldPath: string;
var newPath: string;
var cache: { [path: string]: string; };
var offset: number;
var length: number;
var position: number;
var fd: number;
var len: number;
var uid: number;
var gid: number;
var atime: number;
var mtime: number;
var watchListener: (curr: fs.Stats, prev: fs.Stats) => void;
var statsCallback: (err: Error, stats: fs.Stats) => void;
var errorCallback: (err: Error) => void;
var openOpts: fs.ReadOptions;
var writeOpts: fs.WriteOptions;
var watcher: fs.FSWatcher;
var readStream: stream.Readable;
var writeStream: stream.Writable;
let stats: fs.Stats;
let str: string;
let strArr: string[];
let bool: boolean;
let num: number;
let src: string;
let dest: string;
let file: string;
let filename: string;
let dir: string;
let path: string;
let data: any;
let object: object;
let buf: Buffer;
let buffer: NodeBuffer;
let modeNum: number;
let modeStr: string;
let encoding: string;
let type: string;
let flags: string;
let srcpath: string;
let dstpath: string;
let oldPath: string;
let newPath: string;
let cache: { [path: string]: string; };
let offset: number;
let length: number;
let position: number;
let fd: number;
let len: number;
let uid: number;
let gid: number;
let atime: number;
let mtime: number;
let watchListener: (curr: fs.Stats, prev: fs.Stats) => void;
let statsCallback: (err: Error, stats: fs.Stats) => void;
let errorCallback: (err: Error) => void;
let openOpts: fs.ReadOptions;
let writeOpts: fs.WriteOptions;
let watcher: fs.FSWatcher;
let readStream: stream.Readable;
let writeStream: stream.Writable;
let isDirectory: boolean;
fs.copy(src, dest, errorCallback);
fs.copy(src, dest, (src: string) => {
@@ -122,13 +123,10 @@ fs.linkSync(srcpath, dstpath);
fs.symlink(srcpath, dstpath, type, errorCallback);
fs.symlinkSync(srcpath, dstpath, type);
fs.readlink(path, (err: Error, linkString: string) => {
});
fs.realpath(path, (err: Error, resolvedPath: string) => {
});
fs.realpath(path, cache, (err: Error, resolvedPath: string) => {
});
str = fs.realpathSync(path, cache);
fs.unlink(path, errorCallback);
@@ -140,13 +138,11 @@ fs.mkdir(path, modeStr, errorCallback);
fs.mkdirSync(path, modeNum);
fs.mkdirSync(path, modeStr);
fs.readdir(path, (err: Error, files: string[]) => {
});
strArr = fs.readdirSync(path);
fs.close(fd, errorCallback);
fs.closeSync(fd);
fs.open(path, flags, modeNum, (err: Error, fd: number) => {
});
num = fs.openSync(path, flags, modeNum);
fs.utimes(path, atime, mtime, errorCallback);
@@ -156,24 +152,18 @@ 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) => {
});
num = fs.writeSync(fd, buffer, offset, length, position);
fs.read(fd, buffer, offset, length, position, (err: Error, bytesRead: number, buffer: NodeBuffer) => {
});
num = fs.readSync(fd, buffer, offset, length, position);
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
});
fs.readFile(filename, encoding, (err: Error, data: string) => {
});
fs.readFile(filename, openOpts, (err: NodeJS.ErrnoException, data: Buffer) => {
});
fs.readFile(filename, (err: Error, data: NodeBuffer) => {
});
buffer = fs.readFileSync(filename);
str = fs.readFileSync(filename, encoding);
@@ -200,10 +190,8 @@ fs.watchFile(filename, {
}, watchListener);
fs.unwatchFile(filename);
watcher = fs.watch(filename, { persistent: bool }, (event: string, filename: string) => {
});
fs.exists(path, (exists: boolean) => {
});
bool = fs.existsSync(path);
@@ -219,3 +207,10 @@ writeStream = fs.createWriteStream(path, {
flags: str,
encoding: str
});
let isDirectoryCallback = (err: Error, isDirectory: boolean) => {
};
fs.isDirectory(path, isDirectoryCallback);
fs.isDirectory(path);
isDirectory = fs.isDirectorySync(path);
fs.isDirectoryAsync(path);

View File

@@ -1,12 +1,10 @@
// Type definitions for fs-extra-promise 1.0
// Project: https://github.com/overlookmotel/fs-extra-promise
// Definitions by: midknight41 <https://github.com/midknight41>, Jason Swearingen <https://github.com/jasonswearingen>
// Definitions by: midknight41 <https://github.com/midknight41>, Jason Swearingen <https://github.com/jasonswearingen>, Hiromi Shikata <https://github.com/HiromiShikata>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
/// <reference types="node" />
/// <reference types="bluebird" />
/// <reference types="fs-extra" />
import * as stream from 'stream';
import { Stats } from 'fs';
@@ -20,73 +18,94 @@ export interface MkdirOptions {
mode?: number;
}
//promisified versions
export declare function copyAsync(src: string, dest: string): Promise<void>;
export declare function copyAsync(src: string, dest: string, filter: CopyFilter): Promise<void>;
export declare function copyAsync(src: string, dest: string, options: CopyOptions): Promise<void>;
// promisified versions
/**
* copyAsync
* @param src
* @param dest
* @param options
* CopyFilter: filter
* CopyOptions: options
*/
export function copyAsync(src: string, dest: string, options?: CopyFilter | CopyOptions): Promise<void>;
export declare function createFileAsync(file: string): Promise<void>;
export function createFileAsync(file: string): Promise<void>;
export declare function mkdirsAsync(dir: string, options?: MkdirOptions): Promise<void>;
export declare function mkdirpAsync(dir: string, options?: MkdirOptions): Promise<void>;
export function mkdirsAsync(dir: string, options?: MkdirOptions): Promise<void>;
export function mkdirpAsync(dir: string, options?: MkdirOptions): Promise<void>;
export declare function moveAsync(src: string, dest: string, options?: MoveOptions): Promise<void>;
export function moveAsync(src: string, dest: string, options?: MoveOptions): Promise<void>;
export declare function outputFileAsync(file: string, data: any): Promise<void>;
export function outputFileAsync(file: string, data: any): Promise<void>;
export declare function outputJsonAsync(file: string, data: any): Promise<void>;
export declare function outputJSONAsync(file: string, data: any): Promise<void>;
export function outputJsonAsync(file: string, data: any): Promise<void>;
export function outputJSONAsync(file: string, data: any): Promise<void>;
export declare function readJsonAsync(file: string): Promise<any>;
export declare function readJsonAsync(file: string, options?: ReadOptions): Promise<any>;
export declare function readJSONAsync(file: string): Promise<any>;
export declare function readJSONAsync(file: string, options?: ReadOptions): Promise<any>;
export function readJsonAsync(file: string, options?: ReadOptions): Promise<any>;
export function readJSONAsync(file: string, options?: ReadOptions): Promise<any>;
export declare function removeAsync(dir: string): Promise<void>;
export function removeAsync(dir: string): Promise<void>;
export declare function writeJsonAsync(file: string, object: any): Promise<void>;
export declare function writeJsonAsync(file: string, object: any, options?: WriteOptions): Promise<void>;
export declare function writeJSONAsync(file: string, object: any): Promise<void>;
export declare function writeJSONAsync(file: string, object: any, options?: WriteOptions): Promise<void>;
export function writeJsonAsync(file: string, object: any, options?: WriteOptions): Promise<void>;
export function writeJSONAsync(file: string, object: any, options?: WriteOptions): Promise<void>;
export declare function renameAsync(oldPath: string, newPath: string): Promise<void>;
export declare function truncateAsync(fd: number, len: number): Promise<void>;
export declare function chownAsync(path: string, uid: number, gid: number): Promise<void>;
export declare function fchownAsync(fd: number, uid: number, gid: number): Promise<void>;
export declare function lchownAsync(path: string, uid: number, gid: number): Promise<void>;
export declare function chmodAsync(path: string, mode: number): Promise<void>;
export declare function chmodAsync(path: string, mode: string): Promise<void>;
export declare function fchmodAsync(fd: number, mode: number): Promise<void>;
export declare function fchmodAsync(fd: number, mode: string): Promise<void>;
export declare function lchmodAsync(path: string, mode: string): Promise<void>;
export declare function lchmodAsync(path: string, mode: number): Promise<void>;
export declare function statAsync(path: string): Promise<Stats>;
export declare function lstatAsync(path: string): Promise<Stats>;
export declare function fstatAsync(fd: number): Promise<Stats>;
export declare function linkAsync(srcpath: string, dstpath: string): Promise<void>;
export declare function symlinkAsync(srcpath: string, dstpath: string, type?: string): Promise<void>;
export declare function readlinkAsync(path: string): Promise<string>;
export declare function realpathAsync(path: string): Promise<string>;
export declare function realpathAsync(path: string, cache: { [path: string]: string }): Promise<string>;
export declare function unlinkAsync(path: string): Promise<void>;
export declare function rmdirAsync(path: string): Promise<void>;
export declare function mkdirAsync(path: string, mode?: number): Promise<void>;
export declare function mkdirAsync(path: string, mode?: string): Promise<void>;
export declare function readdirAsync(path: string): Promise<string[]>;
export declare function closeAsync(fd: number): Promise<void>;
export declare function openAsync(path: string, flags: string, mode?: string): Promise<number>;
export declare function utimesAsync(path: string, atime: number, mtime: number): Promise<void>;
export declare function futimesAsync(fd: number, atime: number, mtime: number): Promise<void>;
export declare function fsyncAsync(fd: number): Promise<void>;
export declare function writeAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export declare function readAsync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): Promise<[number, NodeBuffer]>;
export declare function readFileAsync(filename: string, encoding: string): Promise<string>;
export declare function readFileAsync(filename: string, options: ReadOptions): Promise<string>;
export declare function readFileAsync(filename: string): Promise<NodeBuffer>;
export declare function writeFileAsync(filename: string, data: any, encoding?: string): Promise<void>;
export declare function writeFileAsync(filename: string, data: any, options?: WriteOptions): Promise<void>;
export declare function appendFileAsync(filename: string, data: any, encoding?: string): Promise<void>;
export declare function appendFileAsync(filename: string, data: any, option?: WriteOptions): Promise<void>;
export function renameAsync(oldPath: string, newPath: string): Promise<void>;
export function truncateAsync(fd: number, len: number): Promise<void>;
export function chownAsync(path: string, uid: number, gid: number): Promise<void>;
export function fchownAsync(fd: number, uid: number, gid: number): Promise<void>;
export function lchownAsync(path: string, uid: number, gid: number): Promise<void>;
export function chmodAsync(path: string, mode: number | string): Promise<void>;
export function fchmodAsync(fd: number, mode: number | string): Promise<void>;
export function lchmodAsync(path: string, mode: number | string): Promise<void>;
export function statAsync(path: string): Promise<Stats>;
export function lstatAsync(path: string): Promise<Stats>;
export function fstatAsync(fd: number): Promise<Stats>;
export function linkAsync(srcpath: string, dstpath: string): Promise<void>;
export function symlinkAsync(srcpath: string, dstpath: string, type?: string): Promise<void>;
export function readlinkAsync(path: string): Promise<string>;
export function realpathAsync(path: string, cache?: { [path: string]: string }): Promise<string>;
export function unlinkAsync(path: string): Promise<void>;
export function rmdirAsync(path: string): Promise<void>;
export function mkdirAsync(path: string, mode?: number | string): Promise<void>;
export function readdirAsync(path: string): Promise<string[]>;
export function closeAsync(fd: number): Promise<void>;
export function openAsync(path: string, flags: string, mode?: string): Promise<number>;
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]>;
/**
* readFileAsync
* @param filename
* @param options:
* string: encoding
* ReadOptions: options
*/
export function readFileAsync(filename: string, options: string | ReadOptions): Promise<string>;
export function readFileAsync(filename: string): Promise<NodeBuffer>;
/**
* writeFileAsync
* @param filename
* @param data
* @param options:
* string: encoding
* WriteOptions: options
*/
export function writeFileAsync(filename: string, data: any, options?: string | WriteOptions): Promise<void>;
/**
* appendFileAsync
* @param filename
* @param data
* @param options:
* string: encoding
* WriteOptions: options
*/
export function appendFileAsync(filename: string, data: any, option?: string | WriteOptions): Promise<void>;
export declare function existsAsync(path: string): Promise<boolean>;
export declare function ensureDirAsync(path: string): Promise<void>;
export function existsAsync(path: string): Promise<boolean>;
export function ensureDirAsync(path: string): Promise<void>;
export function isDirectory(path: string, callback?: (err: Error, isDirectory: boolean) => void): void;
export function isDirectorySync(path: string): boolean;
export function isDirectoryAsync(path: string): Promise<boolean>;

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@@ -5,7 +5,7 @@ function testFramework(): NodeJS.ReadWriteStream {
return null;
}
gulp.task('test', function (cb: Function) {
gulp.task('test', function (cb: () => void) {
gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul()) // Covering files
.pipe(gulp.dest('test-tmp/'))
@@ -17,7 +17,7 @@ gulp.task('test', function (cb: Function) {
});
});
gulp.task('test', function (cb: Function) {
gulp.task('test', function (cb: () => void) {
gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul({includeUntested: true})) // Covering files
.pipe(istanbul.hookRequire())
@@ -29,7 +29,7 @@ gulp.task('test', function (cb: Function) {
});
});
gulp.task('test', function (cb: Function) {
gulp.task('test', function (cb: () => void) {
gulp.src(['lib/**/*.js', 'main.js'])
.pipe(istanbul({includeUntested: true})) // Covering files
.pipe(istanbul.hookRequire())

View File

@@ -94,4 +94,26 @@ gulp.task('javascript', function() {
}
}))
.pipe(gulp.dest('public/scripts'));
});
gulp.task('javascript', function() {
var stream = gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(plugin1())
.pipe(plugin2())
.pipe(sourcemaps.write('../maps', {
clone: true
}))
.pipe(gulp.dest('public/scripts'));
});
gulp.task('javascript', function() {
var stream = gulp.src('src/**/*.js')
.pipe(sourcemaps.init())
.pipe(plugin1())
.pipe(plugin2())
.pipe(sourcemaps.write('../maps', {
clone: { contents: false }
}))
.pipe(gulp.dest('public/scripts'));
});

View File

@@ -15,11 +15,17 @@ interface WriteMapper {
(file: string): string;
}
interface CloneOptions {
contents?: boolean;
deep?: boolean;
}
interface WriteOptions {
addComment?: boolean;
includeContent?: boolean;
sourceRoot?: string | WriteMapper;
sourceMappingURLPrefix?: string | WriteMapper;
clone?: boolean | CloneOptions;
}
export declare function init(opts?: InitOptions): NodeJS.ReadWriteStream;

View File

@@ -7,7 +7,7 @@ gulp.task('stream', () =>
.pipe(gulp.dest('build'))
);
gulp.task('callback', (cb: Function) =>
gulp.task('callback', (cb: () => void) =>
watch('css/**/*.css', () =>
gulp.src('css/**/*.css')
.pipe(watch('css/**/*.css'))
@@ -25,3 +25,15 @@ gulp.task('build', () => {
gulp.src(files, { base: '..' })
.pipe(watch(files, { base: '..' }));
});
gulp.task('build', () => {
var files = [
'app/**/*.ts',
'lib/**/*.ts',
'components/**/*.ts',
];
gulp.src(files, { cwd: '..' })
.pipe(watch(files, { base: '..' }));
});

View File

@@ -5,8 +5,9 @@
/// <reference types="node" />
import {SrcOptions} from "vinyl-fs";
interface IOptions {
interface IOptions extends SrcOptions {
ignoreInitial?: boolean;
events?: Array<string>;
base?: string;

View File

@@ -124,15 +124,5 @@ server.route([{
}
}]);
// Implict handler
server.route({
method: 'GET',
path: '/hello6',
handler: function (request, reply) {
request.log('info', { route: '/hello' }, Date.now());
reply('hello world');
}
});
// Start the server
server.start();

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/jonkemp/inline-css
// Definitions by: Philip Spain <https://github.com/philipisapain>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="bluebird" />

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/joeferner/node-java
// Definitions by: Jim Lloyd <https://github.com/jimlloyd>, Kentaro Teramoto <https://github.com/hrl7>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />

View File

@@ -1,5 +1,3 @@
///<reference types="bluebird"/>
import java = require('java');
import BluePromise = require('bluebird');
@@ -9,7 +7,7 @@ java.asyncOptions = {
promiseSuffix: 'P',
promisify: BluePromise.promisify
};
// todo: figure out why promise doesn't work here
// todo: figure out why promise doesn't work here
/* java.registerClientP((): Promise<void> => {
return BluePromise.resolve();
}); */

View File

@@ -25,14 +25,14 @@
// TypeScript Version: 2.3
declare module 'jquery' {
function factory(window: Window): JQueryStatic;
function factory(window: Window): JQueryStatic & JQuery;
const factoryOrJQuery: typeof factory & JQueryStatic;
export = factoryOrJQuery;
}
declare module 'jquery/dist/jquery.slim' {
function factory(window: Window): JQueryStatic;
function factory(window: Window): JQueryStatic & JQuery;
const factoryOrJQuery: typeof factory & JQueryStatic;
export = factoryOrJQuery;
@@ -129,7 +129,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/ajaxComplete/}
* @since 1.0
*/
ajaxComplete(handler: (this: Document, event: JQuery.Event<TElement>, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this;
ajaxComplete(handler: (this: Document, event: JQuery.Event<Document>, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this;
/**
* Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
*
@@ -137,7 +137,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/ajaxError/}
* @since 1.0
*/
ajaxError(handler: (this: Document, event: JQuery.Event<TElement>, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this;
ajaxError(handler: (this: Document, event: JQuery.Event<Document>, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this;
/**
* Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
*
@@ -145,7 +145,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/ajaxSend/}
* @since 1.0
*/
ajaxSend(handler: (this: Document, event: JQuery.Event<TElement>, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this;
ajaxSend(handler: (this: Document, event: JQuery.Event<Document>, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this;
/**
* Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
*
@@ -169,7 +169,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/ajaxSuccess/}
* @since 1.0
*/
ajaxSuccess(handler: (this: Document, event: JQuery.Event<TElement>, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this;
ajaxSuccess(handler: (this: Document, event: JQuery.Event<Document>, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this;
/**
* Perform a custom animation of a set of CSS properties.
*
@@ -201,15 +201,22 @@ interface JQuery<TElement extends Node = HTMLElement> {
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param duration_easing_complete_options A string or number determining how long the animation will run.
* A string indicating which easing function to use for the transition.
* A function to call once the animation is complete, called once per matched element.
* A map of additional options to pass to the method.
* @param options A map of additional options to pass to the method.
* @see {@link https://api.jquery.com/animate/}
* @since 1.0
*/
animate(properties: JQuery.PlainObject,
duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions<TElement>): this;
options: JQuery.EffectsOptions<TElement>): this;
/**
* Perform a custom animation of a set of CSS properties.
*
* @param properties An object of CSS properties and values that the animation will move toward.
* @param complete A function to call once the animation is complete, called once per matched element.
* @see {@link https://api.jquery.com/animate/}
* @since 1.0
*/
animate(properties: JQuery.PlainObject,
complete?: (this: TElement) => void): this;
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
*
@@ -516,8 +523,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/data/}
* @since 1.2.3
*/
// tslint:disable-next-line:unified-signatures
data(key: string, undefined: undefined): any;
data(key: string, undefined: undefined): any; // tslint:disable-line:unified-signatures
/**
* Store arbitrary data associated with the matched elements.
*
@@ -693,7 +699,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
* @since 1.4.3
*/
fadeIn(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this;
fadeIn(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
/**
* Display the matched elements by fading them to opaque.
*
@@ -726,7 +732,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
* @since 1.4.3
*/
fadeOut(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this;
fadeOut(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
/**
* Hide the matched elements by fading them to transparent.
*
@@ -780,7 +786,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
* @since 1.4.3
*/
fadeToggle(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this;
fadeToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
/**
* Display or hide the matched elements by animating their opacity.
*
@@ -933,7 +939,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/height/}
* @since 1.0
*/
height(): number;
height(): number | undefined;
/**
* Hide the matched elements.
*
@@ -1025,7 +1031,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/innerHeight/}
* @since 1.2.6
*/
innerHeight(): number;
innerHeight(): number | undefined;
/**
* Set the CSS inner width of each element in the set of matched elements.
*
@@ -1045,7 +1051,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/innerWidth/}
* @since 1.2.6
*/
innerWidth(): number;
innerWidth(): number | undefined;
/**
* Insert every element in the set of matched elements after the target.
*
@@ -1148,7 +1154,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
*/
load(url: string,
data: string | JQuery.PlainObject,
complete: (this: TElement, responseText: string, textStatus: string, jqXHR: JQuery.jqXHR) => void): this;
complete: (this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void): this;
/**
* Load data from the server and place the returned HTML into the matched element.
*
@@ -1159,7 +1165,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
*/
load(url: string,
complete_data?: ((this: TElement, responseText: string, textStatus: string, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this;
complete_data?: ((this: TElement, responseText: string, textStatus: JQuery.Ajax.TextStatus, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this;
/**
* Pass each element in the current matched set through a function, producing a new jQuery object
* containing the return values.
@@ -1535,7 +1541,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/outerHeight/}
* @since 1.2.6
*/
outerHeight(includeMargin?: boolean): number;
outerHeight(includeMargin?: boolean): number | undefined;
/**
* Set the CSS outer width of each element in the set of matched elements.
*
@@ -1555,7 +1561,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/outerWidth/}
* @since 1.2.6
*/
outerWidth(includeMargin?: boolean): number;
outerWidth(includeMargin?: boolean): number | undefined;
/**
* Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
*
@@ -1610,7 +1616,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/prepend/}
* @since 1.4
*/
prepend(fn: (this: TElement, elementOfArray: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<Element | Text> | JQuery): this;
prepend(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray<Element | Text> | JQuery): this;
/**
* Insert every element in the set of matched elements to the beginning of the target.
*
@@ -1619,7 +1625,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/prependTo/}
* @since 1.0
*/
prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element | Text> | JQuery): this;
prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray<Element> | JQuery): this;
/**
* Get the immediately preceding sibling of each element in the set of matched elements. If a selector
* is provided, it retrieves the previous sibling only if it matches that selector.
@@ -1695,8 +1701,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/prop/}
* @since 1.6
*/
// tslint:disable-next-line:unified-signatures
prop(propertyName: string, value: any): this;
prop(propertyName: string, value: any): this; // tslint:disable-line:unified-signatures
/**
* Set one or more properties for the set of matched elements.
*
@@ -1996,7 +2001,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
* @since 1.4.3
*/
slideDown(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this;
slideDown(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
/**
* Display the matched elements with a sliding motion.
*
@@ -2029,7 +2034,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
* @since 1.4.3
*/
slideToggle(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this;
slideToggle(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
/**
* Display or hide the matched elements with a sliding motion.
*
@@ -2062,7 +2067,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.0
* @since 1.4.3
*/
slideUp(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this;
slideUp(duration_easing: JQuery.Duration | string, complete: (this: TElement) => void): this;
/**
* Hide the matched elements with a sliding motion.
*
@@ -2155,17 +2160,19 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/toggle/}
* @since 1.0
*/
toggle(duration: JQuery.Duration, complete?: (this: TElement) => void): this;
toggle(duration: JQuery.Duration, complete: (this: TElement) => void): this;
/**
* Display or hide the matched elements.
*
* @param options A map of additional options to pass to the method.
* Use true to show the element or false to hide it.
* @param duration_complete_options_display A string or number determining how long the animation will run.
* A function to call once the animation is complete, called once per matched element.
* A map of additional options to pass to the method.
* Use true to show the element or false to hide it.
* @see {@link https://api.jquery.com/toggle/}
* @since 1.0
* @since 1.3
*/
toggle(options?: JQuery.EffectsOptions<TElement> | boolean): this;
toggle(duration_complete_options_display?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions<TElement> | boolean): this;
/**
* Add or remove one or more classes from each element in the set of matched elements, depending on
* either the class's presence or the value of the state argument.
@@ -2179,10 +2186,11 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.3
* @since 1.4
*/
toggleClass(className: string | ((this: TElement, index: number, className: string, state: boolean) => string),
state?: boolean): this;
toggleClass<TState extends boolean>(className: string | ((this: TElement, index: number, className: string, state: TState) => string),
state?: TState): this;
/**
*
* Add or remove one or more classes from each element in the set of matched elements, depending on
* either the class's presence or the value of the state argument.
*
* @param state A boolean value to determine whether the class should be added or removed.
* @see {@link https://api.jquery.com/toggleClass/}
@@ -2316,7 +2324,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/width/}
* @since 1.0
*/
width(): number;
width(): number | undefined;
/**
* Wrap an HTML structure around each element in the set of matched elements.
*
@@ -2356,7 +2364,7 @@ interface JQuery<TElement extends Node = HTMLElement> {
* @since 1.2
* @since 1.4
*/
wrapInner(wrappingElement: JQuery.htmlString | JQuery.Selector | JQuery | Element | ((this: TElement, index: number) => string)): this;
wrapInner(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | Element | JQuery)): this;
}
interface JQuery<TElement extends Node = HTMLElement> extends ArrayLike<TElement>, Iterable<TElement> { }
@@ -2553,8 +2561,7 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
* @see {@link https://api.jquery.com/jQuery.data/}
* @since 1.2.3
*/
// tslint:disable-next-line:unified-signatures
data(element: Element, key: string, undefined: undefined): any;
data(element: Element, key: string, undefined: undefined): any; // tslint:disable-line:unified-signatures
/**
* Store arbitrary data associated with the specified element. Returns the value that was set.
*
@@ -4043,6 +4050,7 @@ declare namespace JQuery {
// region Effects
type Duration = number | 'fast' | 'slow';
// TODO: Is the first element always a string or is that specific to the 'fx' queue?
type Queue<TElement> = { 0: string; } & Array<QueueFunction<TElement>>;
interface QueueFunction<TElement> {
@@ -4094,7 +4102,7 @@ declare namespace JQuery {
* An object containing one or more of the CSS properties defined by the properties argument and their
* corresponding easing functions.
*/
specialEasing?: PlainObject;
specialEasing?: PlainObject<string>;
/**
* A function to call when the animation on an element begins.
*/

File diff suppressed because it is too large Load Diff

View File

@@ -1822,8 +1822,8 @@ function examples() {
}
function finish_0() {
var horiz = $('#path').width() - 20,
vert = $('#path').height() - 20;
var horiz = $('#path').width()! - 20,
vert = $('#path').height()! - 20;
var btns: { [key: string]: () => void; } = {
bstt: function() {
@@ -1992,13 +1992,13 @@ function examples() {
}
$('#getp').click(function() {
showHeight('paragraph', $('p').height());
showHeight('paragraph', $('p').height()!);
});
$('#getd').click(function() {
showHeight('document', $(document).height());
showHeight('document', $(document).height()!);
});
$('#getw').click(function() {
showHeight('window', $(window).height());
showHeight('window', $(window).height()!);
});
}
@@ -4935,13 +4935,13 @@ function examples() {
}
$('#getp').click(function() {
showWidth('paragraph', $('p').width());
showWidth('paragraph', $('p').width()!);
});
$('#getd').click(function() {
showWidth('document', $(document).width());
showWidth('document', $(document).width()!);
});
$('#getw').click(function() {
showWidth('window', $(window).width());
showWidth('window', $(window).width()!);
});
}

View File

@@ -0,0 +1,8 @@
import jQueryFactory = require('jquery');
const jq = jQueryFactory(window);
// ExpectType will report 'jq' as 'JQueryStatic<HTMLElement> & JQuery<HTMLElement>' even though the compiler seems to know that 'jq' is 'JQueryStatic<HTMLElement>'
// // $ExpectType JQueryStatic<HTMLElement>
// jq;
// jq === jQuery();
jq === jQuery;

View File

@@ -0,0 +1,8 @@
import jQueryFactory = require('jquery/dist/jquery.slim');
const jq = jQueryFactory(window);
// ExpectType will report 'jq' as 'JQueryStatic<HTMLElement> & JQuery<HTMLElement>' even though the compiler seems to know that 'jq' is 'JQueryStatic<HTMLElement>'
// // $ExpectType JQueryStatic<HTMLElement>
// jq;
// jq === jQuery();
jq === jQuery;

View File

@@ -0,0 +1,8 @@
import * as jq from 'jquery/dist/jquery.slim';
const $window = jq(window);
// ExpectType will report 'jq' as 'JQueryStatic<HTMLElement> & JQuery<HTMLElement>' even though the compiler seems to know that 'jq' is 'JQuery<HTMLElement>'
// // $ExpectType JQuery<HTMLElement>
// $window;
// $window === jq;
$window === jq();

View File

@@ -0,0 +1,8 @@
import * as jq from 'jquery';
const $window = jq(window);
// ExpectType will report 'jq' as 'JQueryStatic<HTMLElement> & JQuery<HTMLElement>' even though the compiler seems to know that 'jq' is 'JQuery<HTMLElement>'
// // $ExpectType JQuery<HTMLElement>
// $window;
// $window === jq;
$window === jq();

View File

@@ -1,7 +0,0 @@
import factory = require('jquery');
const jq = factory(window);
jq.noop();
import slimFactory = require('jquery/dist/jquery.slim');
const slim = slimFactory(window);
slim.noop();

View File

@@ -22,6 +22,9 @@
"jquery-tests.ts",
"test/example-tests.ts",
"test/longdesc-tests.ts",
"test/module-tests.ts"
"test/jquery-no-window-module-tests.ts",
"test/jquery-window-module-tests.ts",
"test/jquery-slim-no-window-module-tests.ts",
"test/jquery-slim-window-module-tests.ts"
]
}

View File

@@ -30,7 +30,7 @@ User.find(1).then(function (user:IUser) {
var user:IUser = User.createInstance({name: 'John'});
var store = new JSData.DS();
var User2 = store.defineResource('user');
var User2 = store.defineResource<IUser>('user');
var user:IUser = User2.inject({id: 1, name: 'John'});
var user2:IUser = User2.inject({id: 1, age: 30});

View File

@@ -1,15 +1,15 @@
// Type definitions for jwt-decode v2.2.0
// Type definitions for jwt-decode 2.2
// Project: https://github.com/auth0/jwt-decode
// Definitions by: Giedrius Grabauskas <https://github.com/QuatroDevOfficial/>, Mads Madsen <https://github.com/madsmadsen>
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>, Mads Madsen <https://github.com/madsmadsen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace JwtDecode {
interface JwtDecodeStatic {
(token: string, options?: { header: boolean }): any;
interface Options {
header: boolean;
}
}
declare var jwtDecode: JwtDecode.JwtDecodeStatic;
export = jwtDecode;
export as namespace jwt_decode;
declare function JwtDecode<TTokenDto>(token: string, options?: JwtDecode.Options): TTokenDto;
export = JwtDecode;
export as namespace jwt_decode;

View File

@@ -1,7 +1,6 @@
import jwtDecode = require('jwt-decode');
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";
import * as jwtDecode from "jwt-decode";
const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";
interface TokenDto {
foo: string;
@@ -14,5 +13,7 @@ interface TokenHeaderDto {
alg: string;
}
let decodedTokenPayload = jwtDecode(token) as TokenDto;
let decodedTokenHeader = jwtDecode(token, { header: true }) as TokenHeaderDto;
const decodedTokenPayloadOld = jwtDecode(token) as TokenDto;
const decodedTokenPayload = jwtDecode<TokenDto>(token);
const decodedTokenHeaderOld = jwtDecode(token, { header: true }) as TokenHeaderDto;
const decodedTokenHeader = jwtDecode<TokenHeaderDto>(token, { header: true });

View File

@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -19,4 +19,4 @@
"index.d.ts",
"jwt-decode-tests.ts"
]
}
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

11
types/jwt-decode/v1/index.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
// Type definitions for jwt-decode 1.4
// Project: https://github.com/auth0/jwt-decode
// Definitions by: Giedrius Grabauskas <https://github.com/QuatroDevOfficial/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace JwtDecode { }
declare function JwtDecode<TTokenDto>(token: string): TTokenDto;
export = JwtDecode;
export as namespace jwt_decode;

View File

@@ -0,0 +1,12 @@
import jwtDecode = require('jwt-decode');
const token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";
interface TokenDto {
foo: string;
exp: number;
iat: number;
}
const decodedTokenOld = jwtDecode(token) as TokenDto;
const decodedToken = jwtDecode<TokenDto>(token);

View File

@@ -0,0 +1,27 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"jwt-decode": [
"jwt-decode/v1"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jwt-decode-tests.ts"
]
}

View File

@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}

View File

@@ -6,11 +6,12 @@
// # Classes
export declare class Client {
constructor(connectionString: string, clientId: string, options?: ZKOptions);
constructor(connectionString: string, clientId?: string, options?: ZKOptions);
close(callback?: Function): void;
topicExists(topics: Array<string>, callback: Function): void;
refreshMetadata(topics: Array<string>, cb?: (error: any, data: any) => any): void;
close(cb: (error: any) => any): void;
sendOffsetCommitV2Request(group: string, generationId: number, memberId: string, commits: Array<OffsetCommitRequest>, cb: (error: any, data: any) => any): void;
}
export declare class Producer {
@@ -70,6 +71,8 @@ export declare class ConsumerGroup extends HighLevelConsumer {
on(eventName: string, cb: (message: string) => any): void;
on(eventName: string, cb: (error: any) => any): void;
close(force: boolean, cb: (error: any) => any): void;
generationId: number;
memberId: string;
}
export declare class Offset {

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/karma-runner/karma-coverage
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as karma from 'karma';
import * as istanbul from 'istanbul';

View File

@@ -2,8 +2,8 @@
// Project: https://github.com/karma-runner/karma
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="bluebird" />
/// <reference types="node" />
// See Karma public API https://karma-runner.github.io/0.13/dev/public-api.html
@@ -54,7 +54,7 @@ declare namespace karma {
};
EXIT_CODE: string;
}
interface LauncherStatic {
generateId(): string;
//TODO: injector should be of type `di.Injector`

View File

@@ -2,9 +2,8 @@
// Project: https://github.com/tgriesser/knex
// Definitions by: Qubo <https://github.com/tkQubo>, Baronfel <https://github.com/baronfel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
/// <reference types="bluebird" />
/// <reference types="node" />
import events = require("events");

13
types/kue/index.d.ts vendored
View File

@@ -1,6 +1,7 @@
// Type definitions for kue 0.11.x
// Project: https://github.com/Automattic/kue
// Definitions by: Nicholas Penree <http://github.com/drudge>
// Amiram Korach <http://github.com/amiram>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -29,7 +30,7 @@ export declare class Queue extends events.EventEmitter {
checkActiveJobTtl(ttlOptions: Object): void;
watchStuckJobs(ms: number): void;
setting(name: string, fn: Function): Queue;
process(type: string, n?: number, fn?: Function): void;
process(type: string, n?: number | DoneCallback, fn?: DoneCallback): void;
shutdown(timeout: number, type: string, fn: Function): Queue;
types(fn: Function): Queue;
state(string: string, fn: Function): Queue;
@@ -56,17 +57,24 @@ interface Priorities {
critical: number;
}
export type DoneCallback = (err?: any, result?: any) => void;
export type JobCallback = (err?: any, job?: Job) => void;
export declare class Job extends events.EventEmitter {
public id: number;
public type: string;
public data: any;
public result: any;
// Should always be a number however currently it is a number when creating and a string when loading
// https://github.com/Automattic/kue/issues/1081
public created_at: string | number;
public client: redisClientFactory.RedisClient;
private _max_attempts;
static priorities: Priorities;
static disableSearch: boolean;
static jobEvents: boolean;
static get(id: number, fn: Function): void;
static get(id: number, type: string | JobCallback, fn?: JobCallback): void;
static remove(id: number, fn?: Function): void;
static removeBadJob(id: number): void;
static log(id: number, fn: Function): void;
@@ -79,6 +87,7 @@ export declare class Job extends events.EventEmitter {
log(str: string): Job;
set(key: string, val: string, fn?: Function): Job;
get(key: string, fn?: Function): Job;
get(key: string, jobType: string, fn?: Function): Job;
progress(complete: number, total: number, data?: any): Job;
delay(ms: number | Date): Job;
removeOnComplete(param: any): Job;

View File

@@ -39,6 +39,13 @@ function create() {
job.save();
kue.Job.get(job.id, function (err: any, _job: kue.Job) {
console.log('get job', _job);
});
kue.Job.get(job.id, 'video conversion', function (err: any, _job: kue.Job) {
console.log('get job', _job);
});
setTimeout( create, Math.random() * 2000 | 0 );
}
@@ -46,25 +53,28 @@ create();
// process video conversion jobs, 1 at a time.
jobs.process('video conversion', 1, function(job: kue.Job, done: Function) {
var processCb = function(job: kue.Job, done: kue.DoneCallback) {
var frames: number = job.data.frames;
function next(i: number) {
// pretend we are doing some work
convertFrame(i, function(err: Error) {
convertFrame(i, function(err: Error, result: any) {
if (err) return done(err);
// report progress, i/frames complete
job.progress(i, frames);
if (i >= frames) done();
if (i >= frames) done(null, result);
else next(i + Math.random() * 10);
} );
}
next(0);
} );
}
jobs.process('video conversion', 1, processCb);
jobs.process('video conversion', processCb);
function convertFrame(i: number, fn: Function) {
setTimeout(fn, Math.random() * 50);
setTimeout(() => fn(null, Math.random()), Math.random() * 50);
}
// one minute
@@ -102,4 +112,4 @@ jobs.process('email', 10, function(job: kue.Job, done: Function) {
// start the UI
kue.app.listen(3000);
console.log('UI started on port 3000');
console.log('UI started on port 3000');

View File

@@ -7,7 +7,7 @@
export as namespace mime;
export function lookup(path: string, fallback: string): string;
export function lookup(path: string, fallback?: string): string;
export function extension(mime: string): string;
export function load(filepath: string): void;
export function define(mimes: { [key: string]: any }): void;

16
types/natsort/index.d.ts vendored Normal file
View File

@@ -0,0 +1,16 @@
// Type definitions for natsort 1.0
// Project: https://github.com/bubkoo/natsort
// Definitions by: Melvin Groenhoff <https://github.com/mgroenhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function natsort(options?: natsort.Options): (a: any, b: any) => number;
declare namespace natsort {
interface Options {
desc?: boolean;
insensitive?: boolean;
}
}
export = natsort;
export as namespace nasort;

View File

@@ -0,0 +1,155 @@
import * as natsort from "natsort";
const someArr = [2, 5, 3, 4, 1, 'a', 'B'];
someArr.sort(natsort());
someArr.sort(natsort({ desc: true }));
someArr.sort(natsort({ insensitive: true }));
// sort with object array
const objArr = [
{ val: 'B' },
{ val: 'a' },
{ val: 'D' },
{ val: 'c' }
];
const sorter = natsort();
objArr.sort((a, b) => {
return sorter(a.val, b.val);
});
// simple numerics
['10', 9, 2, '1', '4'].sort(natsort());
// ['1',2,'4',9,'10']
// floats
[
'10.0401',
10.022,
10.042,
'10.021999'
].sort(natsort());
// [
// '10.021999',
// 10.022,
// '10.0401',
// 10.042
// ]
// float & decimal notation
[
'10.04f',
'10.039F',
'10.038d',
'10.037D'
].sort(natsort());
// [
// '10.037D',
// '10.038d',
// '10.039F',
// '10.04f'
// ]
// scientific notation
[
'1.528535047e5',
'1.528535047e7',
'1.528535047e3'
].sort(natsort());
// [
// '1.528535047e3',
// '1.528535047e5',
// '1.528535047e7'
// ]
// ip addresses
[
'192.168.0.100',
'192.168.0.1',
'192.168.1.1'
].sort(natsort());
// [
// '192.168.0.1',
// '192.168.0.100',
// '192.168.1.1'
// ]
// Filenames
[
'car.mov',
'01alpha.sgi',
'001alpha.sgi',
'my.string_41299.tif'
].sort(natsort());
// [
// '001alpha.sgi',
// '01alpha.sgi',
// 'car.mov',
// 'my.string_41299.tif'
// ]
// dates
[
'10/12/2008',
'10/11/2008',
'10/11/2007',
'10/12/2007'
].sort(natsort());
// [
// '10/11/2007',
// '10/12/2007',
// '10/11/2008',
// '10/12/2008'
// ]
// money
[
'$10002.00',
'$10001.02',
'$10001.01'
].sort(natsort());
// [
// '$10001.01',
// '$10001.02',
// '$10002.00'
// ]
// versions
[
'1.0.2',
'1.0.1',
'1.0.0',
'1.0.9'
].sort(natsort());
// [
// '1.0.0',
// '1.0.1',
// '1.0.2',
// '1.0.9'
// ]
// movie titles
[
'1 Title - The Big Lebowski',
'1 Title - Gattaca',
'1 Title - Last Picture Show'
].sort(natsort());
// [
// '1 Title - Gattaca',
// '1 Title - Last Picture Show',
// '1 Title - The Big Lebowski'
// ]
// by default - case-sensitive sorting
['a', 'B'].sort(natsort());
// ['B', 'a']
// enable case-insensitive sorting
['a', 'B'].sort(natsort({ insensitive: true }));
// ['a', 'B']
// desc
[4, 2, 3, 5, 1].sort(natsort({ desc: true }));
// [1, 2, 3, 4, 5]

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"natsort-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -122,7 +122,7 @@ declare class Getopt {
* equals new Getopt(options)
* @param options
*/
static create(options: string[]): Getopt;
static create(options: string[][]): Getopt;
}
export = Getopt;

View File

@@ -34,7 +34,7 @@ function help() {
function onedragon() {
// examples/onedragon.js
var opt = require('node-getopt').create([
var opt = Getopt.create([
['s' , '' , 'short option.'],
['' , 'long' , 'long option.'],
['S' , 'short-with-arg=ARG' , 'option with argument'],
@@ -52,7 +52,7 @@ function onedragon() {
function online(){
// node-getopt oneline example.
var opt = require('..').create([
var opt = Getopt.create([
['s' , '' , 'short option.'],
['' , 'long' , 'long option.'],
['S' , 'short-with-arg=ARG' , 'option with argument'],

View File

@@ -2,6 +2,7 @@
// Project: https://github.com/nodets/node-mysql-wrapper
// Definitions by: Makis Maropoulos <https://github.com/kataras>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
///<reference path="./my-meteor.d.ts" />
@@ -49,20 +50,20 @@ interface IQueryConstructor<T> {
declare class Helper {
/**
/**
* Callback like forEach
* @name valueCallback
* @function
* @param {T} the value of the object's key
* @param {T} the value of the object's key
* @returnTye {U}
* @return {U}
*/
/**
* CallbaforEach
* @name keyCallback
* @function
* @param {string} the name of the object's key
* @param {string} the name of the object's key
* @returnTye {U}
* @return {U}
*/
@@ -158,7 +159,7 @@ declare class CriteriaParts implements ICriteriaParts {
noDatabaseProperties: string[];
/**
* The converted/exported where clause.
* The converted/exported where clause.
*/
whereClause: string;
@@ -472,7 +473,7 @@ declare class Connection extends EventEmitter {
eventTypes: string[];
/**
* Force to fetch ONLY these Database table names {array of string}.
* Force to fetch ONLY these Database table names {array of string}.
*/
tableNamesToUseOnly: any[];
@@ -495,7 +496,7 @@ declare class Connection extends EventEmitter {
* Attach a real connection.
* @param {Mysql.IConnection} connection the real connection object.
* @returnType {nothing}
* @return {nothing}
* @return {nothing}
*/
attach(connection: Mysql.IConnection): void;
@@ -503,13 +504,13 @@ declare class Connection extends EventEmitter {
* Close the entire real connection and remove all event's listeners (if exist).
* @param {function} callback If error occurs when closing the connection, this callback has the responsibility to catch it.
* @returnType {nothing}
* @return {nothing}
* @return {nothing}
*/
end(callback?: (error: any) => void): void;
/**
* Close the entire real connection and remove all event's listeners (if exist).
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
*/
destroy(): void;
@@ -545,7 +546,7 @@ declare class Connection extends EventEmitter {
/**
* Escape the query column's value and return it.
* @param {string} val the value which will be escaped.
* @param {string} val the value which will be escaped.
* @returnType {string}
* @return {string}
*/
@@ -565,7 +566,7 @@ declare class Connection extends EventEmitter {
* Adds an event listener/watcher on a table for a 'database event'.
* @param {string} tableName the table name which you want to add the event listener.
* @param {string or string[]} evtType the event(s) type you want to watch, one of these(string) or an array of them(string[]): ["INSERT", "UPDATE", "REMOVE", "SAVE"].
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawRows (results after query executed and before parsed to object(s)).
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawRows (results after query executed and before parsed to object(s)).
* @returnType {nothing}
* @return {nothing}
*/
@@ -573,7 +574,7 @@ declare class Connection extends EventEmitter {
/**
* Removes an event listener/watcher from a table for a specific event type.
* @param {string} tableName the table name which you want to remove the event listener.
* @param {string} tableName the table name which you want to remove the event listener.
* @param {string} evtType the Event type you want to remove, one of these: "INSERT", "UPDATE", "REMOVE", "SAVE".
* @param {function} callbackToRemove the callback that you were used for watch this event type.
* @returnType {nothing}
@@ -587,13 +588,13 @@ declare class Connection extends EventEmitter {
* @param {function} callback the function will be called and fill the one and only parameter when an errors occurs.
* @param {any[]} queryArguments (optional) the query arguments you want to pass into query. ['arg1','arg2']...
* @returnType {nothing}
* @return {nothing}
* @return {nothing}
*/
query(queryStr: string, callback: (err: Mysql.IError, results: any) => any, queryArguments?: any[]): void;
/**
* Returns a MysqlTable object from the database factory. (Note: this method doesn't create anything, just finds and returns the correct table, you don't have to create anything at all. Tables are fetched by the library itself.)
* If you are using typescript you can pass a class (generic<T>) in order to use the auto completion assistance on table's results methods(find,findById,findAll,save,remove,safeRemove).
* If you are using typescript you can pass a class (generic<T>) in order to use the auto completion assistance on table's results methods(find,findById,findAll,save,remove,safeRemove).
* @param {string} tableName the table name which you want to get, on the form of: 'anyDatabaseTable' OR 'any_database_table' (possible your real table name into your database).
* @returnType {MysqlTable}
* @return {MysqlTable}
@@ -602,7 +603,7 @@ declare class Connection extends EventEmitter {
}
declare class Table<T> {
/** Private keywords here are useless but I put them.
/** Private keywords here are useless but I put them.
* If the developer wants to see the properties of the Table class, he/she just comes here.
*/
@@ -630,17 +631,17 @@ declare class Table<T> {
primaryKey: string;
/**
* The MysqlConnection object which this MysqlTable belongs.
* The MysqlConnection object which this MysqlTable belongs.
*/
connection: Connection;
/**
* The real database name of the table. Autofilled by library.
* The real database name of the table. Autofilled by library.
*/
name: string;
/**
* Set of the query rules that will be applied after the 'where clause' on each select query executed by this table.
* Set of the query rules that will be applied after the 'where clause' on each select query executed by this table.
* @return {SelectQueryRules}
*/
rules: SelectQueryRules;
@@ -661,7 +662,7 @@ declare class Table<T> {
/**
* Adds or turn on an event listener/watcher on a table for a 'database event'.
* @param {string} evtType the event type you want to watch, one of these: ["INSERT", "UPDATE", "REMOVE", "SAVE"].
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawResults (results after query executed and before exports to object(s)).
* @param {function} callback Callback which has one parameter(typeof any[]) which filled by the rawResults (results after query executed and before exports to object(s)).
* @returnType {nothing}
* @return {nothing}
*/
@@ -689,7 +690,7 @@ declare class Table<T> {
* @param {string} functionName the function name you want to use, this is used when you want to call this function later.
* @param {function} theFunction the function with any optional parameters you want to pass along.
* @returnType {nothing}
* @return {nothing}
* @return {nothing}
*/
extend(functionName: string, theFunction: (...args: any[]) => any): void;
@@ -726,9 +727,9 @@ declare class Table<T> {
getPrimaryKeyValue(jsObject: any): number | string;
/**
*
*
*/
find(criteriaRawJsObject: any): Promise<T[]>; // only criteria
find(criteriaRawJsObject: any): Promise<T[]>; // only criteria
find(criteriaRawJsObject: any, callback: ((_results: T[]) => any)): Promise<T[]>; // criteria and callback
find(criteriaRawJsObject: any, callback?: (_results: T[]) => any): Promise<T[]>;
@@ -792,7 +793,7 @@ declare class Database {
/**
* Close the entire real connection and remove all event's listeners (if exist).
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
* the difference from the 'end' is that this method doesn't care about errors so no callback passing here.
*/
destroy(): void;
@@ -800,7 +801,7 @@ declare class Database {
* Close the entire real connection and remove all event's listeners (if exist).
* @param {function} maybeAcallbackError If error occurs when closing the connection, this callback has the responsibility to catch it.
* @returnType {nothing}
* @return {nothing}
* @return {nothing}
*/
end(maybeAcallbackError: (err: any) => void): void;

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