Merge branch 'master' into axe-webdriverjs-analyze

This commit is contained in:
Tyler Krupicka
2019-03-11 12:26:12 -07:00
committed by GitHub
679 changed files with 17494 additions and 4486 deletions
+294 -190
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -2,7 +2,9 @@ language: node_js
node_js:
- 8
sudo: false
notifications:
email: false
script:
- npm run test
- if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate 1; fi
+84 -6
View File
@@ -216,12 +216,24 @@
"sourceRepoURL": "https://github.com/blakeembrey/camel-case",
"asOfVersion": "1.2.1"
},
{
"libraryName": "camelcase",
"typingsPackageName": "camelcase",
"sourceRepoURL": "https://github.com/sindresorhus/camelcase",
"asOfVersion": "5.2.0"
},
{
"libraryName": "catalog",
"typingsPackageName": "catalog",
"sourceRepoURL": "https://github.com/interactivethings/catalog",
"asOfVersion": "3.5.0"
},
{
"libraryName": "chai-http",
"typingsPackageName": "chai-http",
"sourceRepoURL": "https://github.com/chaijs/chai-http",
"asOfVersion": "4.2.0"
},
{
"libraryName": "chalk",
"typingsPackageName": "chalk",
@@ -264,6 +276,12 @@
"sourceRepoURL": "https://github.com/tj/commander.js",
"asOfVersion": "2.12.2"
},
{
"libraryName": "conf",
"typingsPackageName": "conf",
"sourceRepoURL": "https://github.com/sindresorhus/conf",
"asOfVersion": "3.0.0"
},
{
"libraryName": "confirmdialog",
"typingsPackageName": "confirmdialog",
@@ -522,6 +540,12 @@
"sourceRepoURL": "https://github.com/Sembiance/email-validator",
"asOfVersion": "1.0.6"
},
{
"libraryName": "env-paths",
"typingsPackageName": "env-paths",
"sourceRepoURL": "https://github.com/sindresorhus/env-paths",
"asOfVersion": "2.1.0"
},
{
"libraryName": "error-stack-parser",
"typingsPackageName": "error-stack-parser",
@@ -690,6 +714,12 @@
"sourceRepoURL": "https://github.com/jdalrymple/node-gitlab",
"asOfVersion": "2.0.0"
},
{
"libraryName": "globby",
"typingsPackageName": "globby",
"sourceRepoURL": "https://github.com/sindresorhus/globby",
"asOfVersion": "9.1.0"
},
{
"libraryName": "Google Cloud Storage",
"typingsPackageName": "google-cloud__storage",
@@ -1014,6 +1044,12 @@
"sourceRepoURL": "https://github.com/steelsojka/lodash-decorators",
"asOfVersion": "4.0.0"
},
{
"libraryName": "log-update",
"typingsPackageName": "log-update",
"sourceRepoURL": "https://github.com/sindresorhus/log-update",
"asOfVersion": "3.1.0"
},
{
"libraryName": "log4javascript",
"typingsPackageName": "log4javascript",
@@ -1038,6 +1074,12 @@
"sourceRepoURL": "https://github.com/blakeembrey/lower-case-first",
"asOfVersion": "1.0.1"
},
{
"libraryName": "make-dir",
"typingsPackageName": "make-dir",
"sourceRepoURL": "https://github.com/sindresorhus/make-dir",
"asOfVersion": "2.1.0"
},
{
"libraryName": "mali",
"typingsPackageName": "mali",
@@ -1110,6 +1152,12 @@
"sourceRepoURL": "https://github.com/LearnBoost/monk.git",
"asOfVersion": "6.0.0"
},
{
"libraryName": "move-file",
"typingsPackageName": "move-file",
"sourceRepoURL": "https://github.com/sindresorhus/move-file",
"asOfVersion": "1.1.0"
},
{
"libraryName": "MQTT",
"typingsPackageName": "mqtt",
@@ -1134,12 +1182,6 @@
"sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme",
"asOfVersion": "2.15.0"
},
{
"libraryName": "png-async",
"typingsPackageName": "png-async",
"sourceRepoURL": "https://github.com/kanreisa/node-png-async",
"asOfVersion": "0.9.4"
},
{
"libraryName": "node-waves",
"typingsPackageName": "node-waves",
@@ -1170,12 +1212,24 @@
"sourceRepoURL": "https://github.com/foretagsplatsen/numbro/",
"asOfVersion": "1.9.3"
},
{
"libraryName": "on-change",
"typingsPackageName": "on-change",
"sourceRepoURL": "https://github.com/sindresorhus/on-change",
"asOfVersion": "1.1.0"
},
{
"libraryName": "Onsen UI",
"typingsPackageName": "onsenui",
"sourceRepoURL": "http://onsen.io",
"asOfVersion": "2.0.0"
},
{
"libraryName": "ora",
"typingsPackageName": "ora",
"sourceRepoURL": "https://github.com/sindresorhus/ora",
"asOfVersion": "3.2.0"
},
{
"libraryName": "p-event",
"typingsPackageName": "p-event",
@@ -1278,12 +1332,24 @@
"sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js",
"asOfVersion": "1.0.4"
},
{
"libraryName": "pkg-conf",
"typingsPackageName": "pkg-conf",
"sourceRepoURL": "https://github.com/sindresorhus/pkg-conf",
"asOfVersion": "3.0.0"
},
{
"libraryName": "plottable",
"typingsPackageName": "plottable",
"sourceRepoURL": "http://plottablejs.org/",
"asOfVersion": "3.7.0"
},
{
"libraryName": "png-async",
"typingsPackageName": "png-async",
"sourceRepoURL": "https://github.com/kanreisa/node-png-async",
"asOfVersion": "0.9.4"
},
{
"libraryName": "poly2tri.js",
"typingsPackageName": "poly2tri",
@@ -1326,6 +1392,12 @@
"sourceRepoURL": "https://github.com/kazuhikoarase/qrcode-generator",
"asOfVersion": "1.0.6"
},
{
"libraryName": "query-string",
"typingsPackageName": "query-string",
"sourceRepoURL": "https://github.com/sindresorhus/query-string",
"asOfVersion": "6.3.0"
},
{
"libraryName": "Raven JS",
"typingsPackageName": "raven-js",
@@ -1968,6 +2040,12 @@
"sourceRepoURL": "none",
"asOfVersion": "2.1.0"
},
{
"libraryName": "zapier-platform-core",
"typingsPackageName": "zapier-platform-core",
"sourceRepoURL": "https://github.com/zapier/zapier-platform-core",
"asOfVersion": "6.1.0"
},
{
"libraryName": "zetapush-js",
"typingsPackageName": "zetapush-js",
File diff suppressed because it is too large Load Diff
+10
View File
@@ -0,0 +1,10 @@
declare namespace AMap {
class ArrayBounds {
constructor(bounds: LocationValue[]);
bounds: LngLat[];
contains(point: LocationValue): boolean;
// internal
toBounds(): Bounds;
getCenter(): LngLat;
}
}
+12
View File
@@ -0,0 +1,12 @@
declare namespace AMap {
class Bounds {
constructor(southWest: LngLat, northEast: LngLat);
contains(point: LocationValue): boolean;
getCenter(): LngLat;
getSouthWest(): LngLat;
getSouthEast(): LngLat;
getNorthEast(): LngLat;
getNorthWest(): LngLat;
toString(): string;
}
}
+51
View File
@@ -0,0 +1,51 @@
declare namespace AMap {
namespace Browser {
const ua: string;
const mobile: boolean;
const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other';
const mac: boolean;
const windows: boolean;
const ios: boolean;
const iPad: boolean;
const iPhone: boolean;
const android: boolean;
const android23: boolean;
const chrome: boolean;
const firefox: boolean;
const safari: boolean;
const wechat: boolean;
const uc: boolean;
const qq: boolean;
const ie: boolean;
const ie6: boolean;
const ie7: boolean;
const ie8: boolean;
const ie9: boolean;
const ie10: boolean;
const ie11: boolean;
const edge: boolean;
const ielt9: boolean;
const baidu: boolean;
const isLocalStorage: boolean;
const isGeolocation: boolean;
const mobileWebkit: boolean;
const mobileWebkit3d: boolean;
const mobileOpera: boolean;
const retina: boolean;
const touch: boolean;
const msPointer: boolean;
const pointer: boolean;
const webkit: boolean;
const ie3d: boolean;
const webkit3d: boolean;
const gecko3d: boolean;
const opera3d: boolean;
const any3d: boolean;
const isCanvas: boolean;
const isSvg: boolean;
const isVML: boolean;
const isWorker: boolean;
const isWebsocket: boolean;
function isWebGL(): boolean;
}
}
+22
View File
@@ -0,0 +1,22 @@
declare namespace AMap {
type SizeValue = Size | [number, number];
type LocationValue = LngLat | [number, number];
type Lang = 'zh_cn' | 'en' | 'zh_en';
type Event<N extends string = string, V = undefined> = { type: N } &
(V extends HTMLElement ? { value: V }
: V extends object ? V
: V extends undefined ? {}
: { value: V });
type MapsEvent<N extends string, I> = Event<N, {
lnglat: LngLat;
pixel: Pixel;
target: I
}>;
type StrokeLineJoin = 'miter' | 'round' | 'bevel';
type StrokeLineCap = 'butt' | 'round' | 'square';
type StrokeStyle = 'dashed' | 'solid';
type AnimationName = 'AMAP_ANIMATION_NONE' | 'AMAP_ANIMATION_DROP' | 'AMAP_ANIMATION_BOUNCE';
}
+15
View File
@@ -0,0 +1,15 @@
declare namespace AMap {
namespace convertFrom {
interface Result {
info: string; // 'ok'
locations: LngLat[];
}
type Type = 'gps' | 'baidu' | 'mapbar';
type SearchStatus = 'complete' | 'error';
}
function convertFrom(
lnglat: LocationValue | LocationValue[],
type: convertFrom.Type | null,
callback: (status: convertFrom.SearchStatus, result: string | convertFrom.Result) => void
): void;
}
+31
View File
@@ -0,0 +1,31 @@
declare namespace AMap {
namespace DomUtil {
function getViewport(dom: HTMLElement): Size;
function getViewportOffset(dom: HTMLElement): Pixel;
function create<K extends keyof HTMLElementTagNameMap>(
tagName: K,
parent?: HTMLElement,
className?: string
): HTMLElementTagNameMap[K];
function setClass(dom: HTMLElement, className?: string): void;
function hasClass(dom: HTMLElement, className: string): boolean;
function addClass(dom: HTMLElement, className: string): void;
function removeClass(dom: HTMLElement, className: string): void;
function setOpacity(dom: HTMLElement, opacity: number): void;
function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void;
function setCss(dom: HTMLElement | HTMLElement[], style: Partial<CSSStyleDeclaration>): typeof DomUtil; // this
function empty(dom: HTMLElement): void;
function remove(dom: HTMLElement): void;
}
}
+59
View File
@@ -0,0 +1,59 @@
declare namespace AMap {
abstract class EventEmitter {
on<E extends Event, C = this>(
eventName: string,
// tslint:disable-next-line:no-unnecessary-generics
handler: (this: C, event: E) => void,
context?: C,
once?: boolean,
unshift?: boolean
): this;
off<E extends Event, C = this>(
eventName: string,
// tslint:disable-next-line
handler: ((this: C, event: E) => void) | 'mv',
context?: C
): this;
emit(eventName: string, data?: any): this;
}
namespace event {
interface EventListener<T extends 0 | 1> {
type: T;
}
function addDomListener<N extends keyof HTMLElementTagNameMap, E extends keyof HTMLElementEventMap, C = HTMLElementTagNameMap[N]>(
// tslint:disable-next-line: no-unnecessary-generics
instance: HTMLElementTagNameMap[N],
eventName: E,
handler: (this: C, event: HTMLElementEventMap[E]) => void,
context?: C
): EventListener<0>;
function addListener<I extends EventEmitter, E extends Event, C = I>(
// tslint:disable-next-line: no-unnecessary-generics
instance: I,
eventName: string,
// tslint:disable-next-line: no-unnecessary-generics
handler: (this: C, event: E) => void,
// tslint:disable-next-line: no-unnecessary-generics
context?: C
): EventListener<1>;
function addListenerOnce<I extends EventEmitter, E extends Event, C = I>(
// tslint:disable-next-line: no-unnecessary-generics
instance: I,
eventName: string,
// tslint:disable-next-line: no-unnecessary-generics
handler: (this: C, event: E) => void,
// tslint:disable-next-line: no-unnecessary-generics
context?: C
): EventListener<1>;
function removeListener(listener: EventListener<0 | 1>): void;
function trigger(instance: EventEmitter, eventName: string, data?: any): void;
}
}
+122
View File
@@ -0,0 +1,122 @@
declare namespace AMap {
namespace GeometryUtil {
function distance(
point1: LocationValue,
point2: LocationValue | LocationValue[]
): number;
function ringArea(ring: LocationValue[]): number;
function isClockwise(path: LocationValue[]): boolean;
function distanceOfLine(line: LocationValue[]): number;
function ringRingClip(
ring1: LocationValue[],
ring2: LocationValue[]
): Array<[number, number]>;
function doesRingRingIntersect(
ring1: LocationValue[],
ring2: LocationValue[]
): boolean;
function doesLineRingIntersect(
line: LocationValue[],
ring: LocationValue[]
): boolean;
function doesLineLineIntersect(
line1: LocationValue[],
line2: LocationValue[]
): boolean;
function doesSegmentPolygonIntersect(
point1: LocationValue,
point2: LocationValue,
polygon: LocationValue[][]
): boolean;
function doesSegmentRingIntersect(
point1: LocationValue,
point2: LocationValue,
ring: LocationValue[]
): boolean;
function doesSegmentLineIntersect(
point1: LocationValue,
point2: LocationValue,
line: LocationValue[]
): boolean;
function doesSegmentsIntersect(
point1: LocationValue,
point2: LocationValue,
point3: LocationValue,
point4: LocationValue
): boolean;
function isPointInRing(point: LocationValue, ring: LocationValue[]): boolean;
function isRingInRing(ring1: LocationValue[], ring2: LocationValue[]): boolean;
function isPointInPolygon(point: LocationValue, polygon: LocationValue[][]): boolean;
function makesureClockwise(path: Array<[number, number]>): Array<[number, number]>;
function makesureAntiClockwise(path: Array<[number, number]>): Array<[number, number]>;
function closestOnSegment(
point1: LocationValue,
point2: LocationValue,
point3: LocationValue
): [number, number];
function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number];
function distanceToSegment(
point1: LocationValue,
point2: LocationValue,
point3: LocationValue
): number;
function distanceToLine(point: LocationValue, line: LocationValue[]): number;
function isPointOnSegment(
point1: LocationValue,
point2: LocationValue,
point3: LocationValue,
tolerance?: number
): boolean;
function isPointOnLine(
point: LocationValue,
line: LocationValue[],
tolerance?: number
): boolean;
function isPointOnRing(
point: LocationValue,
ring: LocationValue[],
tolerance?: number
): boolean;
function isPointOnPolygon(
point: LocationValue,
polygon: LocationValue[][],
tolerance?: number
): boolean;
function doesPolygonPolygonIntersect(
polygon1: LocationValue[],
polygon2: LocationValue[]
): boolean;
function distanceToPolygon(point: LocationValue, polygon: LocationValue[]): number;
function triangulateShape(
shape1: LngLat[] | Pixel[] | [number, number],
shape2: LngLat[] | Pixel[] | [number, number]
): number[];
}
}
+48
View File
@@ -0,0 +1,48 @@
// Type definitions for non-npm package amap-js-api 1.4
// Project: https://lbs.amap.com/api/javascript-api/summary
// Definitions by: breeze9527 <https://github.com/breeze9527>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference path="array-bounds.d.ts" />
/// <reference path="bounds.d.ts" />
/// <reference path="browser.d.ts" />
/// <reference path="common.d.ts" />
/// <reference path="convert-from.d.ts" />
/// <reference path="dom-util.d.ts" />
/// <reference path="event.d.ts" />
/// <reference path="geometry-util.d.ts" />
/// <reference path="lngLat.d.ts" />
/// <reference path="map.d.ts" />
/// <reference path="pixel.d.ts" />
/// <reference path="size.d.ts" />
/// <reference path="type-util.d.ts" />
/// <reference path="util.d.ts" />
/// <reference path="view2D.d.ts" />
/// <reference path="layer/building.d.ts" />
/// <reference path="layer/flexible.d.ts" />
/// <reference path="layer/layer.d.ts" />
/// <reference path="layer/layerGroup.d.ts" />
/// <reference path="layer/massMarks.d.ts" />
/// <reference path="layer/mediaLayer.d.ts" />
/// <reference path="layer/tileLayer.d.ts" />
/// <reference path="layer/wms.d.ts" />
/// <reference path="layer/wmts.d.ts" />
/// <reference path="overlay/bezierCurve.d.ts" />
/// <reference path="overlay/circle.d.ts" />
/// <reference path="overlay/circleMarker.d.ts" />
/// <reference path="overlay/contextMenu.d.ts" />
/// <reference path="overlay/ellipse.d.ts" />
/// <reference path="overlay/geoJSON.d.ts" />
/// <reference path="overlay/icon.d.ts" />
/// <reference path="overlay/infoWindow.d.ts" />
/// <reference path="overlay/marker.d.ts" />
/// <reference path="overlay/markerShape.d.ts" />
/// <reference path="overlay/overlay.d.ts" />
/// <reference path="overlay/overlayGroup.d.ts" />
/// <reference path="overlay/pathOverlay.d.ts" />
/// <reference path="overlay/polygon.d.ts" />
/// <reference path="overlay/polyline.d.ts" />
/// <reference path="overlay/rectangle.d.ts" />
/// <reference path="overlay/shapeOverlay.d.ts" />
/// <reference path="overlay/text.d.ts" />
+30
View File
@@ -0,0 +1,30 @@
declare namespace AMap {
namespace Buildings {
interface Options extends Layer.Options {
zooms?: [number, number];
opacity?: number;
heightFactor?: number;
visible?: boolean;
zIndex?: number;
// inner
merge?: boolean;
sort?: boolean;
}
interface AreaStyle {
color1: string;
path: LocationValue[];
color2?: string;
visible?: boolean;
rejectTexture?: boolean;
}
interface Style {
hideWithoutStyle?: boolean;
areas: AreaStyle[];
}
}
class Buildings extends Layer {
constructor(opts?: Buildings.Options);
setStyle(style: Buildings.Style): void;
}
}
+20
View File
@@ -0,0 +1,20 @@
declare namespace AMap {
namespace TileLayer {
namespace Flexible {
interface Options extends TileLayer.Options {
createTile?(
x: number,
y: number,
z: number,
success: (tile: HTMLImageElement | HTMLCanvasElement) => void,
fail: () => void
): void;
cacheSize?: number;
visible?: boolean;
}
}
class Flexible extends TileLayer {
constructor(options?: Flexible.Options);
}
}
}
+20
View File
@@ -0,0 +1,20 @@
declare namespace AMap {
namespace Layer {
interface Options {
map?: Map;
}
}
abstract class Layer extends EventEmitter {
getContainer(): HTMLDivElement | undefined;
getZooms(): [number, number];
setOpacity(alpha: number): void;
getOpacity(): number;
show(): void;
hide(): void;
setMap(map?: Map | null): void;
getMap(): Map | null | undefined;
setzIndex(index: number): void;
getzIndex(): number;
}
}
+21
View File
@@ -0,0 +1,21 @@
declare namespace AMap {
class LayerGroup<L = any> extends Layer {
constructor(layers: L | L[]);
addLayer(layer: L | L[]): this;
addLayers(layers: L | L[]): this;
getLayers(): L[];
getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null;
hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean;
removeLayer(layer: L | L[]): this;
removeLayers(layer: L | L[]): this;
clearLayers(): this;
eachLayer<C = L>(iterator: (this: C, layer: L, index: number, list: L[]) => void, context?: C): void;
// overwrite
setMap(map?: Map): this;
hide(): this;
show(): this;
reload(): this;
setOptions(options: any): this;
}
}
+47
View File
@@ -0,0 +1,47 @@
declare namespace AMap {
namespace MassMarks {
interface EventMap<I = MassMarks> {
click: UIEvent<'click', I>;
dblclick: UIEvent<'dblclick', I>;
mousedown: UIEvent<'mousedown', I>;
mouseup: UIEvent<'mouseup', I>;
mouseover: UIEvent<'mouseover', I>;
mouseout: UIEvent<'mouseout', I>;
touchstart: UIEvent<'touchstart', I>;
touchend: UIEvent<'touchend', I>;
}
interface Style {
anchor: Pixel;
url: string;
size: Size;
rotation?: number;
}
type UIEvent<N extends string, I> = Event<N, {
target: I;
data: I extends MassMarks<infer D> ? D : Data;
}>;
interface Options extends Layer.Options {
zIndex?: number;
cursor?: string;
alwayRender?: boolean;
style: Style | Style[];
// rejectMapMask
}
interface Data {
lnglat: LocationValue;
style?: number;
}
}
class MassMarks<D extends MassMarks.Data = MassMarks.Data> extends Layer {
constructor(data: D[] | string, opts: MassMarks.Options);
setStyle(style: MassMarks.Style | MassMarks.Style[]): void;
getStyle(): MassMarks.Style | MassMarks.Style[];
setData(data: D[] | string): void;
getData(): Array<Pick<D, Exclude<keyof D, 'lnglat'>> & { lnglat: LngLat }>;
clear(): void;
}
}
+35
View File
@@ -0,0 +1,35 @@
declare namespace AMap {
namespace MediaLayer {
interface Options extends Layer.Options {
bounds?: Bounds;
visible?: boolean;
zooms?: [number, number];
opacity?: number;
}
}
abstract class MediaLayer<E extends HTMLElement> extends Layer {
constructor(options?: MediaLayer.Options);
setBounds(bounds: Bounds): void;
getBounds(): Bounds;
setOptions(options: Partial<MediaLayer.Options>): void;
getOptions(): Partial<MediaLayer.Options>;
getElement(): E | null;
}
class ImageLayer extends MediaLayer<HTMLImageElement> {
setImageUrl(url: string): void;
getImageUrl(): string | undefined;
}
class VideoLayer extends MediaLayer<HTMLVideoElement> {
setVideoUrl(source: string | string[]): void;
getVideoUrl(): string | string[] | undefined;
}
class CanvasLayer extends MediaLayer<HTMLCanvasElement> {
setCanvas(canvas: HTMLCanvasElement): void;
getCanvas(): HTMLCanvasElement | undefined;
reFresh(): void;
}
}
+37
View File
@@ -0,0 +1,37 @@
declare namespace AMap {
namespace TileLayer {
interface EventMap {
complete: Event<'complete'>;
}
interface Options extends Layer.Options {
tileSize?: number;
tileUrl?: string;
errorUrl?: string;
getTileUrl?: string | ((x: number, y: number, level: number) => string);
zIndex?: number;
opacity?: number;
zooms?: [number, number];
detectRetina?: boolean;
}
class Satellite extends TileLayer { }
class RoadNet extends TileLayer { }
namespace Traffic {
interface Options extends TileLayer.Options {
autoRefresh?: boolean;
interval?: number;
}
}
class Traffic extends TileLayer {
constructor(options?: Traffic.Options);
}
}
class TileLayer extends Layer {
constructor(options?: TileLayer.Options);
getTiles(): string[];
reload(): void;
setTileUrl(url: string | ((x: number, y: number, level: number) => string)): void;
}
}
+29
View File
@@ -0,0 +1,29 @@
declare namespace AMap {
namespace TileLayer {
namespace WMS {
interface Params {
VERSION?: string;
LAYERS?: string;
STYLES?: string;
FORMAT?: string;
TRANSPARENT?: 'TRUE' | 'FALSE';
BGCOLOR?: string;
EXCEPTIONS?: string;
TIME?: string;
ELEVATION?: string;
}
interface Options extends Flexible.Options {
url: string;
params: Params;
blend?: boolean;
}
}
class WMS extends Flexible {
constructor(options: WMS.Options);
setUrl(url: string): void;
getUrl(): string;
setParams(params: WMS.Params): void;
getParams(): WMS.Params;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
declare namespace AMap {
namespace TileLayer {
namespace WMTS {
interface Params {
Version?: string;
Layer?: string;
Style?: string;
Format?: string;
}
interface Options extends Flexible.Options {
url: string;
params: Params;
blend?: boolean;
}
}
class WMTS extends Flexible {
constructor(options: WMTS.Options);
setUrl(url: string): void;
getUrl(): string;
setParams(params: WMTS.Params): void;
getParams(): WMTS.Params;
}
}
}
+17
View File
@@ -0,0 +1,17 @@
declare namespace AMap {
class LngLat {
constructor(lng: number, lat: number, noAutofix?: boolean);
offset(east: number, north: number): LngLat;
distance(lnglat: LngLat | LngLat[]): number;
getLng(): number;
getLat(): number;
equals(lnglat: LngLat): boolean;
toString(): string;
// internal
add(lnglat: LngLat, noAutofix?: boolean): LngLat;
subtract(lnglat: LngLat, noAutofix?: boolean): LngLat;
divideBy(num: number, noAutofix?: boolean): LngLat;
multiplyBy(num: number, noAutofix?: boolean): LngLat;
}
}
+187
View File
@@ -0,0 +1,187 @@
declare namespace AMap {
namespace Map {
type Feature = 'bg' | 'point' | 'road' | 'building';
type ViewMode = '2D' | '3D';
interface Options {
view?: View2D;
layers?: Layer[];
zoom?: number;
center?: LocationValue;
labelzIndex?: number;
zooms?: [number, number];
lang?: Lang;
defaultCursor?: string;
crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326';
animateEnable?: boolean;
isHotspot?: boolean;
defaultLayer?: TileLayer;
rotateEnable?: boolean;
resizeEnable?: boolean;
showIndoorMap?: boolean;
expandZoomRange?: boolean;
dragEnable?: boolean;
zoomEnable?: boolean;
doubleClickZoom?: boolean;
keyboardEnable?: boolean;
jogEnable?: boolean;
scrollWheel?: boolean;
touchZoom?: boolean;
touchZoomCenter?: number;
mapStyle?: string;
features?: Feature[] | 'all' | Feature;
showBuildingBlock?: boolean;
viewMode?: ViewMode;
pitch?: number;
pitchEnable?: boolean;
buildingAnimation?: boolean;
skyColor?: string;
preloadMode?: boolean;
mask?: Array<[number, number]> | Array<Array<[number, number]>> | Array<Array<Array<[number, number]>>>;
maxPitch?: number;
rotation?: number;
forceVector?: boolean;
// internal
baseRender?: 'vw' | 'd' | 'dv' | 'v';
overlayRender?: 'c' | 'd';
showLabel?: boolean;
gridMapForeign?: boolean;
logoUrl?: string;
logoUrlRetina?: string;
copyright?: string;
turboMode?: boolean;
workerMode?: boolean;
// continuousZoomEnable?: boolean;
// showFog: boolean;
// yaw: number;
// scale: number;
// detectRetina: number;
}
interface Status {
animateEnable: boolean;
doubleClickZoom: boolean;
dragEnable: boolean;
isHotspot: boolean;
jogEnable: boolean;
keyboardEnable: boolean;
pitchEnable: boolean;
resizeEnable: boolean;
rotateEnable: boolean;
scrollWheel: boolean;
touchZoom: boolean;
zoomEnable: boolean;
}
type HotspotEvent<N extends string> = Event<N, {
lnglat: LngLat;
name: string;
id: string;
// internal
isIndoorPOI: boolean;
}>;
interface EventMap {
click: MapsEvent<'click', Map>;
dblclick: MapsEvent<'dblclick', Map>;
rightclick: MapsEvent<'rightclick', Map>;
rdblclick: MapsEvent<'rdblclick', Map>;
mouseup: MapsEvent<'mouseup', Map>;
mousedown: MapsEvent<'mousedown', Map>;
mousemove: MapsEvent<'mousemove', Map>;
mousewheel: MapsEvent<'mousewheel', Map>;
mouseover: MapsEvent<'mouseover', Map>;
mouseout: MapsEvent<'mouseout', Map>;
touchstart: MapsEvent<'touchstart', Map>;
touchmove: MapsEvent<'touchmove', Map>;
touchend: MapsEvent<'touchend', Map>;
contextmenu: MapsEvent<'contextmenu', Map>;
hotspotclick: HotspotEvent<'hotspotclick'>;
hotspotover: HotspotEvent<'hotspotover'>;
hotspotout: HotspotEvent<'hotspotout'>;
complete: Event<'complete'>;
mapmove: Event<'mapmove'>;
movestart: Event<'movestart'>;
moveend: Event<'moveend'>;
zoomchange: Event<'zoomchange'>;
zoomstart: Event<'zoomstart'>;
zoomend: Event<'zoomend'>;
dragstart: Event<'dragstart'>;
dragging: Event<'dragging'>;
dragend: Event<'dragend'>;
resize: Event<'resize'>;
}
}
class Map extends EventEmitter {
constructor(container: string | HTMLElement, opts?: Map.Options);
poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void;
detailOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void;
getZoom(): number;
getLayers(): Layer[];
getCenter(): LngLat;
getContainer(): HTMLElement | null;
getCity(callback: (cityData: {
city: string;
citycode: string;
district: string;
province: string | never[]; // province is empty array when getCity fail
}) => void): void;
getBounds(): Bounds;
getLabelzIndex(): number;
getLimitBounds(): Bounds;
getLang(): Lang;
getSize(): Size;
getRotation(): number;
getStatus(): Map.Status;
getDefaultCursor(): string;
getResolution(point?: LocationValue): number;
getScale(dpi?: number): number;
setZoom(level: number): void;
setLabelzIndex(index: number): void;
setLayers(layers: Layer[]): void;
add(overlay: Overlay | Overlay[]): void;
remove(overlay: Overlay | Overlay[]): void;
getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[];
setCenter(center: LocationValue): void;
setZoomAndCenter(zoomLevel: number, center: LocationValue): void;
setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void;
setBounds(bound: Bounds): Bounds;
setLimitBounds(bound: Bounds): void;
clearLimitBounds(): void;
setLang(lang: Lang): void;
setRotation(rotation: number): void;
setStatus(status: Partial<Map.Status>): void;
setDefaultCursor(cursor: string): void;
zoomIn(): void;
zoomOut(): void;
panTo(position: LocationValue): void;
panBy(x: number, y: number): void;
setFitView(
overlayList?: Overlay | Overlay[],
immediately?: boolean,
avoid?: [number, number, number, number],
maxZoom?: number
): Bounds | false | undefined;
clearMap(): void;
destroy(): void;
plugin(name: string | string[], callback: () => void): this;
addControl(control: {}): void; // TODO
removeControl(control: {}): void; // TODO
clearInfoWindow(): void;
pixelToLngLat(pixel: Pixel, level?: number): LngLat;
lnglatToPixel(lnglat: LocationValue, level?: number): Pixel;
containerToLngLat(pixel: Pixel): LngLat;
lngLatToContainer(lnglat: LocationValue): Pixel;
lnglatTocontainer(lnglat: LocationValue): Pixel;
setMapStyle(style: string): void;
getMapStyle(): string;
setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void;
getFeatures(): Map.Feature | Map.Feature[] | 'all';
setDefaultLayer(layer: TileLayer): void;
setPitch(pitch: number): void;
getPitch(): number;
getViewMode_(): Map.ViewMode;
lngLatToGeodeticCoord(lnglat: LocationValue): Pixel;
geodeticCoordToLngLat(pixel: Pixel): LngLat;
}
}
+22
View File
@@ -0,0 +1,22 @@
declare namespace AMap {
namespace BezierCurve {
interface EventMap<I = BezierCurve> extends Polyline.EventMap<I> { }
type Options<ExtraData = any> = Merge<Polyline.Options<ExtraData>, {
// internal
path: Array<Array<number | string | Array<string | number>>>;
tolerance?: number;
interpolateNumLimit?: [number | number];
}>;
interface GetOptionsResult<ExtraData = any> extends Polyline.GetOptionsResult<ExtraData> {
path: Array<LngLat & { controlPoints: LngLat[] }>;
}
}
class BezierCurve<ExtraData = any> extends Polyline<ExtraData> {
constructor(options: BezierCurve.Options<ExtraData>);
getOptions(): Partial<BezierCurve.GetOptionsResult<ExtraData>>;
// internal
getInterpolateLngLats(): LngLat[];
getSerializedPath(): number[][];
}
}
+49
View File
@@ -0,0 +1,49 @@
declare namespace AMap {
namespace Circle {
interface EventMap<I = Circle> extends ShapeOverlay.EventMap<I> {
setCenter: Event<'setCenter'>;
setRadius: Event<'setRadius'>;
}
interface Options<ExtraData = any> {
map?: Map;
zIndex?: number;
center?: LocationValue;
bubble?: boolean;
cursor?: string;
radius?: number;
strokeColor?: string;
strokeOpcity?: number;
strokeWeight?: number;
fillColor?: string;
fillOpacity?: number;
strokeStyle?: StrokeStyle;
extData?: ExtraData;
strokeDasharray?: number[];
// internal
visible?: boolean;
unit?: 'meter' | 'px'; // 'might be typo'
}
type GetOptionsResult<ExtraData = any> = Merge<Polygon.GetOptionsResult<ExtraData>, {
path: LngLat[];
center: LngLat;
radius: number;
}>;
}
class Circle<ExtraData = any> extends ShapeOverlay<ExtraData> {
constructor(options?: Circle.Options<ExtraData>);
setCenter(center: LocationValue, preventEvent?: boolean): void;
getCenter(): LngLat | undefined;
getBounds(): Bounds | null;
setRadius(radius: number, preventEvent?: boolean): void;
getRadius(): number;
setOptions(options?: Circle.Options<ExtraData>): void;
getOptions(): Partial<Circle.GetOptionsResult<ExtraData>>;
contains(point: LocationValue): boolean;
// internal
getPath(count?: number): LngLat[];
}
}
+4
View File
@@ -0,0 +1,4 @@
declare namespace AMap {
// tslint:disable-next-line;
class CircleMarker<ExtraData = any> extends Circle<ExtraData> {}
}
+23
View File
@@ -0,0 +1,23 @@
declare namespace AMap {
namespace ContextMenu {
interface Options {
content?: string | HTMLElement;
// internal
visible?: boolean;
}
interface EventMap<I> {
items: Event<'items'>;
open: Event<'open', { target: I }>;
close: Event<'close', { target: I }>;
}
}
class ContextMenu<ExtraData = any> extends Overlay<ExtraData> {
constructor(options?: ContextMenu.Options);
addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void;
removeItem(test: string, fn: (this: HTMLLIElement) => void): void;
open(map: Map, position: LocationValue): void;
close(): void;
}
}
+27
View File
@@ -0,0 +1,27 @@
declare namespace AMap {
namespace Ellipse {
interface EventMap<I = Ellipse> extends ShapeOverlay.EventMap<I> {
setPath: Event<'setPath'>;
setCenter: Event<'setCenter'>;
}
interface Options<ExtraData = any> extends Polygon.Options<ExtraData> {
center?: LocationValue;
radius?: [number, number];
}
type GetOptionsResult<ExtraData = any> = Merge<Circle.GetOptionsResult<ExtraData>, {
radius: [number, number];
}>;
}
class Ellipse<ExtraData = any> extends Polygon<ExtraData> {
constructor(options?: Ellipse.Options<ExtraData>);
getCenter(): LngLat | undefined;
setCenter(center: LocationValue, preventEvent?: boolean): void;
setOptions(options: Ellipse.Options<ExtraData>): void;
// internal
setRadius(radius: [number, number], preventEvent?: boolean): void;
getRadius(): [number, number];
}
}
+43
View File
@@ -0,0 +1,43 @@
declare namespace AMap {
namespace GeoJSON {
type Geometry = {
type: 'Point';
coordinates: [number, number];
} | {
type: 'MultiPoint' | 'LineString' | 'Polygon';
coordinates: Array<[number, number]>;
} | {
type: 'MultiLineString' | 'MultiPolygon';
coordinates: Array<Array<[number, number]>>;
} | {
type: 'GeometryCollection';
geometries: Geometry[];
};
type GeoJSONObject = {
type: 'Feature';
properties: any;
geometry: Geometry;
} | {
type: 'FeatureCollection',
properties: any;
features: GeoJSONObject[];
};
interface Options {
geoJSON?: GeoJSONObject | GeoJSONObject[];
getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker;
getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline;
getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon;
coordsToLatLng?(lnglat: LngLat): LngLat;
// internal
coordsToLatLngs?(lnglats: LngLat[]): LngLat[];
}
}
class GeoJSON<ExtraData = any> extends OverlayGroup<Overlay, ExtraData> {
constructor(options?: GeoJSON.Options);
importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void;
toGeoJSON(): GeoJSON.GeoJSONObject[];
}
}
+16
View File
@@ -0,0 +1,16 @@
declare namespace AMap {
namespace Icon {
interface Options {
size?: SizeValue;
imageOffset?: Pixel;
image?: string;
imageSize?: SizeValue;
}
}
class Icon extends EventEmitter {
constructor(options?: Icon.Options);
setImageSize(size: SizeValue): void;
getImageSize(): Size;
}
}
+37
View File
@@ -0,0 +1,37 @@
declare namespace AMap {
namespace InfoWindow {
interface EventMap<I> {
change: Event<'change', { target: I }>;
open: Event<'open', { target: I }>;
close: Event<'close', { target: I }>;
}
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
isCustom?: boolean;
autoMove?: boolean;
closeWhenClickMap?: boolean;
content?: string | HTMLElement;
size?: SizeValue;
offset?: Pixel;
position?: LocationValue;
showShadow?: boolean;
// internal
height?: number;
}
}
class InfoWindow<ExtraData = any> extends Overlay<ExtraData> {
constructor(options?: InfoWindow.Options);
open(map: Map, position?: LocationValue): void;
close(): void;
getIsOpen(): boolean;
setContent(content: string | HTMLElement): void;
getContent(): string | HTMLElement | undefined;
setPosition(lnglat: LocationValue): void;
getPosition(): LngLat | undefined;
setSize(size: SizeValue): void;
getSize(): Size | undefined;
// internal
setOffset(offset: Pixel): void;
}
}
+103
View File
@@ -0,0 +1,103 @@
declare namespace AMap {
namespace Marker {
interface EventMap<I = Marker> {
click: MapsEvent<'click', I>;
dblclick: MapsEvent<'dblclick', I>;
rightclick: MapsEvent<'rightclick', I>;
mousemove: MapsEvent<'mousemove', I>;
mouseover: MapsEvent<'mouseover', I>;
mouseout: MapsEvent<'mouseout', I>;
mousedown: MapsEvent<'mousedown', I>;
mouseup: MapsEvent<'mouseup', I>;
dragstart: MapsEvent<'dragstart', I>;
dragging: MapsEvent<'dragging', I>;
dragend: MapsEvent<'dragend', I>;
moving: Event<'moving', { passwdPath: LngLat[]; }>;
moveend: Event<'moveend'>;
movealong: Event<'movealong'>;
touchstart: MapsEvent<'touchstart', I>;
touchmove: MapsEvent<'touchmove', I>;
touchend: MapsEvent<'touchend', I>;
}
interface Label {
content?: string;
offset?: Pixel;
}
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
position?: LocationValue;
offset?: Pixel;
icon?: string | Icon;
content?: string | HTMLElement;
topWhenClick?: boolean;
bubble?: boolean;
draggable?: boolean;
raiseOnDrag?: boolean;
cursor?: string;
visible?: boolean;
zIndex?: number;
angle?: number;
autoRotation?: boolean;
animation?: AnimationName;
shadow?: Icon | string;
title?: string;
shape?: MarkerShape;
label?: Label;
zooms?: [number, number];
// internal
topWhenMouseOver?: boolean;
height?: number;
}
}
class Marker<ExtraData = any> extends Overlay<ExtraData> {
constructor(options?: Marker.Options<ExtraData>);
markOnAMAP(obj?: { name?: string, position?: LocationValue }): void;
getOffset(): Pixel;
setOffset(offset: Pixel): void;
setAnimation(animate: AnimationName, prevent?: boolean): void;
getAnimation(): AnimationName;
setClickable(cilckable: boolean): void;
getClickable(): boolean;
getPosition(): LngLat | undefined;
setPosition(position: LocationValue): void;
setAngle(angle: number): void;
setLabel(label?: Marker.Label): void;
getLabel(): Marker.Label | undefined;
getAngle(): number;
setzIndex(index: number): void;
getzIndex(): number;
setIcon(content: string | Icon): void;
getIcon(): string | Icon | undefined;
setDraggable(draggable: boolean): void;
getDraggable(): boolean;
setCursor(cursor: string): void;
setContent(content: string | HTMLElement): void;
getContent(): string | HTMLElement;
moveAlong(
path: LngLat[],
speed: number,
timingFunction?: (t: number) => number,
circleable?: boolean
): void;
moveTo(
path: LocationValue,
speed: number,
timingFunction?: (t: number) => number
): void;
stopMove(): void;
pauseMove(): boolean;
resumeMove(): boolean;
setMap(map: null | Map): void;
setTitle(title: string): void;
getTitle(): string | undefined;
setTop(isTop: boolean): void;
getTop(): boolean;
setShadow(icon?: Icon | string): void;
getShadow(): Icon | undefined | string;
setShape(shape?: MarkerShape): void;
getShape(): MarkerShape | undefined;
}
}
+21
View File
@@ -0,0 +1,21 @@
declare namespace AMap {
namespace MarkerShape {
interface CircleOptions {
type: 'circle';
coords: [number, number, number];
}
interface PolyOptions {
type: 'poly';
coords: number[];
}
interface RectOptions {
type: 'rect';
coords: [number, number, number, number];
}
type Options = CircleOptions | PolyOptions | RectOptions;
}
class MarkerShape extends EventEmitter {
constructor(options: MarkerShape.Options);
}
}
+37
View File
@@ -0,0 +1,37 @@
declare namespace AMap {
namespace Overlay {
interface EventMap<I> {
touchstart: MapsEvent<'touchstart', I>;
touchmove: MapsEvent<'touchmove', I>;
touchend: MapsEvent<'touchend', I>;
click: MapsEvent<'click', I>;
rightclick: MapsEvent<'rightclick', I>;
dblclick: MapsEvent<'dblclick', I>;
mousemove: MapsEvent<'mousemove', I>;
mouseover: MapsEvent<'mouseover', I>;
mousedown: MapsEvent<'mousedown', I>;
mouseup: MapsEvent<'mouseup', I>;
}
interface Options<ExtraData = any> {
map?: Map;
cursor?: string;
extData?: ExtraData;
bubble?: boolean;
clickable?: boolean;
draggable?: boolean;
}
}
abstract class Overlay<ExtraData = any> extends EventEmitter {
constructor(options?: Overlay.Options);
show(): void;
hide(): void;
getMap(): Map | null | undefined;
setMap(map: Map | null): void;
setExtData(extData: ExtraData): void;
getExtData(): ExtraData | {};
// internal
setHeight(height?: number | string): void;
getHeight(): number | string;
}
}
+30
View File
@@ -0,0 +1,30 @@
type ReferOverlayOptions<O> =
O extends AMap.BezierCurve ? AMap.BezierCurve.Options
: O extends AMap.Polyline ? AMap.Polyline.Options
: O extends AMap.Circle ? AMap.Circle.Options
: O extends AMap.Ellipse ? AMap.Ellipse.Options
: O extends AMap.Polygon ? AMap.Polygon.Options
: O extends AMap.Text ? AMap.Text.Options
: O extends AMap.Marker ? AMap.Marker.Options
: O extends AMap.Rectangle ? AMap.Rectangle.Options
: any;
declare namespace AMap {
class OverlayGroup<O extends Overlay = Overlay, ExtraData = any> extends Overlay<ExtraData> {
constructor(overlays?: O | O[]);
addOverlay(overlay: O | O[]): this;
addOverlays(overlay: O | O[]): this;
getOverlays(): O[];
hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean;
removeOverlay(overlay: O | O[]): this;
removeOverlays(overlay: O | O[]): this;
clearOverlays(): this;
eachOverlay<C = O>(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this;
setMap(map: null | Map): this;
setOptions(options: ReferOverlayOptions<O>): this;
show(): this;
hide(): this;
getOverlay(finder: ((this: null, item: O, index: number, list: O[]) => boolean) | O): O | null;
}
}
+20
View File
@@ -0,0 +1,20 @@
declare namespace AMap {
namespace PathOverlay {
interface EventMap<I = PathOverlay> extends ShapeOverlay.EventMap<I> { }
interface Options<ExtraData = any> extends Overlay.Options<ExtraData> {
visible?: boolean;
zIndex?: number;
strokeColor?: string;
strokeOpacity?: number;
strokeWeight?: number;
strokeStyle?: StrokeStyle;
strokeDasharray?: number[];
lineJoin?: StrokeLineJoin;
lineCap?: StrokeLineCap;
}
}
abstract class PathOverlay<ExtraData = any> extends ShapeOverlay<ExtraData> {
constructor(options?: PathOverlay.Options<ExtraData>);
getBounds(): Bounds | (this extends Rectangle ? undefined : null);
}
}
+32
View File
@@ -0,0 +1,32 @@
declare namespace AMap {
namespace Polygon {
interface EventMap<I = Polygon> extends PathOverlay.EventMap<I> { }
interface Options<ExtraData = any> extends PathOverlay.Options<ExtraData> {
path?: LocationValue[] | LocationValue[][];
fillColor?: string;
fillOpacity?: number;
}
interface GetOptionsResult<ExtraData = any> extends ShapeOverlay.GetOptionsResult<ExtraData> {
fillColor: string;
fillOpacity: number;
path: LngLat[] | LngLat[][];
lineJoin: StrokeLineJoin;
texture: string;
}
}
class Polygon<ExtraData = any> extends PathOverlay<ExtraData> {
constructor(options?: Polygon.Options<ExtraData>);
setPath(path: LocationValue[] | LocationValue[][]): void;
getPath(): LngLat[] | LngLat[][];
setOptions(options: Polygon.Options<ExtraData>): void;
getOptions(): Partial<
this extends Omit<Ellipse, keyof Polygon> ? Ellipse.GetOptionsResult<ExtraData> :
this extends Omit<Rectangle, keyof Polygon> ? Rectangle.GetOptionsResult<ExtraData> :
Polygon.GetOptionsResult<ExtraData>
>;
getArea(): number;
contains(point: LocationValue): boolean;
}
}
+46
View File
@@ -0,0 +1,46 @@
declare namespace AMap {
namespace Polyline {
interface EventMap<I = Polyline> extends PathOverlay.EventMap<I> { }
interface GetOptionsResult<ExtraData = any> extends ShapeOverlay.GetOptionsResult<ExtraData> {
isOutline: boolean;
outlineColor: string;
geodesic: boolean;
path: LngLat[];
lineJoin: StrokeLineJoin;
lineCap: StrokeLineCap;
borderWeight: number;
showDir: boolean;
dirColor: string;
dirImg: string;
}
interface Options<ExtraData = any> extends PathOverlay.Options<ExtraData> {
isOutline?: boolean;
outlineColor?: string;
geodesic?: boolean;
dirColor?: string;
borderWeight?: number;
showDir?: boolean;
// internal
path?: LocationValue[];
}
}
class Polyline<ExtraData = any> extends PathOverlay<ExtraData> {
constructor(options?: BezierCurve.Options<ExtraData> | Polyline.Options<ExtraData>);
setPath(
path: this extends Omit<BezierCurve, keyof Polyline> ?
Array<Array<number | string | Array<string | number>>>
: LocationValue[]
): void;
getPath(): this extends Omit<BezierCurve, keyof Polyline> ?
Array<LngLat & { controlPoints: LngLat[] }>
: LngLat[];
getLength(): number;
setOptions(options: this extends Omit<BezierCurve, keyof Polyline> ?
Partial<BezierCurve.Options<ExtraData>>
: Polyline.Options<ExtraData>
): void;
getOptions(): Partial<Polyline.GetOptionsResult<ExtraData>>;
}
}
+21
View File
@@ -0,0 +1,21 @@
declare namespace AMap {
namespace Rectangle {
interface EventMap<I = Rectangle> extends Polygon.EventMap<I> {
setBounds: Event<'setBounds'>;
}
interface Options<ExtraData = any> extends Polygon.Options<ExtraData> {
bounds?: Bounds;
}
type GetOptionsResult<ExtraData = any> = Merge<Polygon.GetOptionsResult<ExtraData>, {
path: LngLat[];
bounds: Bounds;
texture: string;
}>;
}
class Rectangle<ExtraData = any> extends Polygon<ExtraData> {
constructor(options?: Rectangle.Options<ExtraData>);
setBounds(bounds: Bounds, preventEvent?: boolean): void;
setOptions(options: Partial<Rectangle.Options>): void;
}
}
+30
View File
@@ -0,0 +1,30 @@
declare namespace AMap {
namespace ShapeOverlay {
interface EventMap<I = ShapeOverlay> extends Overlay.EventMap<I> {
show: Event<'show', { target: I }>;
hide: Event<'hide', { target: I }>;
options: Event<'options'>;
change: Event<'change', { target: I }>;
}
interface GetOptionsResult<ExtraData = any> {
map: Map;
zIndex: number;
strokeColor: string;
strokeOpacity: number;
strokeWeight: number;
strokeStyle: StrokeStyle;
strokeDasharray: number[];
extData: ExtraData | {};
bubble: boolean;
clickable: boolean;
}
}
abstract class ShapeOverlay<ExtraData = any> extends Overlay<ExtraData> {
abstract setOptions(options: {}): void;
abstract getOptions(): {};
getzIndex(): number;
setzIndex(zIndex: number): void;
getVisible(): boolean;
setDraggable(draggable: boolean): void;
}
}
+19
View File
@@ -0,0 +1,19 @@
declare namespace AMap {
namespace Text {
type TextAlign = 'left' | 'right' | 'center';
type VerticalAlign = 'top' | 'middle' | 'bottom';
interface EventMap<I = Text> extends Marker.EventMap<I> { }
interface Options extends Marker.Options {
text?: string;
textAlign?: TextAlign;
verticalAlign?: VerticalAlign;
}
}
class Text<ExtraData = any> extends Marker<ExtraData> {
constructor(options?: Text.Options);
getText(): string;
setText(text: string): void;
setStyle(style: object): void;
}
}
+17
View File
@@ -0,0 +1,17 @@
declare namespace AMap {
class Pixel {
constructor(x: number, y: number, round?: boolean);
getX(): number;
getY(): number;
equals(point: Pixel): boolean;
toString(): string;
// internal
add(offset: {x: number; y: number}, round?: boolean): Pixel;
round(): Pixel;
floor(): Pixel;
length(): number;
direction(): null | number;
toFixed(decimals?: number): this;
}
}
+10
View File
@@ -0,0 +1,10 @@
declare namespace AMap {
class Size {
constructor(width: number, height: number);
getWidth(): number;
getHeight(): number;
toString(): string;
// internal
contains(size: { x: number; y: number }): boolean;
}
}
+66
View File
@@ -0,0 +1,66 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noEmit": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"forceConsistentCasingInFileNames": true
},
"files": [
"array-bounds.d.ts",
"bounds.d.ts",
"browser.d.ts",
"common.d.ts",
"convert-from.d.ts",
"dom-util.d.ts",
"event.d.ts",
"geometry-util.d.ts",
"index.d.ts",
"layer/building.d.ts",
"layer/flexible.d.ts",
"layer/layer.d.ts",
"layer/layerGroup.d.ts",
"layer/massMarks.d.ts",
"layer/mediaLayer.d.ts",
"layer/tileLayer.d.ts",
"layer/wms.d.ts",
"layer/wmts.d.ts",
"lngLat.d.ts",
"map.d.ts",
"overlay/bezierCurve.d.ts",
"overlay/circle.d.ts",
"overlay/circleMarker.d.ts",
"overlay/contextMenu.d.ts",
"overlay/ellipse.d.ts",
"overlay/geoJSON.d.ts",
"overlay/icon.d.ts",
"overlay/infoWindow.d.ts",
"overlay/marker.d.ts",
"overlay/markerShape.d.ts",
"overlay/overlay.d.ts",
"overlay/overlayGroup.d.ts",
"overlay/pathOverlay.d.ts",
"overlay/polygon.d.ts",
"overlay/polyline.d.ts",
"overlay/rectangle.d.ts",
"overlay/shapeOverlay.d.ts",
"overlay/text.d.ts",
"pixel.d.ts",
"size.d.ts",
"type-util.d.ts",
"util.d.ts",
"view2D.d.ts",
"amap-js-api-tests.ts"
]
}
+12
View File
@@ -0,0 +1,12 @@
type Omit<T, E extends keyof T> = {
[K in Exclude<keyof T, E>]: T[K]
};
type OptionalKey<T> = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T];
// type OmitUndefined<M> = Omit<M, { [K in keyof M]: M[K] extends undefined ? K : never }[keyof M]>;
// type PickUndefined<M> = Omit<M, keyof OmitUndefined<M>>;
type Merge<O, T> =
{ [K in Exclude<keyof O, keyof T | OptionalKey<O>>]-?: O[K]; } &
{ [K in Extract<Exclude<keyof O, keyof T>, OptionalKey<O>>]?: O[K]; } &
T;
+37
View File
@@ -0,0 +1,37 @@
declare namespace AMap {
namespace Util {
function colorNameToHex(colorName: string): string;
function rgbHex2Rgba(hex: string): string;
function argbHex2Rgba(hex: string): string;
function isEmpty(obj: object): boolean;
function deleteItemFromArray<T = any>(array: T[], item: T): T[];
function deleteItemFromArrayByIndex<T = any>(array: T[], index: number): T[];
function indexOf<T = any>(array: T[], item: T): number;
function format(floatNumber: number, digits?: number): number;
function isArray(data: any): data is any[];
function isDOM(data: any): data is HTMLElement;
function includes<T = any>(array: T[], item: T): boolean;
function requestIdleCallback(callback: (...args: any[]) => any, options?: { timeout?: number }): number;
function cancelIdleCallback(handle: number): void;
function requestAnimFrame<C = undefined>(callback: (this: C, ...args: any[]) => any, context?: C): number;
function cancelAnimFrame(handle: number): void;
function color2RgbaArray(color: string | number[]): [number, number, number, number];
function color2Rgba(color: string | number[]): string;
}
}
+13
View File
@@ -0,0 +1,13 @@
declare namespace AMap {
namespace View2D {
interface Options {
center?: LocationValue;
rotation?: number;
zoom?: number;
crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326';
}
}
class View2D extends EventEmitter {
constructor(options?: View2D.Options);
}
}
+13 -1
View File
@@ -1003,7 +1003,15 @@ const SQSEvent: AWSLambda.SQSEvent = {
SenderId: "594035263019",
ApproximateFirstReceiveTimestamp: "1529104986230"
},
messageAttributes: {},
messageAttributes: {
testAttr: {
stringValue: "100",
binaryValue: "base64Str",
stringListValues: [],
binaryListValues: [],
dataType: "Number"
}
},
md5OfBody: "9bb58f26192e4ba00f01e2e7b136bbd8",
eventSource: "aws:sqs",
eventSourceARN: "arn:aws:sqs:us-west-2:594035263019:NOTFIFOQUEUE",
@@ -1039,6 +1047,10 @@ const SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async (
event;
str = event.Records[0].messageId;
anyObj = event.Records[0].body;
strOrUndefined = event.Records[0].messageAttributes.testAttr.stringValue;
strOrUndefined = event.Records[0].messageAttributes.testAttr.binaryValue;
str = event.Records[0].messageAttributes.testAttr.dataType;
// $ExpectType Context
context;
str = context.functionName;
+9 -3
View File
@@ -879,11 +879,17 @@ export interface SQSRecordAttributes {
SenderId: string;
ApproximateFirstReceiveTimestamp: string;
}
export type SQSMessageAttributeDataType = 'String' | 'Number' | 'Binary' | string;
export interface SQSMessageAttribute {
Name: string;
Type: string;
Value: string;
stringValue?: string;
binaryValue?: string;
stringListValues: never[]; // Not implemented. Reserved for future use.
binaryListValues: never[]; // Not implemented. Reserved for future use.
dataType: SQSMessageAttributeDataType;
}
export interface SQSMessageAttributes {
[name: string]: SQSMessageAttribute;
}
+1 -1
View File
@@ -1,7 +1,7 @@
// Type definitions for axe-webdriverjs 2.1
// Project: https://github.com/dequelabs/axe-webdriverjs#readme
// Definitions by: Joshua Goldberg <https://github.com/JoshuaKGoldberg>
// Tyler Krupicka <https://github.com/tylerkrupicka>
// Tyler Krupicka <https://github.com/tylerkrupicka>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for basicauth-middleware 3.1
// Project: https://github.com/nchaulet/basicauth-middleware
// Definitions by: My Self <https://github.com/nchaulet>
// Definitions by: Nicolas Chaulet <https://github.com/nchaulet>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for bip32 1.0
// Project: https://github.com/bitcoinjs/bip32#readme
// Definitions by: My Self <https://github.com/me>
// Definitions by: eduhenke <https://github.com/eduhenke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -20,6 +20,10 @@ keyPair3.toWIF();
bitcoin.payments.p2pkh({ pubkey: keyPair3.publicKey });
const network = keyPair3.network;
const keyPair4 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.regtest, rng});
keyPair4.toWIF();
bitcoin.payments.p2pkh({ pubkey: keyPair4.publicKey });
// Test TransactionBuilder and Transaction
const txb = new bitcoin.TransactionBuilder();
txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
+1
View File
@@ -191,6 +191,7 @@ export class TransactionBuilder {
export const networks: {
bitcoin: Network;
testnet: Network;
regtest: Network;
};
export const opcodes: {
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for braft-editor 1.9
// Project: https://github.com/margox/braft#readme
// Definitions by: My Self <https://github.com/me>
// Definitions by: Jonny Yao <https://github.com/petitspois>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
-10
View File
@@ -1,10 +0,0 @@
import camelCase = require('camelcase');
camelCase('foo-bar');
camelCase('foo_bar');
camelCase('Foo-Bar');
camelCase('--foo.bar');
camelCase('__foo__bar__');
camelCase('foo bar');
camelCase('foo', 'bar');
camelCase('__foo__', '--bar');
-9
View File
@@ -1,9 +0,0 @@
// Type definitions for camelcase 4.1
// Project: https://github.com/sindresorhus/camelcase
// Definitions by: Sam Verschueren <https://github.com/samverschueren>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = camelcase;
declare function camelcase(...args: string[]): string;
declare namespace camelcase {}
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"camelcase-tests.ts"
]
}
+11 -11
View File
@@ -1,9 +1,9 @@
import caseless, { Caseless, httpify, Httpified } from "caseless";
import caseless = require("caseless");
new Caseless(); // $ExpectError
new caseless.Caseless(); // $ExpectError
// tslint:disable-next-line: prefer-const
let c1: Caseless;
let c1: caseless.Caseless;
caseless(); // $ExpectType Caseless
caseless({}); // $ExpectType Caseless
@@ -30,16 +30,16 @@ c2.swap(10); // $ExpectError
c2.del('foo'); // $ExpectType boolean
httpify(null, {}); // $ExpectError
httpify(1, {}); // $ExpectError
httpify("2", {}); // $ExpectError
httpify({}, null); // $ExpectError
httpify({}, 1); // $ExpectError
httpify({}, "2"); // $ExpectError
caseless.httpify(null, {}); // $ExpectError
caseless.httpify(1, {}); // $ExpectError
caseless.httpify("2", {}); // $ExpectError
caseless.httpify({}, null); // $ExpectError
caseless.httpify({}, 1); // $ExpectError
caseless.httpify({}, "2"); // $ExpectError
httpify({}, {}); // $ExpectType Caseless
caseless.httpify({}, {}); // $ExpectType Caseless
const request: Httpified = {}; // $ExpectError
const request: caseless.Httpified = {}; // $ExpectError
request.setHeader({}); // $ExpectType void
request.setHeader('foo', 'bar'); // $ExpectType string | false
+24 -21
View File
@@ -2,6 +2,7 @@
// Project: https://github.com/mikeal/caseless
// Definitions by: downace <https://github.com/downace>
// Matt R. Wilson <https://github.com/mastermatt>
// Emily Klassen <https://github.com/forivall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -9,26 +10,28 @@ type KeyType = string;
type ValueType = any;
type RawDict = object;
export interface Caseless {
set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false;
set(dict: RawDict): void;
has(name: KeyType): KeyType | false;
get(name: KeyType): ValueType | undefined;
swap(name: KeyType): void;
del(name: KeyType): boolean;
declare function caseless(dict?: RawDict): caseless.Caseless;
declare namespace caseless {
function httpify(resp: object, headers: RawDict): Caseless;
interface Caseless {
set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false;
set(dict: RawDict): void;
has(name: KeyType): KeyType | false;
get(name: KeyType): ValueType | undefined;
swap(name: KeyType): void;
del(name: KeyType): boolean;
}
interface Httpified {
headers: RawDict;
setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false;
setHeader(dict: RawDict): void;
hasHeader(name: KeyType): KeyType | false;
getHeader(name: KeyType): ValueType | undefined;
removeHeader(name: KeyType): boolean;
}
}
export interface Httpified {
headers: RawDict;
setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false;
setHeader(dict: RawDict): void;
hasHeader(name: KeyType): KeyType | false;
getHeader(name: KeyType): ValueType | undefined;
removeHeader(name: KeyType): boolean;
}
export function httpify(resp: object, headers: RawDict): Caseless;
declare function caseless(dict?: RawDict): Caseless;
export default caseless;
export = caseless;
+74
View File
@@ -0,0 +1,74 @@
import cassanknex = require('cassanknex');
const knex = cassanknex({
connection: {
contactPoints: ['127.0.0.1']
}
});
knex.on('ready', (err) => {
});
interface BirdRow {
type: string;
canFly: boolean;
}
const qb = knex("animals")
.insert<BirdRow>({
type: 'Stork',
canFly: true
})
.into('birds');
qb.exec((err, res) => {
});
qb.eachRow((n, row) => {
}, (err) => {
});
interface FooRow {
id: string;
foo: string;
bar: number;
baz: string[];
}
const query2 = knex("keyspace")
.select<FooRow>("id", "foo", "bar", "baz")
.ttl('foo')
.where("id", "=", "1")
.orWhere("id", "in", ["2", "3"])
.orWhere("baz", "=", ["bar"])
.andWhere("foo", "IN", ["baz", "bar"])
.limit(10)
.from("table");
query2.stream({
readable() {
const row = this.read();
},
end() {},
error() {}
});
const values = {
id: "foo",
bar: 13,
baz: ["foo", "bar"]
};
const query3 = knex("cassanKnexy")
.insert<FooRow>(values)
.usingTimestamp(250000)
.usingTTL(50000)
.into("columnFamily");
const [cql, params] = [query3.cql(), query3.bindings()];
const query4 = knex("cassanKnexy")
.update("columnFamily")
.add("bar", { foo: "baz" }) // "bar" is a map
.remove("foo", ["bar"]) // "foo" is a set
.where("id", "=", 1);
+204
View File
@@ -0,0 +1,204 @@
// Type definitions for cassanknex 1.19
// Project: https://github.com/azuqua/cassanknex
// Definitions by: Daniel Chao <https://github.com/bioball>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="node" />
import { EventEmitter } from "events";
import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver";
import * as Long from "long";
import { Readable } from "stream";
declare function CassanKnex(options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex;
export = CassanKnex;
declare namespace CassanKnex {
interface DriverOptions {
debug?: boolean;
connection?: Client | ClientOptions;
}
/**
* Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`.
*/
type TypeMatchedValue<T, K extends keyof T, Type, This> = T[K] extends Type ? This : never;
interface MappedDict<B> {
[key: string]: B;
}
type InRestriction = 'in' | 'IN';
type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>=';
type SelectAsClause<T> = {
[P in keyof T]: string;
};
interface CassanKnex extends EventEmitter {
(keyspace?: string): QueryBuilderRoot;
}
interface StreamParams {
readable: (this: Readable) => any;
end: (this: Readable) => any;
error: (err: Error) => any;
}
interface QueryBuilderRoot {
insert <T = any>(values: Partial<T> | T): InsertQueryBuilder;
select <T = any>(...columns: Array<keyof T>): SelectQueryBuilder<T>;
select <T = any>(values: SelectAsClause<T>): SelectQueryBuilder<T>;
update <T = any>(table: string): UpdateQueryBuilder<T>;
delete <T = any>(): DeleteQueryBuilder<T>;
alterColumnFamily <T = any>(columnFamily: string): AlterColumnFamilyQueryBuilder<T>;
createColumnFamily <T = any>(columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createColumnFamilyIfNotExists <T = any>(columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createIndex <T = any>(columnFamily: string, indexName: string, column: keyof T): QueryBuilder;
createIndexCustom <T = any>(columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder;
createType <T = any>(typeName: string): CreateTypeQueryBuilder<T>;
createTypeIfNotExists <T = any>(typeName: string): CreateTypeQueryBuilder<T>;
dropColumnFamily(columnFamily: string): QueryBuilder;
dropColumnFamilyIfExists(columnFamily: string): QueryBuilder;
dropType(): QueryBuilder;
dropTypeIfExists(): QueryBuilder;
truncate(columnFamily: string): QueryBuilder;
alterKeyspace(keyspace: string): KeyspaceQueryBuilder;
createKeyspace(keyspace: string): KeyspaceQueryBuilder;
createKeyspaceIfNotExists(keyspace: string): KeyspaceQueryBuilder;
dropKeyspace(): QueryBuilder;
dropKeyspaceIfExists(): QueryBuilder;
}
interface QueryBuilder {
cql(): string;
bindings(): any[];
exec(cb: ResultCallback): undefined;
eachRow(onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined;
stream(params: StreamParams): undefined;
}
interface FieldValueQueryBuilder<T> {
decimal <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.BigDecimal, this>;
boolean <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, boolean, this>;
blob <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Buffer, this>;
timestamp <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Date, this>;
date <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.LocalDate, this>;
inet <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.InetAddress, this>;
bigint <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
counter <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
double <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
int <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, number, this>;
float <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, number, this>;
map <K extends keyof T, A extends string, B>(columnName: K, a: A, b: B): TypeMatchedValue<T, K, Map<A, B>, this>;
ascii <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
text <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
timeuuid <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.TimeUuid, this>;
uuid <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.Uuid, this>;
varchar <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
list <K extends keyof T>(columnName: K, typeName: string): TypeMatchedValue<T, K, any[], this>;
primary(primaryKey: string): this;
set <K extends keyof T, A extends string>(columnName: K, a: A): TypeMatchedValue<T, K, Set<T[K]>, this>;
}
interface CreateableColumnFamilyBuilder<T> {
withCaching(): this;
withCompression(): this;
withCompaction(): this;
withClusteringOrderBy <K extends keyof T>(value: K, direction: 'desc' | 'asc'): this;
}
interface CreateableIndexBuilder {
withOptions(opts: MappedDict<string>): this;
}
interface KeyspaceableQueryBuilder {
withNetworkTopologyStrategy(strategy: MappedDict<number>): this;
withSimpleStrategy(replicas: number): this;
withDurableWrites(durableWrites: boolean): this;
}
interface InsertableQueryBuilder {
into(table: string): this;
ifNotExists(): this;
}
interface TtlableQueryBuilder {
usingTimestamp(timestamp: number): this;
usingTTL(ttl: number): this;
}
interface WhereableQueryBuilder<T> {
where <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
where <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
orWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
orWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
andWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
andWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
tokenWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
tokenWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
ttl <K extends keyof T>(columnName: K): this;
}
interface IfableQueryBuilder<T> {
if <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this;
}
interface LimitableQueryBuilder {
limit(limit: number): this;
limitPerPartition(limit: number): this;
}
interface FromableQueryBuilder {
from(table: string): this;
}
interface UpdateableQueryBuilder<T> {
set <K extends keyof T>(key: K, value: T[K]): this;
set(object: Partial<T>): this;
add <K extends keyof T>(key: K, value: { [str: string]: T[K] }): TypeMatchedValue<T, K, Map<string, T[K]>, this>;
add <K extends keyof T>(key: K, value: Array<T[K]>): TypeMatchedValue<T, K, any[] | Set<any>, this>;
add(object: Partial<T>): this;
remove <K extends keyof T>(key: K, value: Array<T[K]>): this;
remove(object: Partial<T>): this;
increment(column: keyof T, amount: number): this;
increment(object: Partial<T>): this;
decrement(column: keyof T, amount: number): this;
decrement(object: Partial<T>): this;
}
interface AlterableQueryBuilder<T> {
drop <K extends keyof T>(...columns: K[]): this;
rename <K extends keyof T>(column: K, newColumn: K): this;
alter <K extends keyof T>(column: K, newType: string): this;
}
type InsertQueryBuilder = QueryBuilder
& InsertableQueryBuilder
& TtlableQueryBuilder;
type SelectQueryBuilder<T> = QueryBuilder
& WhereableQueryBuilder<T>
& LimitableQueryBuilder
& FromableQueryBuilder;
type UpdateQueryBuilder<T> = QueryBuilder
& WhereableQueryBuilder<T>
& UpdateableQueryBuilder<T>
& IfableQueryBuilder<T>
& TtlableQueryBuilder;
type DeleteQueryBuilder<T> = QueryBuilder
& WhereableQueryBuilder<T>
& FromableQueryBuilder;
type CreateColumnFamilyQueryBuilder<T> = QueryBuilder
& FieldValueQueryBuilder<T>
& CreateableColumnFamilyBuilder<T>;
type KeyspaceQueryBuilder = QueryBuilder
& KeyspaceableQueryBuilder;
type CreateTypeQueryBuilder<T> = QueryBuilder
& FieldValueQueryBuilder<T>;
type AlterColumnFamilyQueryBuilder<T> = QueryBuilder
& AlterableQueryBuilder<T>
& FieldValueQueryBuilder<T>;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cassanknex-tests.ts"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false,
"strict-export-declare-modifiers": false
}
}
+13 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for cesium 1.47
// Type definitions for cesium 1.54
// Project: http://cesiumjs.org
// Definitions by: Aigars Zeiza <https://github.com/Zuzon>
// Harry Nicholls <https://github.com/hnipps>
@@ -706,8 +706,8 @@ declare namespace Cesium {
class Event {
numberOfListeners: number;
addEventListener(listener: () => void, scope?: any): Event.RemoveCallback;
removeEventListener(listener: () => void, scope?: any): boolean;
addEventListener(listener: (...args: any[]) => void, scope?: any): Event.RemoveCallback;
removeEventListener(listener: (...args: any[]) => void, scope?: any): boolean;
raiseEvent(...args: any[]): void;
}
@@ -1393,7 +1393,7 @@ declare namespace Cesium {
class ScreenSpaceEventHandler {
constructor(element?: HTMLCanvasElement);
setInputAction(action: () => void, type: number, modifier?: number): void;
setInputAction(action: (click: { position: Cartesian2 }) => void, type: number, modifier?: number): void;
getInputAction(type: number, modifier?: number): () => void;
removeInputAction(type: number, modifier?: number): void;
isDestroyed(): boolean;
@@ -3134,6 +3134,15 @@ declare namespace Cesium {
static clone(hpr: HeadingPitchRange, result?: HeadingPitchRange): HeadingPitchRange;
}
// tslint:disable-next-line:no-unnecessary-class
class Cesium3DTileset {
constructor(Cesium3DTilesetItem: {
url: string;
maximumScreenSpaceError: number;
maximumNumberOfLoadedTiles: number;
})
}
class ImageryLayer {
alpha: number;
brightness: number;
-141
View File
@@ -1,141 +0,0 @@
import fs = require('fs');
import http = require('http');
import chai = require('chai');
import ChaiHttp = require('chai-http');
import when = require('when');
chai.use(ChaiHttp);
// ReSharper disable WrongExpressionStatement
// Add promise support if this does not exist natively.
if (!global.Promise) {
chai.request.addPromises(when.promise);
}
declare const app: http.Server;
chai.request(app).get('/');
chai.request('http://localhost:8080').get('/');
chai.request(app)
.put('/user/me')
.set('X-API-Key', 'foobar')
.send({ password: '123', confirmPassword: '123' });
chai.request(app)
.post('/user/me')
.field('_method', 'put')
.field('password', '123')
.field('confirmPassword', '123');
chai.request(app)
.post('/user/avatar')
.attach('imageField', fs.readFileSync('avatar.png'), 'avatar.png');
chai.request(app)
.get('/protected')
.auth('user', 'pass');
// HTTPS request, from: https://github.com/visionmedia/superagent/commit/6158efbf42cb93d77c1a70887284be783dd7dabe
const ca = fs.readFileSync('ca.cert.pem');
const key = fs.readFileSync('key.pem');
const cert = fs.readFileSync('cert.pem');
const callback = (err: any, res: ChaiHttp.Response) => {};
chai.request(app)
.post('/secure')
.ca(ca)
.key(key)
.cert(cert)
.end(callback);
const pfx = fs.readFileSync('cert.pfx');
chai.request(app)
.post('/secure')
.pfx(pfx)
.end(callback);
chai.request(app)
.get('/search')
.query({ name: 'foo', limit: 10 });
chai.request(app)
.get('/download')
.buffer()
.parse((res, cb) => {
let data = '';
res.setEncoding('binary');
res.on('data', (chunk: any) => { data += chunk; });
res.on('end', () => { cb(undefined, new Buffer(data, 'binary')); });
});
chai.request(app)
.put('/user/me')
.send({ passsword: '123', confirmPassword: '123' })
.end((err: any, res: ChaiHttp.Response) => {
chai.expect(err).to.be.null;
chai.expect(res).to.have.status(200);
});
chai.request(app)
.put('/user/me')
.send({ passsword: '123', confirmPassword: '123' })
.then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200))
.catch((err: any) => { throw err; });
chai.request(app)
.keepOpen()
.close((err: any) => { throw err; });
const agent = chai.request.agent(app);
agent
.post('/session')
.send({ username: 'me', password: '123' })
.then((res: ChaiHttp.Response) => {
chai.expect(res).to.have.cookie('sessionid');
// The `agent` now has the sessionid cookie saved, and will send it
// back to the server in the next request:
return agent.get('/user/me')
.then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200));
});
agent.close((err: any) => { throw err; });
function test1() {
const req = chai.request(app).get('/');
req.then((res: ChaiHttp.Response) => {
chai.expect(res).to.have.status(200);
chai.expect(res).to.have.header('content-type', 'text/plain');
chai.expect(res).to.have.header('content-type', /^text/);
chai.expect(res).to.have.headers;
chai.expect('127.0.0.1').to.be.an.ip;
chai.expect(res).to.be.json;
chai.expect(res).to.be.html;
chai.expect(res).to.be.text;
chai.expect(res).to.redirect;
chai.expect(res).to.redirectTo('http://example.com');
chai.expect(res).to.have.param('orderby');
chai.expect(res).to.have.param('orderby', 'date');
chai.expect(res).to.not.have.param('limit');
chai.expect(req).to.have.cookie('session_id');
chai.expect(req).to.have.cookie('session_id', '1234');
chai.expect(req).to.not.have.cookie('PHPSESSID');
chai.expect(res).to.have.cookie('session_id');
chai.expect(res).to.have.cookie('session_id', '1234');
chai.expect(res).to.not.have.cookie('PHPSESSID');
chai.expect(res.body).to.have.property('version', '4.0.0');
chai.expect(res.text).to.equal('<html><body></body></html>');
}, (err: any) => {
throw err;
});
}
when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure'));
Promise.resolve(1)
.then(val => chai.request(app).get(`/user/${val}`))
.then(res => {
chai.expect(res).to.have.status(200);
});
-78
View File
@@ -1,78 +0,0 @@
// Type definitions for chai-http 3.0
// Project: https://github.com/chaijs/chai-http
// Definitions by: Wim Looman <https://github.com/Nemo157>
// Liam Jones <https://github.com/G1itcher>
// Federico Caselli <https://github.com/CaselIT>
// Bas Luksenburg <https://github.com/bas-l>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
/// <reference types="chai" />
import * as request from 'superagent';
declare global {
namespace Chai {
interface ChaiStatic {
request: ChaiHttpRequest;
}
interface ChaiHttpRequest {
(server: any): ChaiHttp.Agent;
agent(server: any): ChaiHttp.Agent;
addPromises(promiseConstructor: any): void;
}
interface Assertion {
status(code: number): Assertion;
header(key: string, value?: string | RegExp): Assertion;
headers: Assertion;
json: Assertion;
text: Assertion;
html: Assertion;
redirect: Assertion;
redirectTo(location: string): Assertion;
param(key: string, value?: string): Assertion;
cookie(key: string, value?: string): Assertion;
}
interface TypeComparison {
ip: Assertion;
}
}
namespace ChaiHttp {
interface Promise<T> {
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise<U>;
}
interface Response {
body: any;
type: string;
status: number;
text: string;
setEncoding(encoding: string): void;
on(event: string, fn: (...args: any[]) => void): void;
}
interface Agent {
get(url: string, callback?: (err: any, res: Response) => void): request.Request;
post(url: string, callback?: (err: any, res: Response) => void): request.Request;
put(url: string, callback?: (err: any, res: Response) => void): request.Request;
head(url: string, callback?: (err: any, res: Response) => void): request.Request;
del(url: string, callback?: (err: any, res: Response) => void): request.Request;
options(url: string, callback?: (err: any, res: Response) => void): request.Request;
patch(url: string, callback?: (err: any, res: Response) => void): request.Request;
keepOpen(): Agent;
close(callback?: (err: any) => void): Agent;
}
interface TypeComparison {
ip: any;
}
}
}
declare function chaiHttp(chai: any, utils: any): void;
export = chaiHttp;
+1 -1
View File
@@ -33,7 +33,7 @@ declare class Chart {
clear: () => {};
toBase64Image: () => string;
generateLegend: () => {};
getElementAtEvent: (e: any) => {};
getElementAtEvent: (e: any) => [{}];
getElementsAtEvent: (e: any) => Array<{}>;
getDatasetAtEvent: (e: any) => Array<{}>;
getDatasetMeta: (index: number) => Meta;
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for cli-progress 1.8
// Project: https://github.com/AndiDittrich/Node.CLI-Progress
// Definitions by: My Self <https://github.com/mhegazy>
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+16
View File
@@ -0,0 +1,16 @@
import cloneDeep from 'clone-deep';
cloneDeep<object>(Object.create(null)); // $ExpectType object
cloneDeep<object>({}); // $ExpectType object
cloneDeep({}); // $ExpectType {}
cloneDeep(new Array()); // $ExpectType any[]
cloneDeep<any[]>([]); // $ExpectType any[]
cloneDeep<number>(42); // $ExpectType number
cloneDeep<string>('clone'); // $ExpectType string
cloneDeep<object>({}, true); // $ExpectType object
cloneDeep({}, true); // $ExpectType {}
cloneDeep<number>(42, true); // $ExpectType number
cloneDeep<object>({}, _ => ({})); // $ExpectType object
cloneDeep({}, _ => ({})); // $ExpectType {}
cloneDeep<object>({}, _ => 42); // $ExpectError
cloneDeep(42, _ => ({})); // $ExpectError
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for clone-deep 4.0
// Project: https://github.com/jonschlinkert/clone-deep
// Definitions by: Tanfonto <https://github.com/tanfonto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
export default function cloneDeep<T>(
val: T,
instanceClone?: true | ((val: T) => T)
): T;
@@ -4,16 +4,14 @@
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"env-paths-tests.ts"
]
"files": ["index.d.ts", "clone-deep-tests.ts"]
}
+21
View File
@@ -21,3 +21,24 @@ bindLater((x: number) => {
const session2 = cls.getNamespace('my session');
session2.get('user');
const appNamespace = cls.createNamespace('applicationNameSpace');
const context = appNamespace.createContext();
function bindWithMiddleware(middlewareFn: () => void) {
return session.bind(middlewareFn, context);
}
bindWithMiddleware(() => {
// Some middleware that doing something in the application
});
// In some place in the application, we want to set a value to a given key to be used elsewhere
appNamespace.enter(context);
appNamespace.set('requestId', 'someId');
appNamespace.exit(context);
// Retrieve that value set before without losing the context when chaining several middleware
appNamespace.enter(context);
appNamespace.get('requestId');
appNamespace.exit(context);
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for cls-hooked 4.2
// Type definitions for cls-hooked 4.3
// Project: https://github.com/jeff-lewis/cls-hooked
// Definitions by: Leo Liang <https://github.com/aleung>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -18,6 +18,8 @@ export interface Namespace {
bind<F extends Function>(fn: F, context?: any): F; // tslint:disable-line: ban-types
bindEmitter(emitter: EventEmitter): void;
createContext(): any;
enter(context: any): void;
exit(context: any): void;
}
export function createNamespace(name: string): Namespace;
@@ -0,0 +1,61 @@
import Collection from 'collectionsjs';
const collectable = [
{ name: 'Arya Stark', age: 9 },
{ name: 'Bran Stark', age: 7 },
{ name: 'Jon Snow', age: 14 }
];
const characters = [
{ name: 'Ned Stark', age: 40},
{ name: 'Catelyn Stark', age: 35}
];
const item = { name: 'Sansa Stark', age: 13 };
const array = [
{ name: 'Robert Baratheon', age: 40 },
{ name: 'Joffrey Baratheon', age: 13 }
];
const collection = new Collection(collectable); // $ExpectType Collection<{ name: string; age: number; }>
collection.add(item); // $ExpectType Collection<{ name: string; age: number; }>
collection.all(); // $ExpectType Collection<{ name: string; age: number; }>
collection.average('age'); // $ExpectType number
collection.chunk(2).all(); // $ExpectType Collection<{ name: string; age: number; }>
collection.collect(collectable); // $ExpectType Collection<{ name: string; age: number; }>
collection.concat(characters); // $ExpectType Collection<{ name: string; age: number; }>
collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean
collection.count(); // $ExpectType number
collection.each(stark => stark.age = 3); // $ExpectType Collection<{ name: string; age: number; }>
collection.filter(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }>
collection.find({ name: 'Bran Stark', age: 7 }); // $ExpectType number
collection.first(item => item.age > 7); // $ExpectType { name: string; age: number; }
collection.flatten(true); // $ExpectType Collection<{ name: string; age: number; }>
collection.get(2); // $ExpectType { name: string; age: number; }
collection.has({ name: 'Bran Stark', age: 7 }); // $ExpectType boolean
collection.join(); // $ExpectType string
collection.keys(); // $ExpectType Collection<{ name: string; age: number; }>
collection.last(); // $ExpectType { name: string; age: number; }
collection.map(stark => stark.name); // $ExpectType Collection<string>
collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }>
collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }>
const value = new Collection([1, 2, 3]).reduce((previous, current) => previous + current, 0); // $ExpectType number
collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }>
collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean
collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }>
collection.skip(2); // $ExpectType Collection<{ name: string; age: number; }>
collection.slice(1, 3); // $ExpectType Collection<{ name: string; age: number; }>
collection.sort(); // $ExpectType Collection<{ name: string; age: number; }>
collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number; }>
collection.stringify(); // $ExpectType string
collection.sum('age'); // $ExpectType number
collection.take(2); // $ExpectType Collection<{ name: string; age: number; }>
Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n));
collection.unique(stark => stark.age); // $ExpectType Collection<{ name: string; age: number; }>
collection.values(); // $ExpectType Collection<{ name: string; age: number; }>
collection.where('age', 14); // $ExpectType Collection<{ name: string; age: number; }>
collection.where(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }>
collection.zip(array); // $ExpectType Collection<{ name: string; age: number; }>
+47
View File
@@ -0,0 +1,47 @@
// Type definitions for collectionsjs 0.3
// Project: https://github.com/logaretm/collectionsjs#readme
// Definitions by: Jaymeh <https://github.com/jaymeh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1
export default class Collection<T> {
constructor(items?: T[]);
add(item: T): Collection<T>;
all(): Collection<T>;
average(property?: string | ((property?: number) => number)): number;
chunk(size: number): Collection<T>;
collect(collectable: T[]): Collection<T>;
concat(collection: T[]|Collection<T>): Collection<T>;
contains(closure: ((item: T) => boolean)): boolean;
count(): number;
each(callback: (item: T) => void): Collection<T>;
filter(callback: (item: T) => boolean): Collection<T>;
find(item: T): number;
first(callback?: ((item: T) => boolean)|null): T;
flatten(deep?: boolean): Collection<T>;
get(index: number): T;
has(item: T): boolean;
join(separator?: string): string;
keys(): Collection<T>;
last(callback?: ((item: T) => boolean)|null): T;
map<R>(callback: (item: T) => R): Collection<R>;
pluck(property: string): Collection<T>;
push(item: T): Collection<T>;
reduce<R>(callback: (previous: R, current: T) => R, initial: R): R;
reject(callback: (item: T) => boolean): Collection<T>;
remove(item: T): boolean;
reverse(): Collection<T>;
skip(count: number): Collection<T>;
slice(start: number, end?: number): Collection<T>;
sort(compare?: () => boolean): Collection<T>;
sortBy(property: string, order?: string): Collection<T>;
stringify(): string;
sum(property: T extends object ? keyof T : never): number;
take(count: number): Collection<T>;
static macro(name: string, callback: (coll: Collection<unknown>, ...args: unknown[]) => unknown): void;
unique(callback?: string|null|((item: T) => any)): Collection<T>;
values(): Collection<T>;
where<K extends keyof T>(key: K, value: T[K]): Collection<T>;
where(callback: (item: T) => boolean): Collection<T>;
zip(array: T[]|Collection<T>): Collection<T>;
}
@@ -7,7 +7,6 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -15,10 +14,10 @@
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"ora-tests.ts"
"collectionsjs-tests.ts"
]
}
+9
View File
@@ -70,6 +70,15 @@ export interface Configuration {
* CometD may fail to remain within the max URI length when encoded in JSON.
*/
maxURILength?: number;
/**
* Uses the scheduler service available in Web Workers via Worker.setTimeout(fn, delay) rather
* than using that available via Window.setTimeout(fn, delay). Browsers are now throttling the
* Window scheduler in background tabs to save battery in mobile devices, so the Window scheduler
* events are delayed by possibly several seconds, causing CometD sessions to timeout on the
* server. The Worker scheduler is not throttled and guarantees that scheduler events happen
* on time.
*/
useWorkerScheduler?: boolean;
}
export interface Message {
@@ -0,0 +1,7 @@
import condense = require("condense-whitespace");
// $ExpectType string
condense(" \n\n\t Hello World \t\n");
// $ExpectError
condense(1);
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for condense-whitespace 1.0
// Project: https://github.com/sindresorhus/condense-whitespace
// Definitions by: Daniel Cassidy <https://github.com/djcsdy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function condenseWhitespace(str: string): string;
export = condenseWhitespace;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"condense-whitespace-tests.ts"
]
}
-54
View File
@@ -1,54 +0,0 @@
import Conf = require('conf');
const conf = new Conf<string | number | boolean>();
new Conf<string>({
defaults: {
foo: 'bar',
unicorn: 'rainbow',
},
});
new Conf<string>({ configName: '' });
new Conf<string>({ projectName: 'foo' });
new Conf<string>({ cwd: '' });
new Conf<string>({ encryptionKey: '' });
new Conf<string>({ encryptionKey: new Buffer('') });
new Conf<string>({ encryptionKey: new Uint8Array([1]) });
new Conf<string>({ encryptionKey: new DataView(new ArrayBuffer(2)) });
new Conf<string>({ fileExtension: '.foo' });
// $ExpectError
new Conf<string>({
defaults: {
foo: 'bar',
unicorn: ['rainbow'],
},
});
conf.set('foo', 'bar');
conf.set('hello', 1);
conf.set('unicorn', false);
conf.set('null', null); // $ExpectError
conf.get('foo'); // $ExpectType string | number | boolean
conf.get('foo', 'bar'); // $ExpectType string | number | boolean
conf.get('foo', null); // $ExpectError
conf.delete('foo');
conf.has('foo'); // $ExpectType boolean
conf.clear();
conf.onDidChange('foo', (oldVal, newVal) => {
// $ExpectType string | number | boolean | undefined
oldVal;
// $ExpectType string | number | boolean | undefined
newVal;
});
conf.size; // $ExpectType number
conf.store = {
foo: 'bar',
unicorn: 'rainbow',
};
conf.path; // $ExpectType string
for (const [key, value] of conf) {
key; // $ExpectType string
value; // $ExpectType string | number | boolean
}
-37
View File
@@ -1,37 +0,0 @@
// Type definitions for conf 2.1
// Project: https://github.com/sindresorhus/conf
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
declare class Conf<T = any> implements Iterable<[string, T]> {
store: { [key: string]: T };
readonly path: string;
readonly size: number;
constructor(options?: Conf.Options<T>);
get(key: string, defaultValue?: T): T;
set(key: string, val: T): void;
set(object: { [key: string]: T }): void;
has(key: string): boolean;
delete(key: string): void;
clear(): void;
onDidChange(key: string, callback: (oldVal: T | undefined, newVal: T | undefined) => void): void;
[Symbol.iterator](): Iterator<[string, T]>;
}
declare namespace Conf {
interface Options<T> {
defaults?: { [key: string]: T };
configName?: string;
projectName?: string;
cwd?: string;
encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView;
fileExtension?: string;
}
}
export = Conf;
-20
View File
@@ -1,20 +0,0 @@
import Conf = require('conf');
const conf = new Conf();
conf.set('foo', 'bar');
conf.set('hello', 1);
conf.set('unicorn', false);
conf.set('object', {
foo: 'bar',
unicorn: ['rainbow']
});
conf.get('foo');
conf.delete('foo');
conf.has('foo');
conf.clear();
for (const [key, value] of conf) {
key; // $ExpectType string
value; // $ExpectType string | number | boolean | symbol | {}
}
-29
View File
@@ -1,29 +0,0 @@
// Type definitions for conf 0.11
// Project: https://github.com/sindresorhus/conf
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Options {
defaults?: any;
configName?: string;
projectName?: string;
cwd?: string;
}
declare class Conf implements Iterable<[string, string | number | boolean | symbol | {}]> {
path: string;
store: any;
readonly size: number;
constructor(options?: Options);
get(key: string): any;
set(key: string, val: string | number | boolean | symbol | {}): void;
set(object: {}): void;
has(key: string): boolean;
delete(key: string): void;
clear(): void;
[Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]>;
}
export = Conf;
-29
View File
@@ -1,29 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"conf": [
"conf/v0"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"conf-tests.ts"
]
}
-41
View File
@@ -1,41 +0,0 @@
import Conf = require('conf');
const conf = new Conf<string | number | boolean>();
new Conf<string>({
defaults: {
foo: 'bar',
unicorn: 'rainbow',
},
configName: '',
projectName: 'foo',
cwd: '',
});
// $ExpectError
new Conf<string>({
defaults: {
foo: 'bar',
unicorn: ['rainbow'],
},
});
conf.set('foo', 'bar');
conf.set('hello', 1);
conf.set('unicorn', false);
conf.set('null', null); // $ExpectError
conf.get('foo'); // $ExpectType string | number | boolean
conf.get('foo', 'bar'); // $ExpectType string | number | boolean
conf.get('foo', null); // $ExpectError
conf.delete('foo');
conf.has('foo'); // $ExpectType boolean
conf.clear();
conf.store = {
foo: 'bar',
unicorn: 'rainbow',
};
conf.path; // $ExpectType string
for (const [key, value] of conf) {
key; // $ExpectType string
value; // $ExpectType string | number | boolean
}
-31
View File
@@ -1,31 +0,0 @@
// Type definitions for conf 1.4
// Project: https://github.com/sindresorhus/conf
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
interface Options<T> {
defaults?: { [key: string]: T };
configName?: string;
projectName?: string;
cwd?: string;
}
declare class Conf<T = any> implements Iterable<[string, T]> {
store: { [key: string]: T };
readonly path: string;
readonly size: number;
constructor(options?: Options<T>);
get(key: string, defaultValue?: T): T;
set(key: string, val: T): void;
set(object: { [key: string]: T }): void;
has(key: string): boolean;
delete(key: string): void;
clear(): void;
onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void;
[Symbol.iterator](): Iterator<[string, T]>;
}
export = Conf;
-29
View File
@@ -1,29 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"conf": [
"conf/v1"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"conf-tests.ts"
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for config-yaml 1.1
// Project: https://github.com/neolao/config-yaml#readme
// Definitions by: My Self <https://github.com/me>
// Definitions by: Arylo Yeung <https://github.com/Arylo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
+4 -1
View File
@@ -6,5 +6,8 @@ const store = new RedisStore({
host: 'localhost',
port: 6379,
logErrors: error => console.warn(error),
scanCount: 80,
scanCount: 80,
ttl: (store, sess, sessionID) => {
return 60;
}
});
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for connect-redis
// Project: https://npmjs.com/package/connect-redis
// Definitions by: Xavier Stouder <https://github.com/xstoudi>
// Seth Butler <https://github.com/sbutler2901>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -26,7 +27,7 @@ declare module "connect-redis" {
port?: number;
socket?: string;
url?: string;
ttl?: number;
ttl?: number | string | ((store: RedisStore, sess: Express.SessionData, sid: string) => number);
disableTTL?: boolean;
db?: number;
pass?: string;
@@ -0,0 +1,24 @@
/// <reference types="node" />
import Core, { Source } from "css-modules-loader-core";
const core = new Core();
const emptyPlugins = new Core([]);
const withPlugins = new Core([
Core.values,
Core.localByDefault,
Core.extractImports,
Core.scope
]);
const withDefaultPlugins = new Core(Core.defaultPlugins);
// $ExpectError
const noArray = new Core(Core.values);
// Validating the source can be anything that has toString() defined
const bufferSource: Source = new Buffer("str");
core.load("str").then(({ injectableSource, exportTokens }) => {
const str: string = injectableSource;
exportTokens["key"] = "value";
});
+50
View File
@@ -0,0 +1,50 @@
// Type definitions for css-modules-loader-core 1.1
// Project: https://github.com/css-modules/css-modules-loader-core
// Definitions by: Spencer Miskoviak <https://github.com/skovy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
import { Plugin } from "postcss";
declare namespace Core {
type Source =
| string
| {
toString(): string;
};
type PathFetcher = (
file: string,
relativeTo: string,
depTrace: string
) => void;
interface ExportTokens {
[index: string]: string;
}
interface Result {
injectableSource: string;
exportTokens: ExportTokens;
}
}
declare class Core {
static values: Plugin<{}>;
static localByDefault: Plugin<{}>;
static extractImports: Plugin<{}>;
static scope: Plugin<{}>;
static defaultPlugins: Array<Plugin<{}>>;
constructor(plugins?: Array<Plugin<any>>);
load(
source: Core.Source,
sourcePath?: string,
trace?: string,
pathFetcher?: Core.PathFetcher
): Promise<Core.Result>;
}
export = Core;
export as namespace Core;
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"postcss": "7.x.x"
}
}

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