;
+
+export function requiredBy(
+ requiredByPropName: string,
+ propType: PropTypes.Validator
,
+ defaultValue?: any,
+): PropTypes.Requireable
;
+
+export function restrictedProp(
+ messageFunction?: (
+ props: object,
+ propName: string,
+ componentName: string,
+ location: string,
+ propFullName: string,
+ ) => string | Error | undefined,
+): PropTypes.Requireable;
+
+export function sequenceOf(...specifiers: Specifier[]): PropTypes.Requireable;
+
+export function shape(
+ propTypes: PropTypes.ValidationMap,
+): PropTypes.Requireable;
+
+export function stringStartsWith(string: string): PropTypes.Requireable;
+
+export function uniqueArray(): PropTypes.Requireable;
+
+export function uniqueArrayOf(
+ propType: PropTypes.Validator,
+ mapperOrName: ((value: any) => any) | string,
+ name?: string,
+): PropTypes.Requireable;
+
+export function valuesOf(
+ propType: PropTypes.Validator,
+): PropTypes.Requireable<{ [key: string]: T }>;
+
+export function withShape(
+ propType: PropTypes.Validator,
+ propTypes: PropTypes.ValidationMap,
+): PropTypes.Requireable;
diff --git a/types/airbnb-prop-types/tsconfig.json b/types/airbnb-prop-types/tsconfig.json
new file mode 100644
index 0000000000..ccefe4943c
--- /dev/null
+++ b/types/airbnb-prop-types/tsconfig.json
@@ -0,0 +1,16 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": ["es6"],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": ["../"],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": ["index.d.ts", "airbnb-prop-types-tests.ts"]
+}
diff --git a/types/airbnb-prop-types/tslint.json b/types/airbnb-prop-types/tslint.json
new file mode 100644
index 0000000000..71ee04c4e1
--- /dev/null
+++ b/types/airbnb-prop-types/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": "dtslint/dt.json",
+ "rules": {
+ "no-unnecessary-generics": false
+ }
+}
diff --git a/types/ali-oss/index.d.ts b/types/ali-oss/index.d.ts
index 13f7f56ff9..e4f9e09e7c 100644
--- a/types/ali-oss/index.d.ts
+++ b/types/ali-oss/index.d.ts
@@ -18,6 +18,7 @@ declare namespace OSS {
internal?: boolean; // access OSS with aliyun internal network or not, default is false. If your servers are running on aliyun too, you can set true to save lot of money.
secure?: boolean; // instruct OSS client to use HTTPS (secure: true) or HTTP (secure: false) protocol.
timeout?: string | number; // instance level timeout for all operations, default is 60s
+ cname?: boolean; // use custom domain name
}
interface Bucket {
@@ -29,7 +30,7 @@ declare namespace OSS {
type StorageType = "Standard" | "IA" | "Archive";
- type ACLType = "public-read-write" | "public-read" | "and private";
+ type ACLType = "public-read-write" | "public-read" | "private";
type HTTPMethods = "GET" | "POST" | "DELETE" | "PUT";
@@ -174,6 +175,7 @@ declare namespace OSS {
mime?: string; // custom mime, will send with Content-Type entity header
meta?: UserMeta; // user meta, will send with x-oss-meta- prefix string e.g.: { uid: 123, pid: 110 }
callback: ObjectCallback;
+ headers?: object;
}
interface PutObjectResult {
@@ -188,6 +190,7 @@ declare namespace OSS {
mime: string; // custom mime, will send with Content-Type entity header
meta: UserMeta;
callback: ObjectCallback;
+ headers?: object;
}
interface AppendObjectOptions {
diff --git a/types/all-keys/all-keys-tests.ts b/types/all-keys/all-keys-tests.ts
new file mode 100644
index 0000000000..6bbb6021c7
--- /dev/null
+++ b/types/all-keys/all-keys-tests.ts
@@ -0,0 +1,5 @@
+import allKeys = require('all-keys');
+
+allKeys(Symbol.prototype); // $ExpectType Set
+allKeys(Symbol.prototype, { includeObjectPrototype: false }); // $ExpectType Set
+allKeys(Symbol.prototype, { includeSymbols: false }); // $ExpectType Set
diff --git a/types/all-keys/index.d.ts b/types/all-keys/index.d.ts
new file mode 100644
index 0000000000..9301c8f929
--- /dev/null
+++ b/types/all-keys/index.d.ts
@@ -0,0 +1,29 @@
+// Type definitions for all-keys 2.0
+// Project: https://github.com/sindresorhus/all-keys#readme
+// Definitions by: BendingBender
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+
+export = allKeys;
+
+/**
+ * Get all property keys of an object including non-enumerable and inherited ones.
+ * Like [Reflect.ownKeys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
+ * but traverses up the prototype-chain.
+ */
+declare function allKeys(obj: object, options?: allKeys.Options): Set;
+
+declare namespace allKeys {
+ interface Options {
+ /**
+ * Include `Object.prototype` properties like `isPrototypeOf`.
+ * @default true
+ */
+ includeObjectPrototype?: boolean;
+ /**
+ * Include [Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) keys.
+ * @default true
+ */
+ includeSymbols?: boolean;
+ }
+}
diff --git a/types/all-keys/tsconfig.json b/types/all-keys/tsconfig.json
new file mode 100644
index 0000000000..a6f20f786f
--- /dev/null
+++ b/types/all-keys/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "all-keys-tests.ts"
+ ]
+}
diff --git a/types/all-keys/tslint.json b/types/all-keys/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/all-keys/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/all-property-names/all-property-names-tests.ts b/types/all-property-names/all-property-names-tests.ts
new file mode 100644
index 0000000000..b32daa59a3
--- /dev/null
+++ b/types/all-property-names/all-property-names-tests.ts
@@ -0,0 +1,4 @@
+import allPropertyNames = require('all-property-names');
+
+// $ExpectType Set
+allPropertyNames(Symbol.prototype);
diff --git a/types/all-property-names/index.d.ts b/types/all-property-names/index.d.ts
new file mode 100644
index 0000000000..0b396ec94d
--- /dev/null
+++ b/types/all-property-names/index.d.ts
@@ -0,0 +1,9 @@
+// Type definitions for all-property-names 1.0
+// Project: https://github.com/sindresorhus/all-property-names#readme
+// Definitions by: BendingBender
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+
+export = allPropertyNames;
+
+declare function allPropertyNames(input: object): Set;
diff --git a/types/all-property-names/tsconfig.json b/types/all-property-names/tsconfig.json
new file mode 100644
index 0000000000..394cd3bb53
--- /dev/null
+++ b/types/all-property-names/tsconfig.json
@@ -0,0 +1,23 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "all-property-names-tests.ts"
+ ]
+}
diff --git a/types/all-property-names/tslint.json b/types/all-property-names/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/all-property-names/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/alt/index.d.ts b/types/alt/index.d.ts
index 9094642e70..515a67986a 100644
--- a/types/alt/index.d.ts
+++ b/types/alt/index.d.ts
@@ -54,12 +54,12 @@ declare namespace AltJS {
export type Source = {[name:string]: () => SourceModel};
export interface SourceModel {
- local(state:any, ...args: any[]):any;
+ local?(state:any, ...args: any[]):any;
remote(state:any, ...args: any[]):Promise;
shouldFetch?(fetchFn:(...args:Array) => boolean):void;
loading?:(args:any) => void;
- success?:(state:S) => void;
- error?:(args:any) => void;
+ success:(state:S) => void;
+ error:(args:any) => void;
interceptResponse?(response:any, action:Action, ...args:Array):any;
}
diff --git a/types/amap-js-sdk/amap-js-sdk-tests.ts b/types/amap-js-sdk/amap-js-sdk-tests.ts
new file mode 100644
index 0000000000..f09bca3760
--- /dev/null
+++ b/types/amap-js-sdk/amap-js-sdk-tests.ts
@@ -0,0 +1,22 @@
+const aMap = new AMap.Map('id', {
+ resizeEnable: true,
+ animateEnable: true
+});
+
+aMap.setCenter(new AMap.LngLat(0, 0));
+
+AMap.plugin(['someplugin'], () => {
+ console.log('plugin loaded');
+});
+
+AMap.convertFrom([116.3, 39.9], 'gps', (status, result) => {
+ if (result.info === 'ok') {
+ const _ = result.locations;
+ }
+});
+
+new AMap.Marker({
+ map: aMap,
+ title: '',
+ position: new AMap.LngLat(0, 0),
+});
diff --git a/types/amap-js-sdk/index.d.ts b/types/amap-js-sdk/index.d.ts
new file mode 100644
index 0000000000..a1b93e6cb3
--- /dev/null
+++ b/types/amap-js-sdk/index.d.ts
@@ -0,0 +1,1392 @@
+// Type definitions for amap-js-sdk 1.4
+// Project: http://lbs.amap.com/api/javascript-api/summary/
+// Definitions by: Bian Zhongjie
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace AMap {
+ type EventCallback = (...args: any[]) => void;
+ type GenericEventCallback = (res: T) => void;
+
+ /**
+ * 加载插件
+ * @param pluginNames
+ * @param ready
+ */
+ function plugin(pluginNames: string[], ready?: () => void): void;
+
+ /**
+ * 加载服务
+ * @param serviceName
+ * @param ready
+ */
+ function service(serviceName: string, ready?: () => void): void;
+
+ namespace event {
+ /**
+ * 注册DOM对象事件:给DOM对象注册事件,并返回eventListener。运行AMap.event.removeListener(eventListener)可以删除该事件的监听器。
+ * @param instance:需注册事件的DOM对象(必填)
+ * @param eventName:事件名称(必填)
+ * @param handler:事件功能函数(必填)
+ * @param context:事件上下文(可选,缺省时,handler中this指向参数instance引用的对象,否则this指向context引用的对象)
+ */
+ const addDomListener: (instance: any, eventName: string, handler: EventCallback, context?: any) => EventListener;
+
+ /**
+ * 注册对象事件:给对象注册事件,并返回eventListener。运行AMap.event.removeListener(eventListener)可以删除该事件的监听器。
+ * @param instance:需注册事件的对象(必填)
+ * @param eventName:事件名称(必填)
+ * @param handler:事件功能函数(必填)
+ * @param context:事件上下文(可选,缺省时,handler中this指向参数instance引用的对象,否则this指向context引用的对象)
+ */
+ const addListener: (instance: any, eventName: string, handler: EventCallback, context?: any) => EventListener;
+
+ /**
+ * 类似于addListener,但处理程序会在处理完第一个事件后将自已移除。
+ */
+ const addListenerOnce: (instance: any, eventName: string, handler: EventCallback, context?: any) => EventListener;
+
+ /**
+ * 删除由上述 event.addDomListener 和 event.addListener 传回的指定侦听器。
+ */
+ const removeListener: (listener: EventListener) => void;
+
+ /**
+ * 触发非DOM事件:触发非DOM事件eventName,extArgs将扩展到事件监听函数(handler)接受到的event参数中。如:在extArgs内写入{m:10,p:2},eventName监听函数(handler)可以接收到包含m,p两个key值的event对象。
+ */
+ const trigger: (instance: any, eventName: string, extArgs: any) => void;
+ }
+
+ /**
+ * 此对象用于表示地图、覆盖物、叠加层上的各种鼠标事件返回,包含以下字段:
+ */
+ interface MapsEventOptions {
+ lnglat: LngLat;
+ pixel: Pixel;
+ type: string;
+ target: any;
+ }
+
+ abstract class EventBindable {
+ on(eventName: string, callback: EventCallback): void;
+ off(eventName: string, callback: EventCallback): void;
+ }
+
+ /* --------------------------- 基础类 --------------------------- */
+ /* 参考地址:http://lbs.amap.com/api/javascript-api/reference/core */
+
+ /**
+ * 像素坐标,确定地图上的一个像素点。
+ */
+ class Pixel {
+ /**
+ * 构造一个像素坐标对象。
+ */
+ constructor(x: number, y: number);
+ /**
+ * 获得X方向像素坐标
+ */
+ getX(): number;
+
+ /**
+ * 获得Y方向像素坐标
+ */
+ getY(): number;
+
+ /**
+ * 当前像素坐标与传入像素坐标是否相等
+ */
+ equals(point: Pixel): boolean;
+
+ /**
+ * 以字符串形式返回像素坐标对象
+ */
+ toString(): string;
+ }
+
+ /**
+ * 地物对象的像素尺寸
+ */
+ class Size {
+ /**
+ * 构造尺寸对象
+ * @param width 宽度,单位:像素
+ * @param height 高度,单位:像素
+ */
+ constructor(width: number, height: number);
+
+ /**
+ * 获得宽度
+ */
+ getWidth(): number;
+
+ /**
+ * 获得高度
+ */
+ getHeight(): number;
+
+ /**
+ * 以字符串形式返回尺寸大小对象
+ */
+ toString(): string;
+ }
+
+ /**
+ * 经纬度坐标,确定地图上的一个点
+ */
+ class LngLat {
+ /**
+ * 构造一个地理坐标对象
+ * @param lng 经度
+ * @param lat 纬度
+ */
+ constructor(lng: number, lat: number);
+
+ /**
+ * 当前经纬度坐标值经度移动w,纬度移动s,得到新的坐标。
+ *
+ * @param w 经度,向右移为正值,单位:米
+ * @param s 纬度,向上移为正值,单位:米
+ */
+ offset(w: number, s: number): LngLat;
+
+ /**
+ * 计算当前经纬度和传入经纬度或者经纬度数组连线之间的地面距离,单位为米
+ *
+ * @param lnglat 传入的经纬度
+ */
+ distance(lnglat: LngLat | [number, number]): number;
+
+ /**
+ * 获取经度值
+ */
+ getLng(): number;
+
+ /**
+ * 获取纬度值
+ */
+ getLat(): number;
+
+ /**
+ * 判断当前坐标对象与传入坐标对象是否相等
+ *
+ * @param lnglat 传入坐标对象
+ */
+ equals(lnglat: LngLat): boolean;
+
+ /**
+ * LngLat对象以字符串的形式返回
+ */
+ toString(): string;
+ }
+
+ /**
+ * 地物对象的经纬度矩形范围
+ */
+ class Bounds {
+ /**
+ * 构造一个矩形范围
+ * @param southWest 西南角经纬度坐标
+ * @param northEast 东北角经纬度坐标
+ */
+ constructor(southWest: LngLat, northEast: LngLat);
+
+ /**
+ * 判断指定点坐标是否在矩形范围内
+ * @param point 指定点
+ */
+ contains(point: LngLat): boolean;
+
+ /**
+ * 获取当前Bounds的中心点经纬度坐标
+ */
+ getCenter(): LngLat;
+
+ /**
+ * 获取西南角坐标
+ */
+ getSouthWest(): LngLat;
+
+ /**
+ * 获取东北角坐标
+ */
+ getNorthEast(): LngLat;
+
+ /**
+ * 以字符串形式返回地物对象的矩形范围
+ */
+ toString(): string;
+ }
+
+ interface TileLayerOptions {
+ map: Map;
+ tileSize: number;
+ tileUrl: string;
+ errorUrl: string;
+ getTileUrl: (x: number, y: number, z: number) => string;
+ zIndex: number;
+ opacity: number;
+ zooms: number[];
+ detectRetina: boolean;
+ }
+
+ abstract class Layer extends EventBindable {
+ setOpacity(alpha: number): void;
+ show(): void;
+ hide(): void;
+ getTiles(): string[];
+ reload(): void;
+ setTileUrl(): void;
+ getZooms(): number[];
+ setzIndex(index: number): void;
+ setMap(map: Map): void;
+ }
+
+ class TileLayer extends Layer {
+ constructor(tileOpt?: {
+ map: Map,
+ tileSize?: number,
+ tileUrl?: string,
+ errorUrl?: string,
+ getTileUrl?: (x: number, y: number, z: number) => string,
+ zIndex?: number,
+ opacity?: number,
+ zooms?: number[],
+ detectRetina?: boolean
+ });
+ }
+
+ namespace TileLayer {
+ abstract class MapTypeLayer extends Layer {
+ constructor(options?: {
+ map: Map,
+ zIndex?: number,
+ opacity?: number,
+ zooms?: number[],
+ detectRetina?: boolean
+ });
+ }
+
+ class Satellite extends MapTypeLayer {
+ }
+
+ class RoadNet extends MapTypeLayer {
+ }
+
+ class Traffic extends MapTypeLayer {
+ constructor(options?: {
+ map: Map,
+ zIndex?: number,
+ opacity?: number,
+ zooms?: number[],
+ detectRetina?: boolean,
+ autoRefresh?: boolean,
+ interval?: number
+ });
+
+ interval: number;
+ autoRefresh: boolean;
+ }
+ }
+
+ class IndoorMap {
+ constructor(opts: {
+ zIndex?: number,
+ opacity?: number,
+ cursor?: string,
+ hideFloorBar?: boolean,
+ alwaysShow?: boolean
+ });
+
+ showIndoorMap(indoorid: string, floor: number, shopid: string): void;
+
+ showFloor(floor: number, noMove: boolean): void;
+
+ setMap(map: Map): void;
+
+ show(): void;
+
+ hide(): void;
+
+ setzIndex(): void;
+
+ showFloorBar(): void;
+
+ hideFloorBar(): void;
+
+ setOpacity(alpha: number): void;
+
+ getOpacity(): number;
+
+ showLabels(): void;
+
+ hideLabels(): void;
+
+ getSelectedBuildingId(): string;
+
+ getSelectedBuilding(): string;
+ }
+
+ interface MapOptions {
+ view?: View2D;
+ layers?: TileLayer[];
+ level?: number;
+ center?: LngLat;
+ labelzIndex?: number;
+ zooms?: number[];
+ lang?: string;
+ cursor?: string;
+ crs?: string;
+ animateEnable?: boolean;
+ isHotspot?: boolean;
+ defaultLayer?: TileLayer;
+ rotateEnable?: boolean;
+ resizeEnable?: boolean;
+ showIndoorMap?: boolean;
+ indoorMap?: IndoorMap;
+ expandZoomRange?: boolean;
+ dragEnable?: boolean;
+ zoomEnable?: boolean;
+ doubleClickZoom?: boolean;
+ keyboardEnable?: boolean;
+ jogEnable?: boolean;
+ scrollWheel?: boolean;
+ touchZoom?: boolean;
+ mapStyle?: string;
+ features?: string[];
+ }
+
+ class View2D {
+ constructor(opt: {
+ center?: LngLat,
+ rotation?: number,
+ zoom?: number,
+ crs?: 'EPSG3857'|'EPSG3395'|'EPSG4326'
+ });
+
+ /**
+ * To silence lint error, this class has to be exists.
+ */
+ toString(): string;
+ }
+
+ class Map extends EventBindable {
+ constructor(mapDiv: string, opts?: MapOptions);
+
+ getZoom(): number;
+
+ getLayers(): TileLayer[];
+
+ getCenter(): LngLat;
+
+ getCity(callback: (result: {
+ provice: string,
+ city: string,
+ citycode: string,
+ district: string
+ }) => void): void;
+
+ getBounds(): Bounds;
+ getlabelzIndex(): number;
+ getLimitBounds(): Bounds;
+ getLang(): string;
+ getSize(): Size;
+ getRotation(): number;
+ getStatus(): any;
+ getDefaultCursor(): string;
+ getResolution(point: LngLat): number;
+ getScale(dpi: number): number;
+ setZoom(level: number): void;
+ setlabelzIndex(index: number): void;
+ setLayers(layers: TileLayer[]): void;
+ add(overlayers: any[]): void;
+ remove(overlayers: any[]): void;
+ getAllOverlays(type: string): Marker[] | Circle[] | Polygon[] | Polyline[];
+ setCenter(position: LngLat): void;
+ setZoomAndCenter(zoomLevel: number, center: LngLat): void;
+ setCity(city: string, callback: () => void): void;
+ setBounds(bound: Bounds): void;
+ setLimitBounds(bound: Bounds): void;
+ clearLimitBounds(): void;
+ setLang(lang: string): void;
+ setRotation(rotation: number): void;
+ setStatus(status: any): void;
+ setDefaultCursor(cursor: string): void;
+ zoomIn(): void;
+ zoomOut(): void;
+ panTo(position: LngLat): void;
+ panBy(x: number, y: number): void;
+ setFitView(overlayList?: any[]): void;
+ clearMap(): void;
+ destroy(): void;
+ plugin(name: string| string[], callback: () => void): void;
+ addControl(obj: any): void;
+ removeControl(obj: any): void;
+ clearInfoWindow(): void;
+ pixelToLngLat(pixel: Pixel, level: number): LngLat;
+ lnglatToPixel(lnglat: LngLat, level: number): Pixel;
+ containerToLngLat(pixel: Pixel, level: number): LngLat;
+ lngLatToContainer(lnglat: LngLat, level: number): Pixel;
+ setMapStyle(style: string): void;
+ getMapStyle(): string;
+ setFeatures(features: string[]): void;
+ getFeatures(): string[];
+ setDefaultLayer(layer: TileLayer): void;
+ }
+
+ class Icon {
+ constructor(options?: {
+ size?: Size,
+ imageOffset?: Pixel,
+ image?: string,
+ imageSize?: Size
+ });
+
+ getImageSize(): Size;
+ setImageSize(size: Size): void;
+ }
+
+ /**
+ * MarkerShape用于划定Marker的可点击区域范围。需要注意的是,在IE浏览器中图标透明区域默认为不触发事件,因此MarkerShape在IE中不起作用。
+ */
+ class MarkerShape {
+ constructor(options: {
+ /**
+ *
+ * 可点击区域组成元素数组,存放图形的像素坐标等信息,该数组元素由type决定:
+ * - circle:coords格式为 [x1, y1, r],x1,y1为圆心像素坐标,r为圆半径
+ * - poly: coords格式为 [x1, y1, x2, y2 … xn, yn],各x,y表示多边形边界像素坐标
+ * - rect: coords格式为 [x1, y1, x2, y2],x1,y1为矩形左上角像素坐标,x2,y2为矩形右下角像素坐标
+ * Markshape的像素坐标是指相对于marker的左上角的像素坐标偏移量
+ */
+ coords?: number[],
+
+ /**
+ * 可点击区域类型,可选值:
+ * - circle:圆形
+ * - poly:多边形
+ * - rect:矩形
+ */
+ type?: string
+ });
+
+ /**
+ * To silence lint error, this class has to be exists.
+ */
+ toString(): string;
+ }
+
+ interface MarkerOptions {
+ map?: Map;
+ position?: LngLat;
+ offset?: Pixel;
+ icon?: string|Icon;
+ content?: string| HTMLElement;
+ topWhenClick?: boolean;
+ topWhenMouseOver?: boolean;
+ draggable?: boolean;
+ raiseOnDrag?: boolean;
+ cursor?: string;
+ visible?: boolean;
+ zIndex?: number;
+ angle?: number;
+ autoRotation?: boolean;
+ animation?: string;
+ shadow?: Icon;
+ title?: string;
+ clickable?: boolean;
+ shape?: MarkerShape;
+ extData?: any;
+ label?: { content: string, offset: Pixel };
+ }
+
+ /**
+ * 点标记。
+ */
+ class Marker extends EventBindable {
+ constructor(options?: MarkerOptions);
+
+ markOnAMAP(obj: {
+ name: string,
+ position: LngLat
+ }): void;
+
+ getOffset(): Pixel;
+ setOffset(offset: Pixel): void;
+
+ setAnimation(animate: string): void;
+ getAnimation(): string;
+
+ setClickable(clickable: boolean): void;
+ getClickable(): boolean;
+
+ getPosition(): LngLat;
+ setPosition(lnglat: LngLat): void;
+
+ setAngle(angle: number): void;
+ getAngle(): number;
+
+ setLabel(label: {
+ content?: string,
+ offset?: Pixel
+ }): void;
+ getLabel(): {
+ content?: string,
+ offset?: Pixel
+ };
+
+ setzIndex(index: number): void;
+
+ getIcon(): string|Icon;
+ setIcon(content: string|Icon): void;
+
+ setDraggable(draggable: boolean): void;
+ getDraggable(): boolean;
+
+ hide(): void;
+ show(): void;
+
+ setCursor(cursor: string): void;
+
+ setContent(content: string| HTMLElement): void;
+ getContent(): string;
+
+ moveAlong(lnglatlist: LngLat[], speed?: number, f?: (k: number) => number, circlable?: boolean): void;
+ moveTo(lnglat: LngLat, speed?: number, f?: (k: number) => number): void;
+ stopMove(): void;
+ setMap(map: Map): void;
+ getMap(): Map;
+ setTitle(title: string): void;
+ getTitle(): string;
+ setTop(isTop: boolean): void;
+ getTop(): boolean;
+ setShadow(icon: Icon): void;
+ getShadow(): Icon;
+ setShape(shape: MarkerShape): void;
+ getShape(): MarkerShape;
+ setExtData(ext: any): void;
+ getExtData(): any;
+ }
+
+ interface MarkerClustererOptions {
+ gridSize?: number;
+ minClusterSize?: number;
+ maxZoom?: number;
+ averageCenter?: boolean;
+ styles?: any[];
+ renderCluserMarker?: (obj: any) => void;
+ zoomOnClick?: boolean;
+ }
+
+ /**
+ * 用于地图上加载大量点标记,提高地图的绘制和显示性能。
+ */
+ class MarkerClusterer extends EventBindable {
+ constructor(map: Map, markers: Marker[], opt?: MarkerClustererOptions);
+
+ /**
+ * 添加一个需进行聚合的点标记
+ * @param marker
+ */
+ addMarker(marker: Marker): void;
+
+ /**
+ * 删除一个聚合的点标记
+ * @param marker 点标记
+ */
+ removeMarker(marker: Marker): void;
+
+ /**
+ * 获取聚合点的总数量
+ */
+ getClustersCount(): number;
+
+ /**
+ * 获取聚合网格的像素大小
+ */
+ getGridSize(): number;
+
+ /**
+ * 获取地图中点标记的最大聚合级别
+ */
+ getMaxZoom(): number;
+
+ /**
+ * 获取单个聚合的最小数量
+ */
+ getMinClusterSize(): number;
+
+ /**
+ * 获取聚合的样式风格集合
+ */
+ getStyles(): any[];
+
+ /**
+ * 设置聚合网格的像素大小
+ * @param size
+ */
+ setGridSize(size: number): void;
+
+ /**
+ * 设置地图中点标记的最大聚合级别
+ * @param zoom
+ */
+ setMaxZoom(zoom: number): void;
+
+ /**
+ * 设置单个聚合的最小数量
+ * @param size
+ */
+ setMinClusterSize(size: number): void;
+
+ /**
+ * 设置聚合的样式风格
+ * @param styles
+ */
+ setStyles(styles: any[]): void;
+
+ /**
+ * 从地图上彻底清除所有聚合点标记
+ */
+ clearMarkers(): void;
+
+ /**
+ * 设置将进行点聚合的地图对象
+ * @param map
+ */
+ setMap(map: Map): void;
+
+ /**
+ * 设置将进行点聚合显示的点标记集合
+ * @param markers
+ */
+ setMarkers(markers: Marker[]): void;
+
+ /**
+ * 获取该点聚合的地图对象
+ */
+ getMap(): Map;
+
+ /**
+ * 获取该点聚合中的点标记集合
+ */
+ getMarkers(): Marker[];
+
+ /**
+ * 添加一组需进行聚合的点标记
+ */
+ addMarkers(markers: Marker[]): void;
+
+ /**
+ * 删除一组聚合的点标记
+ * @param markers
+ */
+ removeMarkers(markers: Marker[]): void;
+
+ /**
+ * 获取单个聚合点位置是否是聚合内所有标记的平均中心
+ */
+ isAverageCenter(): boolean;
+
+ /**
+ * 设置单个聚合点位置是否是聚合内所有标记的平均中心
+ * @param averageCenter
+ */
+ setAverageCenter(averageCenter: boolean): void;
+ }
+
+ interface CircleOptions {
+ map: Map;
+ zIndex?: number;
+ center: LngLat;
+ radius?: number;
+ strokeColor?: string;
+ strokeOpacity?: number;
+ fillColor?: string;
+ fillOpacity?: string;
+ strokeStyle?: string;
+ extData?: any;
+ strokeDasharray?: number[];
+ }
+
+ class Circle {
+ constructor(options?: CircleOptions);
+ setCenter(lnglat: LngLat): void;
+ getCenter(): LngLat;
+ getBounds(): Bounds;
+ setRadius(radius: number): void;
+ getRadius(): number;
+ setOptions(circleopt: CircleOptions): void;
+ getOptions(): CircleOptions;
+ hide(): void;
+ show(): void;
+ setMap(map: Map): void;
+ setExtData(ext: any): void;
+ getExtData(): any;
+ contains(point: LngLat): boolean;
+ }
+
+ interface PolygonOptions {
+ map?: Map;
+ zIndex?: number;
+ path?: LngLat[]|LngLat[][];
+ strokeColor?: string;
+ strokeOpacity?: number;
+ strokeWeight?: number;
+ fillColor?: string;
+ fillOpacity?: number;
+ extData?: any;
+ strokeStyle?: string;
+ strokeDasharray?: number[];
+ }
+
+ class Polygon extends EventBindable {
+ constructor(options?: PolygonOptions);
+
+ setPath(path: LngLat[]|LngLat[][]): void;
+ getPath(): LngLat[]|LngLat[][];
+ setOptions(opt: PolygonOptions): void;
+ getOptions(): PolygonOptions;
+ getBounds(): Bounds;
+ getArea(): number;
+ hide(): void;
+ show(): void;
+ setMap(map: Map): void;
+ setExtData(ext: any): void;
+ getExtData(): any;
+ contains(point: LngLat): boolean;
+ }
+
+ interface PolylineOptions {
+ map?: Map;
+ zIndex?: number;
+ geodesic?: boolean;
+ isOutline?: boolean;
+ outlineColor?: string;
+ path?: LngLat[];
+ strokeColor?: string;
+ strokeOpacity?: number;
+ strokeWeight?: number;
+ strokeStyle?: string;
+ strokeDasharray?: number[];
+ extData?: any;
+ }
+
+ class Polyline extends EventBindable {
+ constructor(options?: PolylineOptions);
+
+ setPath(path: LngLat[]): void;
+ getPath(): LngLat[];
+
+ setOptions(opt: PolylineOptions): void;
+ getOptions(): PolylineOptions;
+
+ getLength(): number;
+ getBounds(): Bounds;
+ hide(): void;
+ show(): void;
+
+ setMap(map: Map): void;
+ setExtData(ext: any): void;
+ getExtData(): any;
+ }
+
+ interface MapControl {
+ show(): void;
+ hide(): void;
+ }
+
+ class MapType implements MapControl {
+ constructor(options?: {
+ defaultType?: number;
+ showTraffic?: boolean;
+ showRoad?: boolean;
+ });
+
+ show(): void;
+ hide(): void;
+ }
+
+ class OverView extends EventBindable implements MapControl {
+ constructor(options?: {
+ tileLayer?: TileLayer[],
+ isOpen?: boolean,
+ visible?: boolean
+ });
+
+ open(): void;
+ close(): void;
+ setTileLayer(layer: TileLayer): void;
+ getTileLayer(): TileLayer;
+ show(): void;
+ hide(): void;
+ }
+
+ class Scale extends EventBindable implements MapControl {
+ offset: Pixel;
+ position: string;
+
+ show(): void;
+ hide(): void;
+ }
+
+ class ToolBar extends EventBindable implements MapControl {
+ constructor(options?: {
+ offset?: Pixel,
+ position?: string,
+ ruler?: boolean,
+ noIpLocate?: boolean,
+ locate?: boolean,
+ liteStyle?: boolean,
+ direction?: boolean,
+ autoPosition?: boolean,
+ locationMarker?: Marker,
+ useNative?: boolean
+ });
+
+ getOffset(): Pixel;
+ setOffset(offset: Pixel): void;
+ hideRuler(): void;
+ showRuler(): void;
+ hideDirection(): void;
+ showDirection(): void;
+ hideLocation(): void;
+ showLocation(): void;
+ doLocation(): void;
+ getLocation(): { lng: number, lat: number };
+ show(): void;
+ hide(): void;
+ }
+
+ class InfoWindow extends EventBindable {
+ constructor(options?: {
+ isCustom?: boolean,
+ autoMove?: boolean,
+ closeWhenClickMap?: boolean,
+ content?: string | HTMLElement,
+ size?: Size,
+ offset?: Pixel,
+ position?: LngLat,
+ showShadow?: boolean
+ });
+
+ open(map: Map, pos: LngLat): void;
+ close(): void;
+ getIsOpen(): boolean;
+ setPosition(lnglat: LngLat): void;
+ getPosition(): LngLat;
+ setSize(size: Size): void;
+ getSize(): Size;
+ getContent(): string;
+ setContent(content: string|HTMLElement): void;
+ }
+
+ class AdvancedInfoWindow extends EventBindable {
+ constructor(options?: {
+ autoMove?: boolean,
+ closeWhenClickMap?: boolean,
+ content?: string|HTMLElement,
+ offset?: Pixel,
+ position?: LngLat,
+ panel?: string|HTMLElement,
+ searchRadius?: number,
+ placeSearch?: boolean,
+ driving?: boolean,
+ walking?: boolean,
+ transit?: boolean,
+ asOrigin?: boolean,
+ asDestination?: boolean
+ });
+
+ open(map: Map, pos: LngLat): void;
+ close(): void;
+ getIsOpen(): boolean;
+ setPosition(lnglat: LngLat): void;
+ getPosition(): LngLat;
+ setContent(content: string|HTMLElement): void;
+ getContent(): string;
+ }
+
+ class Geolocation extends EventBindable {
+ constructor(options: {
+ enableHighAccuracy?: boolean,
+ timeout?: number,
+ noIpLocate?: boolean,
+ maximumAge?: number,
+ convert?: boolean,
+ showButton?: boolean,
+ buttonDom?: string|HTMLElement,
+ buttonPosition?: string,
+ buttonOffset?: Pixel,
+ showMarker?: boolean,
+ markerOptions?: MarkerOptions,
+ showCircle?: boolean,
+ circleOptions?: CircleOptions,
+ panToLocation?: boolean,
+ zoomToAccuracy?: boolean,
+ useNative?: boolean
+ });
+
+ isSupported(): boolean;
+ getCurrentPosition(): void;
+ watchPosition(): number;
+ clearWatch(watchId: number): number;
+ }
+
+ interface GeolocationResult {
+ position: LngLat;
+ accuracy: number;
+ isConverted: boolean;
+ info: string;
+ }
+
+ interface GeolocationError {
+ info: string;
+ }
+
+ interface BusinessArea {
+ id: string;
+ name: string;
+ location: string;
+ }
+
+ interface Road {
+ id: string;
+ name: string;
+ distance: number;
+ location: LngLat;
+ direction: string;
+ }
+
+ interface Cross {
+ distance: number;
+ direction: string;
+ location: LngLat;
+ first_id: string;
+ first_name: string;
+ second_id: string;
+ second_name: string;
+ }
+
+ interface AddressComponent {
+ province: string;
+ city: string;
+ citycode: string;
+ district: string;
+ adcode: string;
+ township: string;
+ street: string;
+ streetNumber: string;
+ neighborhood: string;
+ neighborhoodType: string;
+ building: string;
+ buildingType: string;
+ businessAreas: BusinessArea[];
+ }
+
+ interface Geocode {
+ addressComponent: AddressComponent;
+ formattedAddress: string;
+ location: LngLat;
+ adcode: string;
+ level: string;
+ }
+
+ interface ReGeocode {
+ addressComponent: AddressComponent;
+ formattedAddress: string;
+ roads: Road[];
+ crosses: Cross[];
+ pois: ReGeocodePoi[];
+ }
+
+ interface ReGeocodePoi {
+ id: string;
+ name: string;
+ type: string;
+ tel: string;
+ distance: number;
+ direction: string;
+ address: string;
+ location: LngLat;
+ businessArea: string;
+ }
+
+ interface GeocodeResult {
+ info: string;
+ geocodes: LngLat[];
+ resultNum: number;
+ }
+
+ interface ReGeocodeResult {
+ info: string;
+ regeocode: ReGeocode;
+ }
+
+ class Geocoder {
+ constructor(opts?: {
+ city?: string,
+ radius?: number,
+ batch?: boolean,
+ extensions?: string
+ });
+
+ getLocation(address: string, callback?: (status?: string, result?: string | GeocodeResult) => void): void;
+
+ setCity(city: string): void;
+
+ getAddress(location: LngLat|LngLat[], callback: (status?: string, result?: string | ReGeocodeResult) => void): void;
+ }
+
+ /**
+ * 坐标转换结果
+ */
+ interface ConvertorResult {
+ info: string;
+ locations: LngLat[];
+ }
+
+ /**
+ * 坐标转换
+ */
+ function convertFrom(lnglat: LngLat | LngLat[] | [number, number], type: string, result: (status: string, result: ConvertorResult) => void): void;
+
+ interface Poi {
+ id: string;
+ name: string;
+ type: string;
+ location: LngLat;
+ address: string;
+ distance: number;
+ tel: string;
+
+ website: string;
+ pcode: string;
+ citycode: string;
+ adcode: string;
+ postcode: string;
+ pname: string;
+ cityname: string;
+ adname: string;
+ email: string;
+ entr_location: LngLat;
+ exit_location: LngLat;
+ groupbuy: boolean;
+ discount: boolean;
+ }
+
+ interface CitySearchResult {
+ city: string;
+ bounds: Bounds;
+ }
+
+ class CitySearch extends EventBindable {
+ getLocalCity(callback: (status: string, result: string | CitySearchResult) => void): void;
+ getCityByIp(ip: string, callback: (status: string, result: string | CitySearchResult) => void): void;
+ }
+
+ enum DrivingPolicy {
+ LEAST_TIME,
+ LEAST_FEE,
+ LEAST_DISTANCE,
+ REAL_TRAFFIC
+ }
+
+ interface ViaCity {
+ name: string;
+ citycode: string;
+ adcode: string;
+ districts: District[];
+ }
+
+ interface District {
+ name: string;
+ adcode: string;
+ }
+
+ interface TMC {
+ lcode: string;
+ distance: number;
+ status: string;
+ }
+
+ interface DriveStep {
+ start_location: LngLat;
+ end_location: LngLat;
+ instruction: string;
+ action: string;
+ assist_action: string;
+ orientation: string;
+ road: string;
+ distance: number;
+ tolls: number;
+ tolls_distance: number;
+ toll_road: string;
+ time: number;
+ path: LngLat[];
+ cities?: ViaCity[];
+ tmcs?: TMC[];
+ }
+
+ interface DriveRoute {
+ distance: number;
+ time: number;
+ policy: string;
+ tolls: number;
+ tolls_distance: number;
+ steps: DriveStep[];
+ }
+
+ interface DrivingResult {
+ info: string;
+ origin: LngLat;
+ destination: LngLat|Poi;
+ start: Poi;
+ waypoints: Poi;
+ taxi_cost: number;
+ routes: DriveRoute[];
+ }
+
+ class Driving extends EventBindable {
+ constructor(options?: {
+ policy?: DrivingPolicy,
+ extensions?: string,
+ map?: Map,
+ panel?: string|HTMLElement,
+ hideMarkers?: boolean,
+ showTraffic?: boolean
+ });
+
+ search(origin: LngLat, destination: LngLat, opts?: {
+ waypoints: LngLat[]
+ }, callback?: (status: string, result: string|DrivingResult) => void): void;
+
+ search(point: Array<{
+ keyword: string,
+ city: string
+ }>, callback: (status: string, result: string|DrivingResult) => void): void;
+
+ setPolicy(policy: DrivingPolicy): void;
+ setAvoidPolygons(path: LngLat[][]): void;
+ setAvoidRoad(road: string): void;
+ clearAvoidRoad(): void;
+ clearAvoidPolygons(): void;
+ getAvlidPolygons(): LngLat[][];
+ getAvoidRoad(): string;
+ clear(): void;
+ searchOnAMAP(obj: {
+ origin?: LngLat,
+ originName?: string,
+ destination?: LngLat,
+ destinationName?: string
+ }): void;
+ }
+
+ // 天气插件
+
+ interface WeatherLiveResult {
+ info: string;
+ province: string;
+ city: string;
+ adcode: string;
+ weather: string;
+ temperature: number;
+ windDirection: string;
+ windPower: number;
+ humidity: string;
+ reportTime: string;
+ }
+
+ interface Forecast {
+ date: string;
+ week: string;
+ dayWeather: string;
+ nightWeather: string;
+ dayTemp: number;
+ nightTemp: number;
+ dayWindDir: string;
+ nightWindDir: string;
+ dayWindPower: string;
+ nightWindPower: string;
+ }
+
+ interface WeatherForecastResult {
+ info: string;
+ province: string;
+ city: string;
+ adcode: string;
+ reportTime: string;
+ forecasts: Forecast[];
+ }
+
+ class Weather {
+ /**
+ * 查询实时天气信息
+ * @param district 支持城市名称/区域编码(如:“杭州市”/“330100”)
+ * @param callback 当请求成功时ErrorStatus为null,当请求不成功时ErrorStatus为Obj
+ */
+ getLive(district: string, callback: (errorStatus: any, result: WeatherLiveResult) => void): void;
+
+ /**
+ * 查询四天预报天气,包括查询当天天气信息
+ * @param district 支持城市名称/区域编码(如:“杭州市”/“330100”)
+ * @param callback 当请求成功时ErrorStatus为null,当请求不成功时ErrorStatus为Obj
+ */
+ getForecast(district: string, callback: (errorStatus: any, result: WeatherForecastResult) => void): void;
+ }
+
+ interface Tip {
+ name: string;
+ district: string;
+ adcode: string;
+ }
+
+ interface AutocompleteResult {
+ info: string;
+ count: number;
+ tips: Tip[];
+ }
+
+ class Autocomplete {
+ constructor(opts: {
+ type?: string,
+ city?: string,
+ datatype?: string,
+ citylimit?: boolean,
+ input?: string
+ });
+
+ search(keyword: string, callback: (status: string, result: string | AutocompleteResult) => void): void;
+ }
+
+ interface SelectChangeEvent {
+ type: string;
+ id: string;
+ marker: Marker;
+ listElement: HTMLLIElement;
+ data: Poi;
+ }
+
+ interface PoiList {
+ pois: Poi[];
+ pageIndex: number;
+ pageSize: number;
+ count: number;
+ }
+
+ interface CityInfo {
+ name: string;
+ citycode: string;
+ adcode: string;
+ count: number;
+ }
+
+ interface SearchResult {
+ info: string;
+ poiList: PoiList;
+ keywordList: string[];
+ cityList: CityInfo[];
+ }
+
+ interface Photo {
+ title: string;
+ url: string;
+ }
+
+ interface Content {
+ id: string;
+ name: string;
+ }
+
+ interface Discount {
+ title: string;
+ detail: string;
+ start_time: string;
+ end_time: string;
+ sold_num: string;
+ photos: Photo[];
+ url: string;
+ provider: string;
+ }
+
+ interface Groupbuy {
+ title: string;
+ type_code: string;
+ type: string;
+ detail: string;
+ stime: string;
+ etime: string;
+ count: number;
+ sold_num: number;
+ original_price: number;
+ groupbuy_price: number;
+ discount: number;
+ ticket_address: string;
+ ticket_tel: string;
+ photos: Photo[];
+ url: string;
+ provider: string;
+ }
+
+ class PlaceSearch {
+ constructor(opts: {
+ city?: string,
+ citylimit?: boolean,
+ children?: number,
+ type?: string,
+ lang?: string,
+ pageSize?: number,
+ pageIndex?: number,
+ extensions?: string,
+ map?: Map,
+ panel?: string|HTMLElement,
+ showCover?: boolean,
+ renderStyle?: string,
+ autoFitView?: boolean
+ });
+
+ search(keyword: string, callback: (status: string, result: string | SearchResult) => void): void;
+ searchNearBy(keyword: string, center: LngLat, radius: number, callback: (status: string, result: string|SearchResult) => void): void;
+ searchInBounds(keyword: string, bounds: Bounds|Polygon, callback: (status: string, result: string|SearchResult) => void): void;
+ getDetails(POIID: string, callback: (status: string, result: string|SearchResult) => void): void;
+ setType(type: string): void;
+ setCityLimit(p: boolean): void;
+ setPageIndex(pageIndex: number): void;
+ setPageSize(setPageSize: number): void;
+ setCity(city: string): void;
+ setLang(lang: string): string;
+ getLang(): string;
+ clear(): void;
+ poiOnAMAP(obj: any): void;
+ detailOnAMAP(obj: any): void;
+ }
+
+ interface DistrictSearchOptions {
+ level: string;
+ showbiz?: boolean;
+ extensions?: string;
+ subdistrict?: number;
+ }
+
+ interface DistrictSearchResult {
+ info: string;
+ districtList: District[];
+ }
+
+ interface District {
+ name: string;
+ center: LngLat;
+ citycode: string;
+ adcode: string;
+ level: string;
+ boundaries: LngLat[];
+ districtList: District[];
+ }
+
+ class DistrictSearch {
+ constructor(opts: DistrictSearchOptions);
+
+ search(keywords: string, callback?: (status: string, result: string| DistrictSearchResult) => void, opts?: DistrictSearchOptions): void;
+ setLevel(level: string): void;
+ setSubdistrict(district: number): void;
+ }
+ }
diff --git a/types/amap-js-sdk/tsconfig.json b/types/amap-js-sdk/tsconfig.json
new file mode 100644
index 0000000000..ba4581a859
--- /dev/null
+++ b/types/amap-js-sdk/tsconfig.json
@@ -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",
+ "amap-js-sdk-tests.ts"
+ ]
+}
diff --git a/types/amap-js-sdk/tslint.json b/types/amap-js-sdk/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/amap-js-sdk/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/amplitude-js/amplitude-js-tests.ts b/types/amplitude-js/amplitude-js-tests.ts
index c5ffbe9898..0b6bb49751 100644
--- a/types/amplitude-js/amplitude-js-tests.ts
+++ b/types/amplitude-js/amplitude-js-tests.ts
@@ -1,5 +1,7 @@
// Tests for Amplitude SDK TypeScript definitions
+import amplitude = require('amplitude-js');
+
module Amplitude.Tests {
function all() {
diff --git a/types/amplitude-js/index.d.ts b/types/amplitude-js/index.d.ts
index 1cdb843589..10465f6647 100644
--- a/types/amplitude-js/index.d.ts
+++ b/types/amplitude-js/index.d.ts
@@ -4,143 +4,142 @@
// Dan Manastireanu
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare module amplitude {
+export as namespace amplitude;
- type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void;
- type LogReturn = number | void;
+type Callback = (responseCode: number, responseBody: string, details?: { reason: string; }) => void;
+type LogReturn = number | void;
- interface Config {
- apiEndpoint?: string;
- batchEvents?: boolean;
- cookieExpiration?: number;
- cookieName?: string;
- userId?: string;
- deviceId?: string;
- deviceIdFromUrlParam?: boolean;
- domain?: string;
- eventUploadPeriodMillis?: number;
- eventUploadThreshold?: number;
- forceHttps?: boolean;
- includeGclid?: boolean;
- includeReferrer?: boolean;
- includeUtm?: boolean;
- language?: string;
- logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO';
- optOut?: boolean;
- platform?: string;
- saveEvents?: boolean;
- savedMaxCount?: number;
- saveParamsReferrerOncePerSession?: boolean;
- sessionTimeout?: number;
- trackingOptions?: {
- city?: boolean;
- country?: boolean;
- device_model?: boolean;
- dma?: boolean;
- ip_address?: boolean;
- language?: boolean;
- os_name?: boolean;
- os_version?: boolean;
- platform?: boolean;
- region?: boolean;
- version_name?: boolean;
- },
- unsentKey?: string;
- unsentIdentifyKey?: string;
- uploadBatchSize?: number;
- }
-
- export class Identify {
- set(key: string, value: any): Identify;
- setOnce(key: string, value: any): Identify;
- add(key: string, value: number | string): Identify;
- append(key: string, value: any): Identify;
- prepend(key: string, value: any): Identify;
-
- unset(key: string): Identify;
- }
-
- export class Revenue {
-
- setProductId(productId: string): Revenue;
- setQuantity(quantity: number): Revenue;
- setPrice(price: number): Revenue;
- setRevenueType(revenueType: string): Revenue;
- setEventProperties(eventProperties: any): Revenue;
- }
-
- export class AmplitudeClient {
-
- constructor(instanceName?: string);
-
- options: Config;
-
- init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void;
-
- setVersionName(versionName: string): void;
-
- isNewSession(): boolean;
- setSessionId(sessionId: number): void;
- getSessionId(): number;
-
- setDomain(domain: string): void;
- setUserId(userId: string): void;
-
- setDeviceId(id: string): void;
- regenerateDeviceId(): void;
-
- identify(identify_obj: Identify, opt_callback?: Callback): void;
-
- setUserProperties(properties: any): void;
- setGlobalUserProperties(properties: any): void;
- clearUserProperties(): void;
-
- setOptOut(enable: boolean): void;
-
- setGroup(groupType: string, groupName: string | string[]): void;
-
- logEvent(event: string, data?: any, callback?: Callback): LogReturn;
- logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
- logRevenueV2(revenue_obj: Revenue): LogReturn;
- logRevenue(pric: number, quantity: number, product: string): LogReturn;
- logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
- }
-
- // Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied)
-
- export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void;
-
- export function setVersionName(version: string): void;
-
- export function isNewSession(): boolean;
- export function getSessionId(): number;
-
- export function setDomain(domain: string): void;
-
- export function setUserId(userId: string): void;
-
- export function setDeviceId(id: string): void;
- export function regenerateDeviceId(): void;
-
- export function identify(identify: Identify, callback?: Callback): void;
-
- export function setUserProperties(properties: any): void;
- export function setGlobalUserProperties(properties: any): void;
- export function clearUserProperties(): void;
-
- export function setOptOut(optOut: boolean): void;
-
- export function setGroup(groupType: string, groupName: string | string[]): void;
-
- export function logEvent(event: string, data?: any, callback?: Callback): LogReturn;
- export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
- export function logRevenueV2(revenue_obj: Revenue): LogReturn;
- export function logRevenue(pric: number, quantity: number, product: string): LogReturn;
- export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
-
-
-
- export function getInstance(instanceName?: string): AmplitudeClient;
- export const __VERSION__: string;
- export var options: Config;
+interface Config {
+ apiEndpoint?: string;
+ batchEvents?: boolean;
+ cookieExpiration?: number;
+ cookieName?: string;
+ userId?: string;
+ deviceId?: string;
+ deviceIdFromUrlParam?: boolean;
+ domain?: string;
+ eventUploadPeriodMillis?: number;
+ eventUploadThreshold?: number;
+ forceHttps?: boolean;
+ includeGclid?: boolean;
+ includeReferrer?: boolean;
+ includeUtm?: boolean;
+ language?: string;
+ logLevel?: 'DISABLE' | 'ERROR' | 'WARN' | 'INFO';
+ optOut?: boolean;
+ platform?: string;
+ saveEvents?: boolean;
+ savedMaxCount?: number;
+ saveParamsReferrerOncePerSession?: boolean;
+ sessionTimeout?: number;
+ trackingOptions?: {
+ city?: boolean;
+ country?: boolean;
+ device_model?: boolean;
+ dma?: boolean;
+ ip_address?: boolean;
+ language?: boolean;
+ os_name?: boolean;
+ os_version?: boolean;
+ platform?: boolean;
+ region?: boolean;
+ version_name?: boolean;
+ },
+ unsentKey?: string;
+ unsentIdentifyKey?: string;
+ uploadBatchSize?: number;
}
+
+export class Identify {
+ set(key: string, value: any): Identify;
+ setOnce(key: string, value: any): Identify;
+ add(key: string, value: number | string): Identify;
+ append(key: string, value: any): Identify;
+ prepend(key: string, value: any): Identify;
+
+ unset(key: string): Identify;
+}
+
+export class Revenue {
+
+ setProductId(productId: string): Revenue;
+ setQuantity(quantity: number): Revenue;
+ setPrice(price: number): Revenue;
+ setRevenueType(revenueType: string): Revenue;
+ setEventProperties(eventProperties: any): Revenue;
+}
+
+export class AmplitudeClient {
+
+ constructor(instanceName?: string);
+
+ options: Config;
+
+ init(apiKey: string, userId?: string, config?: Config, callback?: (client: AmplitudeClient) => void): void;
+
+ setVersionName(versionName: string): void;
+
+ isNewSession(): boolean;
+ setSessionId(sessionId: number): void;
+ getSessionId(): number;
+
+ setDomain(domain: string): void;
+ setUserId(userId: string): void;
+
+ setDeviceId(id: string): void;
+ regenerateDeviceId(): void;
+
+ identify(identify_obj: Identify, opt_callback?: Callback): void;
+
+ setUserProperties(properties: any): void;
+ setGlobalUserProperties(properties: any): void;
+ clearUserProperties(): void;
+
+ setOptOut(enable: boolean): void;
+
+ setGroup(groupType: string, groupName: string | string[]): void;
+
+ logEvent(event: string, data?: any, callback?: Callback): LogReturn;
+ logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
+ logRevenueV2(revenue_obj: Revenue): LogReturn;
+ logRevenue(pric: number, quantity: number, product: string): LogReturn;
+ logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
+}
+
+// Proxy methods that get executed on the default AmplitudeClient instance (not all client methods are proxied)
+
+export function init(apiKey: string, userId?: string, options?: Config, callback?: (client: AmplitudeClient) => void): void;
+
+export function setVersionName(version: string): void;
+
+export function isNewSession(): boolean;
+export function getSessionId(): number;
+
+export function setDomain(domain: string): void;
+
+export function setUserId(userId: string): void;
+
+export function setDeviceId(id: string): void;
+export function regenerateDeviceId(): void;
+
+export function identify(identify: Identify, callback?: Callback): void;
+
+export function setUserProperties(properties: any): void;
+export function setGlobalUserProperties(properties: any): void;
+export function clearUserProperties(): void;
+
+export function setOptOut(optOut: boolean): void;
+
+export function setGroup(groupType: string, groupName: string | string[]): void;
+
+export function logEvent(event: string, data?: any, callback?: Callback): LogReturn;
+export function logEventWithGroups(event: string, data?: any, groups?: any, callback?: Callback): LogReturn;
+export function logRevenueV2(revenue_obj: Revenue): LogReturn;
+export function logRevenue(pric: number, quantity: number, product: string): LogReturn;
+export function logEventWithTimestamp(event: string, data?: any, timestamp?: number, callback?: Callback): LogReturn;
+
+
+
+export function getInstance(instanceName?: string): AmplitudeClient;
+export const __VERSION__: string;
+export var options: Config;
diff --git a/types/analytics-node/analytics-node-tests.ts b/types/analytics-node/analytics-node-tests.ts
index 6740aaccff..a7dc5336ec 100644
--- a/types/analytics-node/analytics-node-tests.ts
+++ b/types/analytics-node/analytics-node-tests.ts
@@ -1,10 +1,10 @@
import Analytics = require("analytics-node");
-var analytics: Analytics;
+let analytics: Analytics;
function testConfig(): void {
analytics = new Analytics('YOUR_WRITE_KEY', {
flushAt: 20,
- flushAfter: 10000,
+ flushInterval: 10000,
host: "http://example.com",
enable: true
});
@@ -33,7 +33,7 @@ function testIdentify(): void {
if (err) {
console.error(err);
} else {
- data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`))
+ data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`));
}
});
}
@@ -59,7 +59,7 @@ function testTrack(): void {
if (err) {
console.error(err);
} else {
- data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`))
+ data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`));
}
});
}
@@ -91,20 +91,20 @@ function testPage(): void {
if (err) {
console.error(err);
} else {
- data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`))
+ data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`));
}
});
}
function testAlias(): void {
// the anonymous user does actions ...
- analytics.track({ userId: 'anonymous_user', event: 'Anonymous Event' })
+ analytics.track({ userId: 'anonymous_user', event: 'Anonymous Event' });
// the anonymous user signs up and is aliased
- analytics.alias({ previousId: 'anonymous_user', userId: 'identified@gmail.com' })
+ analytics.alias({ previousId: 'anonymous_user', userId: 'identified@gmail.com' });
// the identified user is identified
- analytics.identify({ userId: 'identified@gmail.com', traits: { plan: 'Free' } })
+ analytics.identify({ userId: 'identified@gmail.com', traits: { plan: 'Free' } });
// the identified user does actions ...
- analytics.track({ userId: 'identified@gmail.com', event: 'Identified Action' })
+ analytics.track({ userId: 'identified@gmail.com', event: 'Identified Action' });
}
function testGroup(): void {
@@ -128,35 +128,41 @@ function testGroup(): void {
if (err) {
console.error(err);
} else {
- data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`))
+ data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`));
}
});
}
function testIntegrations(): void {
analytics.track({
- event: 'Upgraded Membershipt',
+ event: 'Upgraded Membership',
userId: '97234974',
integrations: {
- 'All': false,
- 'Vero': true,
- 'Google Analytics': false
+ All: false,
+ Vero: true,
+ 'Google Analytics': false,
+ AppsFlyer: {
+ appsflyer_id: 'example-id'
+ }
}
});
analytics.track({
- event: 'Upgraded Membershipt',
+ event: 'Upgraded Membership',
userId: '97234974',
integrations: {
- 'All': false,
- 'Vero': true,
- 'Google Analytics': false
+ All: false,
+ Vero: true,
+ 'Google Analytics': false,
+ AppsFlyer: {
+ appsflyer_id: 'example-id'
+ }
}
}, (err, data) => {
if (err) {
console.error(err);
} else {
- data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`))
+ data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`));
}
});
}
@@ -164,8 +170,10 @@ function testIntegrations(): void {
function testFlush(): void {
analytics.flush();
analytics.flush((err, batch) => {
- if (err) { alert("Oh nos!"); }
- else { console.log(batch.batch[0].type); }
+ if (err) {
+ alert("Oh nos!");
+ } else {
+ console.log(batch.batch[0].type);
+ }
});
}
-
diff --git a/types/analytics-node/index.d.ts b/types/analytics-node/index.d.ts
index cc9e5386e2..168e0f17ea 100644
--- a/types/analytics-node/index.d.ts
+++ b/types/analytics-node/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Segment's analytics.js for Node.js
+// Type definitions for analytics-node 3.1
// Project: https://segment.com/docs/libraries/node/
// Definitions by: Andrew Fong
// Thomas Thiebaud
@@ -19,7 +19,7 @@ declare namespace AnalyticsNode {
_metadata: {
nodeVersion: string;
[key: string]: any;
- },
+ };
timestamp?: Date;
messageId?: string;
anonymousId?: string | number;
@@ -27,19 +27,21 @@ declare namespace AnalyticsNode {
}
interface Data {
- batch: Message[],
+ batch: Message[];
timestamp: Date;
sentAt: Date;
}
interface Integrations {
- [index: string]: boolean;
+ [integration_name: string]: IntegrationValue;
}
- export class Analytics {
+ type IntegrationValue = boolean | { [integration_key: string]: any };
+
+ class Analytics {
constructor(writeKey: string, opts?: {
flushAt?: number,
- flushAfter?: number,
+ flushInterval?: number,
host?: string,
enable?: boolean
});
@@ -49,9 +51,9 @@ declare namespace AnalyticsNode {
identify(message: {
userId?: string | number;
anonymousId?: string | number;
- traits?: Object;
+ traits?: any;
timestamp?: Date;
- context?: Object;
+ context?: any;
integrations?: Integrations;
}, callback?: (err: Error, data: Data) => void): Analytics;
@@ -60,9 +62,9 @@ declare namespace AnalyticsNode {
userId?: string | number;
anonymousId?: string | number;
event: string;
- properties?: Object;
+ properties?: any;
timestamp?: Date;
- context?: Object;
+ context?: any;
integrations?: Integrations;
}, callback?: (err: Error, data: Data) => void): Analytics;
@@ -73,9 +75,9 @@ declare namespace AnalyticsNode {
anonymousId?: string | number;
category?: string;
name?: string;
- properties?: Object;
+ properties?: any;
timestamp?: Date;
- context?: Object;
+ context?: any;
integrations?: Integrations;
}, callback?: (err: Error, data: Data) => void): Analytics;
@@ -93,8 +95,8 @@ declare namespace AnalyticsNode {
userId?: string | number;
anonymousId?: string | number;
groupId: string | number;
- traits?: Object;
- context?: Object;
+ traits?: any;
+ context?: any;
timestamp?: Date;
integrations?: Integrations;
}, callback?: (err: Error, data: Data) => void): Analytics;
diff --git a/types/analytics-node/tslint.json b/types/analytics-node/tslint.json
index a41bf5d19a..3db14f85ea 100644
--- a/types/analytics-node/tslint.json
+++ b/types/analytics-node/tslint.json
@@ -1,79 +1 @@
-{
- "extends": "dtslint/dt.json",
- "rules": {
- "adjacent-overload-signatures": false,
- "array-type": false,
- "arrow-return-shorthand": false,
- "ban-types": false,
- "callable-types": false,
- "comment-format": false,
- "dt-header": false,
- "eofline": false,
- "export-just-namespace": false,
- "import-spacing": false,
- "interface-name": false,
- "interface-over-type-literal": false,
- "jsdoc-format": false,
- "max-line-length": false,
- "member-access": false,
- "new-parens": false,
- "no-any-union": false,
- "no-boolean-literal-compare": false,
- "no-conditional-assignment": false,
- "no-consecutive-blank-lines": false,
- "no-construct": false,
- "no-declare-current-package": false,
- "no-duplicate-imports": false,
- "no-duplicate-variable": false,
- "no-empty-interface": false,
- "no-for-in-array": false,
- "no-inferrable-types": false,
- "no-internal-module": false,
- "no-irregular-whitespace": false,
- "no-mergeable-namespace": false,
- "no-misused-new": false,
- "no-namespace": false,
- "no-object-literal-type-assertion": false,
- "no-padding": false,
- "no-redundant-jsdoc": false,
- "no-redundant-jsdoc-2": false,
- "no-redundant-undefined": false,
- "no-reference-import": false,
- "no-relative-import-in-test": false,
- "no-self-import": false,
- "no-single-declare-module": false,
- "no-string-throw": false,
- "no-unnecessary-callback-wrapper": false,
- "no-unnecessary-class": false,
- "no-unnecessary-generics": false,
- "no-unnecessary-qualifier": false,
- "no-unnecessary-type-assertion": false,
- "no-useless-files": false,
- "no-var-keyword": false,
- "no-var-requires": false,
- "no-void-expression": false,
- "no-trailing-whitespace": false,
- "object-literal-key-quotes": false,
- "object-literal-shorthand": false,
- "one-line": false,
- "one-variable-per-declaration": false,
- "only-arrow-functions": false,
- "prefer-conditional-expression": false,
- "prefer-const": false,
- "prefer-declare-function": false,
- "prefer-for-of": false,
- "prefer-method-signature": false,
- "prefer-template": false,
- "radix": false,
- "semicolon": false,
- "space-before-function-paren": false,
- "space-within-parens": false,
- "strict-export-declare-modifiers": false,
- "trim-file": false,
- "triple-equals": false,
- "typedef-whitespace": false,
- "unified-signatures": false,
- "void-return": false,
- "whitespace": false
- }
-}
+{ "extends": "dtslint/dt.json" }
diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts
index db74c97d10..19c6dcc9e5 100644
--- a/types/angular-material/index.d.ts
+++ b/types/angular-material/index.d.ts
@@ -153,6 +153,10 @@ declare module 'angular' {
defaultFontSet(name: string): IIconProvider;
}
+ interface IInkRippleProvider {
+ disableInkRipple(): void;
+ }
+
type IMedia = (media: string) => boolean;
interface ISidenavObject {
@@ -340,6 +344,7 @@ declare module 'angular' {
}
interface IMenuService {
+ close(): void;
hide(response?: any, options?: any): IPromise;
open(event?: MouseEvent): void;
}
diff --git a/types/angular-resource/angular-resource-tests.ts b/types/angular-resource/angular-resource-tests.ts
index c35f27a98d..f7b8db579c 100644
--- a/types/angular-resource/angular-resource-tests.ts
+++ b/types/angular-resource/angular-resource-tests.ts
@@ -90,6 +90,7 @@ angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactorySe
responseError() {}
};
actionDescriptor.cancellable = true;
+ actionDescriptor.hasBody = true;
});
///////////////////////////////////////
diff --git a/types/angular-resource/index.d.ts b/types/angular-resource/index.d.ts
index 1ebd198b82..c298001533 100644
--- a/types/angular-resource/index.d.ts
+++ b/types/angular-resource/index.d.ts
@@ -88,6 +88,7 @@ declare module 'angular' {
withCredentials?: boolean;
responseType?: string;
interceptor?: IResourceInterceptor;
+ hasBody?: boolean;
}
// Allow specify more resource methods
diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts
index 44f8539af2..b83a41a6df 100644
--- a/types/angular/angular-tests.ts
+++ b/types/angular/angular-tests.ts
@@ -1502,16 +1502,28 @@ interface MyScope extends ng.IScope {
foo: string;
}
-const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn = (
- templateElement: JQLite,
- templateAttributes: ng.IAttributes,
- transclude: ng.ITranscludeFunction
- ): ng.IDirectiveLinkFn => {
- return (
- scope: MyScope,
- instanceElement: JQLite,
- instanceAttributes: ng.IAttributes
- ) => {
- return null;
- };
-};
+interface MyElement extends JQLite {
+ foo: string;
+}
+
+interface MyAttributes extends ng.IAttributes {
+ foo: string;
+}
+interface MyController extends ng.INgModelController {
+ foo: string;
+}
+
+angular.module('WithGenerics', [])
+ .directive('directiveUsingGenerics', () => {
+ return {
+ restrict: 'E',
+ link(scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) {
+ scope['name'] = 'Jeff';
+ }
+ };
+ })
+ .directive('linkFunctionUsingGenerics', () => {
+ return (scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) => {
+ scope['name'] = 'Jeff';
+ };
+ });
diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts
index fe90fa15b8..4a8b26fba9 100644
--- a/types/angular/index.d.ts
+++ b/types/angular/index.d.ts
@@ -240,8 +240,9 @@ declare namespace angular {
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
* @param directiveFactory An injectable directive factory function.
*/
- directive(name: string, directiveFactory: Injectable>): IModule;
- directive(object: {[directiveName: string]: Injectable>}): IModule;
+ directive(name: string, directiveFactory: Injectable>): IModule;
+ directive(object: {[directiveName: string]: Injectable>}): IModule;
+
/**
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
*
@@ -1346,8 +1347,8 @@ declare namespace angular {
}
interface ICompileProvider extends IServiceProvider {
- directive(name: string, directiveFactory: Injectable>): ICompileProvider;
- directive(object: {[directiveName: string]: Injectable>}): ICompileProvider;
+ directive(name: string, directiveFactory: Injectable>): ICompileProvider;
+ directive(object: {[directiveName: string]: Injectable>}): ICompileProvider;
component(name: string, options: IComponentOptions): ICompileProvider;
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
@@ -2066,29 +2067,31 @@ declare namespace angular {
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
- interface IDirectiveFactory {
- (...args: any[]): IDirective | IDirectiveLinkFn;
+ type IDirectiveController = IController | IController[] | {[key: string]: IController};
+
+ interface IDirectiveFactory {
+ (...args: any[]): IDirective | IDirectiveLinkFn;
}
- interface IDirectiveLinkFn {
+ interface IDirectiveLinkFn {
(
scope: TScope,
- instanceElement: JQLite,
- instanceAttributes: IAttributes,
- controller?: IController | IController[] | {[key: string]: IController},
+ instanceElement: TElement,
+ instanceAttributes: TAttributes,
+ controller?: TController,
transclude?: ITranscludeFunction
): void;
}
- interface IDirectivePrePost {
- pre?: IDirectiveLinkFn;
- post?: IDirectiveLinkFn;
+ interface IDirectivePrePost {
+ pre?: IDirectiveLinkFn;
+ post?: IDirectiveLinkFn;
}
- interface IDirectiveCompileFn {
+ interface IDirectiveCompileFn {
(
- templateElement: JQLite,
- templateAttributes: IAttributes,
+ templateElement: TElement,
+ templateAttributes: TAttributes,
/**
* @deprecated
* Note: The transclude function that is passed to the compile function is deprecated,
@@ -2096,11 +2099,11 @@ declare namespace angular {
* that is passed to the link function instead.
*/
transclude: ITranscludeFunction
- ): void | IDirectiveLinkFn | IDirectivePrePost;
+ ): void | IDirectiveLinkFn | IDirectivePrePost;
}
- interface IDirective {
- compile?: IDirectiveCompileFn;
+ interface IDirective {
+ compile?: IDirectiveCompileFn;
controller?: string | Injectable;
controllerAs?: string;
/**
@@ -2109,7 +2112,7 @@ declare namespace angular {
* relies upon bindings inside a $onInit method on the controller, instead.
*/
bindToController?: boolean | {[boundProperty: string]: string};
- link?: IDirectiveLinkFn | IDirectivePrePost;
+ link?: IDirectiveLinkFn | IDirectivePrePost;
multiElement?: boolean;
priority?: number;
/**
@@ -2119,9 +2122,9 @@ declare namespace angular {
require?: string | string[] | {[controller: string]: string};
restrict?: string;
scope?: boolean | {[boundProperty: string]: string};
- template?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
+ template?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
templateNamespace?: string;
- templateUrl?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
+ templateUrl?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
terminal?: boolean;
transclude?: boolean | 'element' | {[slot: string]: string};
}
diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts
index a9da89cf65..ac4f8ec10c 100644
--- a/types/angular/jqlite.d.ts
+++ b/types/angular/jqlite.d.ts
@@ -774,6 +774,7 @@ interface BaseJQueryEventObject extends Event {
pageY: number;
/**
* For key or mouse events, this property indicates the specific key or button that was pressed.
+ * @deprecated Use `key` for KeyEvents or `button` for MouseEvents instead.
* @see {@link https://api.jquery.com/event.which/}
*/
which: number;
@@ -804,9 +805,12 @@ interface JQueryMouseEventObject extends JQueryInputEventObject {
}
interface JQueryKeyEventObject extends JQueryInputEventObject {
- char: any;
+ /** @deprecated */
+ char: string;
+ /** @deprecated */
charCode: number;
- key: any;
+ key: string;
+ /** @deprecated */
keyCode: number;
}
diff --git a/types/ansi-colors/ansi-colors-tests.ts b/types/ansi-colors/ansi-colors-tests.ts
index 9a9afc43f4..c267e879eb 100644
--- a/types/ansi-colors/ansi-colors-tests.ts
+++ b/types/ansi-colors/ansi-colors-tests.ts
@@ -1,30 +1,35 @@
-import * as colors from 'ansi-colors';
+import colors = require('ansi-colors');
-let s: string;
+colors.red('This is a red string!'); // $ExpectType string
+colors.green('This is a red string!'); // $ExpectType string
+colors.cyan('This is a cyan string!'); // $ExpectType string
+colors.yellow('This is a yellow string!'); // $ExpectType string
-s = colors.bgblack("hello");
-s = colors.bgblue("hello");
-s = colors.bgcyan("hello");
-s = colors.bggreen("hello");
-s = colors.bgmagenta("hello");
-s = colors.bgred("hello");
-s = colors.bgwhite("hello");
-s = colors.bgyellow("hello");
-s = colors.black("hello");
-s = colors.blue("hello");
-s = colors.bold("hello");
-s = colors.cyan("hello");
-s = colors.dim("hello");
-s = colors.gray("hello");
-s = colors.green("hello");
-s = colors.grey("hello");
-s = colors.hidden("hello");
-s = colors.inverse("hello");
-s = colors.italic("hello");
-s = colors.magenta("hello");
-s = colors.red("hello");
-s = colors.reset("hello");
-s = colors.strikethrough("hello");
-s = colors.underline("hello");
-s = colors.white("hello");
-s = colors.yellow("hello");
+colors.bold.red('this is a bold red message'); // $ExpectType string
+colors.bold.yellow.italic('this is a bold yellow italicized message'); // $ExpectType string
+colors.green.bold.underline('this is a bold green underlined message'); // $ExpectType string
+
+colors.yellow(`foo ${colors.red.bold('red')} bar ${colors.cyan('cyan')} baz`); // $ExpectType string
+colors.bold(`foo ${colors.red.dim('bar')} baz`); // $ExpectType string
+
+colors.enabled = false;
+colors.visible = false;
+
+colors.hasAnsi(colors.blue('foo')); // $ExpectType boolean
+colors.hasColor(colors.blue('foo')); // $ExpectType boolean
+
+colors.unstyle(colors.blue.bold('foo bar baz')); // $ExpectType string
+colors.stripColor(colors.blue.bold('foo bar baz')); // $ExpectType string
+
+colors.none('foo'); // $ExpectType string
+colors.clear('foo'); // $ExpectType string
+colors.noop('foo'); // $ExpectType string
+
+colors.define('reset', [0, 0], 'modifier');
+
+colors.symbols.ballotCross; // $ExpectType string | undefined
+colors.symbols.windows.ballotCross; // $ExpectError
+colors.symbols.other.ballotCross; // $ExpectType string
+colors.symbols.cross; // $ExpectType string
+colors.symbols.windows.cross; // $ExpectType string
+colors.symbols.other.cross; // $ExpectType string
diff --git a/types/ansi-colors/index.d.ts b/types/ansi-colors/index.d.ts
index 092c4c1f2b..0cf9cd0d9f 100644
--- a/types/ansi-colors/index.d.ts
+++ b/types/ansi-colors/index.d.ts
@@ -1,31 +1,111 @@
-// Type definitions for ansi-colors 1.0
+// Type definitions for ansi-colors 3.2
// Project: https://github.com/doowb/ansi-colors
// Definitions by: Rogier Schouten
+// BendingBender
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.1
-export function bgblack(s: string): string;
-export function bgblue(s: string): string;
-export function bgcyan(s: string): string;
-export function bggreen(s: string): string;
-export function bgmagenta(s: string): string;
-export function bgred(s: string): string;
-export function bgwhite(s: string): string;
-export function bgyellow(s: string): string;
-export function black(s: string): string;
-export function blue(s: string): string;
-export function bold(s: string): string;
-export function cyan(s: string): string;
-export function dim(s: string): string;
-export function gray(s: string): string;
-export function green(s: string): string;
-export function grey(s: string): string;
-export function hidden(s: string): string;
-export function inverse(s: string): string;
-export function italic(s: string): string;
-export function magenta(s: string): string;
-export function red(s: string): string;
-export function reset(s: string): string;
-export function strikethrough(s: string): string;
-export function underline(s: string): string;
-export function white(s: string): string;
-export function yellow(s: string): string;
+export = colors;
+
+declare const colors: colors.Colors;
+
+declare namespace colors {
+ type ColorFn = ((text: string) => string) & Colors;
+
+ interface Colors {
+ enabled: boolean;
+ visible: boolean;
+
+ reset: ColorFn;
+ bold: ColorFn;
+ dim: ColorFn;
+ italic: ColorFn;
+ underline: ColorFn;
+ inverse: ColorFn;
+ hidden: ColorFn;
+ strikethrough: ColorFn;
+
+ black: ColorFn;
+ red: ColorFn;
+ green: ColorFn;
+ yellow: ColorFn;
+ blue: ColorFn;
+ magenta: ColorFn;
+ cyan: ColorFn;
+ white: ColorFn;
+ gray: ColorFn;
+ grey: ColorFn;
+
+ bgBlack: ColorFn;
+ bgRed: ColorFn;
+ bgGreen: ColorFn;
+ bgYellow: ColorFn;
+ bgBlue: ColorFn;
+ bgMagenta: ColorFn;
+ bgCyan: ColorFn;
+ bgWhite: ColorFn;
+
+ blackBright: ColorFn;
+ redBright: ColorFn;
+ greenBright: ColorFn;
+ yellowBright: ColorFn;
+ blueBright: ColorFn;
+ magentaBright: ColorFn;
+ cyanBright: ColorFn;
+ whiteBright: ColorFn;
+
+ bgBlackBright: ColorFn;
+ bgRedBright: ColorFn;
+ bgGreenBright: ColorFn;
+ bgYellowBright: ColorFn;
+ bgBlueBright: ColorFn;
+ bgMagentaBright: ColorFn;
+ bgCyanBright: ColorFn;
+ bgWhiteBright: ColorFn;
+
+ hasColor(text: string): boolean;
+ hasAnsi(text: string): boolean;
+ unstyle(text: string): string;
+ stripColor(text: string): string;
+ none(text: string): string;
+ clear(text: string): string;
+ noop(text: string): string;
+
+ symbols: Symbols & {
+ windows: WindowsSymbols;
+ other: OtherPlatformsSymbols;
+ };
+
+ define(
+ name: string,
+ codes: [number, number],
+ type: 'modifier' | 'color' | 'bg' | 'bright' | 'bgBright'
+ ): void;
+ }
+
+ interface WindowsSymbols {
+ bullet: string;
+ check: string;
+ cross: string;
+ ellipsis: string;
+ heart: string;
+ info: string;
+ line: string;
+ middot: string;
+ minus: string;
+ plus: string;
+ question: string;
+ questionSmall: string;
+ pointer: string;
+ pointerSmall: string;
+ warning: string;
+ }
+
+ interface ExtendedSymbols {
+ ballotCross: string;
+ questionFull: string;
+ }
+
+ type Symbols = WindowsSymbols & Partial;
+ type OtherPlatformsSymbols = WindowsSymbols & ExtendedSymbols;
+}
diff --git a/types/ansi-colors/tsconfig.json b/types/ansi-colors/tsconfig.json
index ebd56021f9..8a0f980cbc 100644
--- a/types/ansi-colors/tsconfig.json
+++ b/types/ansi-colors/tsconfig.json
@@ -20,4 +20,4 @@
"index.d.ts",
"ansi-colors-tests.ts"
]
-}
\ No newline at end of file
+}
diff --git a/types/ansi-colors/v1/ansi-colors-tests.ts b/types/ansi-colors/v1/ansi-colors-tests.ts
new file mode 100644
index 0000000000..9a9afc43f4
--- /dev/null
+++ b/types/ansi-colors/v1/ansi-colors-tests.ts
@@ -0,0 +1,30 @@
+import * as colors from 'ansi-colors';
+
+let s: string;
+
+s = colors.bgblack("hello");
+s = colors.bgblue("hello");
+s = colors.bgcyan("hello");
+s = colors.bggreen("hello");
+s = colors.bgmagenta("hello");
+s = colors.bgred("hello");
+s = colors.bgwhite("hello");
+s = colors.bgyellow("hello");
+s = colors.black("hello");
+s = colors.blue("hello");
+s = colors.bold("hello");
+s = colors.cyan("hello");
+s = colors.dim("hello");
+s = colors.gray("hello");
+s = colors.green("hello");
+s = colors.grey("hello");
+s = colors.hidden("hello");
+s = colors.inverse("hello");
+s = colors.italic("hello");
+s = colors.magenta("hello");
+s = colors.red("hello");
+s = colors.reset("hello");
+s = colors.strikethrough("hello");
+s = colors.underline("hello");
+s = colors.white("hello");
+s = colors.yellow("hello");
diff --git a/types/ansi-colors/v1/index.d.ts b/types/ansi-colors/v1/index.d.ts
new file mode 100644
index 0000000000..092c4c1f2b
--- /dev/null
+++ b/types/ansi-colors/v1/index.d.ts
@@ -0,0 +1,31 @@
+// Type definitions for ansi-colors 1.0
+// Project: https://github.com/doowb/ansi-colors
+// Definitions by: Rogier Schouten
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+export function bgblack(s: string): string;
+export function bgblue(s: string): string;
+export function bgcyan(s: string): string;
+export function bggreen(s: string): string;
+export function bgmagenta(s: string): string;
+export function bgred(s: string): string;
+export function bgwhite(s: string): string;
+export function bgyellow(s: string): string;
+export function black(s: string): string;
+export function blue(s: string): string;
+export function bold(s: string): string;
+export function cyan(s: string): string;
+export function dim(s: string): string;
+export function gray(s: string): string;
+export function green(s: string): string;
+export function grey(s: string): string;
+export function hidden(s: string): string;
+export function inverse(s: string): string;
+export function italic(s: string): string;
+export function magenta(s: string): string;
+export function red(s: string): string;
+export function reset(s: string): string;
+export function strikethrough(s: string): string;
+export function underline(s: string): string;
+export function white(s: string): string;
+export function yellow(s: string): string;
diff --git a/types/ansi-colors/v1/tsconfig.json b/types/ansi-colors/v1/tsconfig.json
new file mode 100644
index 0000000000..8321162c90
--- /dev/null
+++ b/types/ansi-colors/v1/tsconfig.json
@@ -0,0 +1,28 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "strictFunctionTypes": true,
+ "baseUrl": "../../",
+ "typeRoots": [
+ "../../"
+ ],
+ "paths": {
+ "ansi-colors": [
+ "ansi-colors/v1"
+ ]
+ },
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "ansi-colors-tests.ts"
+ ]
+}
diff --git a/types/ansi-colors/v1/tslint.json b/types/ansi-colors/v1/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/ansi-colors/v1/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/ansi-regex/ansi-regex-tests.ts b/types/ansi-regex/ansi-regex-tests.ts
index a5787902f0..d4217e9608 100644
--- a/types/ansi-regex/ansi-regex-tests.ts
+++ b/types/ansi-regex/ansi-regex-tests.ts
@@ -9,5 +9,8 @@ ansiRegex().test('\u001B[4mcake\u001B[0m'); // $ExpectType boolean
ansiRegex().test('cake'); // $ExpectType boolean
// => false
+ansiRegex({onlyFirst: true}).test('cake'); // $ExpectType boolean
+// => false
+
'\u001B[4mcake\u001B[0m'.match(ansiRegex()); // $ExpectType RegExpMatchArray | null
// => ['\u001B[4m', '\u001B[0m']
diff --git a/types/ansi-regex/index.d.ts b/types/ansi-regex/index.d.ts
index 34890912dc..52979125f7 100644
--- a/types/ansi-regex/index.d.ts
+++ b/types/ansi-regex/index.d.ts
@@ -1,7 +1,16 @@
-// Type definitions for ansi-regex 3.0
+// Type definitions for ansi-regex 4.0
// Project: https://github.com/chalk/ansi-regex#readme
// Definitions by: Manish Vachharajani
+// Florian Keller
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare function r(): RegExp;
-export = r;
+declare namespace ansiRegex {
+ interface Options {
+ /** Match only the first ANSI escape. */
+ onlyFirst?: boolean;
+ }
+}
+
+declare function ansiRegex(options?: ansiRegex.Options): RegExp;
+
+export = ansiRegex;
diff --git a/types/arcgis-js-api/index.d.ts b/types/arcgis-js-api/index.d.ts
index 28e51384c9..4e43778473 100644
--- a/types/arcgis-js-api/index.d.ts
+++ b/types/arcgis-js-api/index.d.ts
@@ -1,48 +1,55 @@
-// Type definitions for ArcGIS API for JavaScript 4.9
+// Type definitions for ArcGIS API for JavaScript 4.10
// Project: http://js.arcgis.com
// Definitions by: Esri
// Bjorn Svensson
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
-
interface HashMap {
[index: string]: T;
}
interface IPromiseLike {
- then