Merge branch 'master' into oja/lodash-is-object-type-guard

This commit is contained in:
Oliver Joseph Ash 2019-03-10 19:42:02 +00:00
commit f0168f9ddf
1081 changed files with 37724 additions and 7879 deletions

484
.github/CODEOWNERS vendored

File diff suppressed because it is too large Load Diff

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

View File

@ -216,6 +216,12 @@
"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",
@ -240,6 +246,12 @@
"sourceRepoURL": "https://github.com/mapbox/cheap-ruler",
"asOfVersion": "2.5.0"
},
{
"libraryName": "chokidar",
"typingsPackageName": "chokidar",
"sourceRepoURL": "https://github.com/paulmillr/chokidar",
"asOfVersion": "2.1.3"
},
{
"libraryName": "chunked-dc",
"typingsPackageName": "chunked-dc",
@ -258,6 +270,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",
@ -414,6 +432,12 @@
"sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git",
"asOfVersion": "2.2.0"
},
{
"libraryName": "del",
"typingsPackageName": "del",
"sourceRepoURL": "https://github.com/sindresorhus/del",
"asOfVersion": "4.0.0"
},
{
"libraryName": "delay",
"typingsPackageName": "delay",
@ -510,6 +534,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",
@ -678,6 +708,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",
@ -714,6 +750,12 @@
"sourceRepoURL": "https://github.com/ivogabe/gulp-typescript",
"asOfVersion": "2.13.0"
},
{
"libraryName": "handlebars",
"typingsPackageName": "handlebars",
"sourceRepoURL": "https://github.com/wycats/handlebars.js",
"asOfVersion": "4.1.0"
},
{
"libraryName": "handsontable",
"typingsPackageName": "handsontable",
@ -834,6 +876,12 @@
"sourceRepoURL": "https://github.com/blakeembrey/is-lower-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "is-online",
"typingsPackageName": "is-online",
"sourceRepoURL": "https://github.com/sindresorhus/is-online",
"asOfVersion": "8.1.0"
},
{
"libraryName": "is-plain-object",
"typingsPackageName": "is-plain-object",
@ -990,6 +1038,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",
@ -1014,6 +1068,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",
@ -1086,6 +1146,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",
@ -1110,6 +1176,12 @@
"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",
@ -1140,12 +1212,36 @@
"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",
"sourceRepoURL": "https://github.com/sindresorhus/p-event",
"asOfVersion": "3.0.0"
},
{
"libraryName": "p-limit",
"typingsPackageName": "p-limit",
"sourceRepoURL": "https://github.com/sindresorhus/p-limit",
"asOfVersion": "2.2.0"
},
{
"libraryName": "p-map",
"typingsPackageName": "p-map",
@ -1158,6 +1254,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-pipe",
"asOfVersion": "2.0.1"
},
{
"libraryName": "p-queue",
"typingsPackageName": "p-queue",
"sourceRepoURL": "https://github.com/sindresorhus/p-queue",
"asOfVersion": "3.2.1"
},
{
"libraryName": "p-throttle",
"typingsPackageName": "p-throttle",
@ -1230,6 +1332,12 @@
"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",
@ -1278,6 +1386,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",
@ -1686,6 +1800,12 @@
"sourceRepoURL": "http://tabrisjs.com",
"asOfVersion": "1.8.0"
},
{
"libraryName": "tabris-plugin-firebase",
"typingsPackageName": "tabris-plugin-firebase",
"sourceRepoURL": "https://github.com/eclipsesource/tabris-plugin-firebase",
"asOfVersion": "2.1.0"
},
{
"libraryName": "tcomb",
"typingsPackageName": "tcomb",

View File

@ -17,6 +17,7 @@
"scripts": {
"compile-scripts": "tsc -p scripts",
"not-needed": "node scripts/not-needed.js",
"update-codeowners": "node scripts/update-codeowners.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
"lint": "dtslint types"
},

View File

@ -1,13 +1,10 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"baseUrl": "../types",
"typeRoots": [
"../types"
@ -15,4 +12,4 @@
"types": [],
"forceConsistentCasingInFileNames": true
}
}
}

View File

@ -0,0 +1,126 @@
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
const cp = require("child_process");
const Octokit = require("@octokit/rest");
const { AllPackages, getDefinitelyTyped, loggerWithErrors,
parseDefinitions, parseNProcesses, clean } = require("types-publisher");
const { writeFile } = require("fs-extra");
async function main() {
const options = { definitelyTypedPath: ".", progress: false, parseInParallel: true };
const log = loggerWithErrors()[0];
clean();
const dt = await getDefinitelyTyped(options, log);
await parseDefinitions(dt, { nProcesses: parseNProcesses(), definitelyTypedPath: "." }, log);
const allPackages = await AllPackages.read(dt);
const typings = allPackages.allTypings();
const maxPathLen = Math.max(...typings.map(t => t.subDirectoryPath.length));
const entries = mapDefined(typings, t => getEntry(t, maxPathLen));
await writeFile([options.definitelyTypedPath, ".github", "CODEOWNERS"].join("/"), `${header}\n\n${entries.join("\n")}\n`, { encoding: "utf-8" });
}
const token = /** @type {string} */(process.env.GH_TOKEN);
const gh = new Octokit();
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]
const now = new Date();
const branchName = `codeowner-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`;
const remoteUrl = `https://${token}@github.com/DefinitelyTyped/DefinitelyTyped.git`;
runSequence([
["git", ["checkout", "."]], // reset any changes
]);
main().then(() => {
runSequence([
["git", ["checkout", "-b", branchName]], // create a branch
["git", ["add", ".github/CODEOWNERS"]], // Add CODEOWNERS
["git", ["commit", "-m", `"Update CODEOWNERS"`]], // Commit all changes
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
]);
gh.authenticate({
type: "token",
token,
});
return gh.pulls.create({
owner: "DefinitelyTyped",
repo: "DefinitelyTyped",
maintainer_can_modify: true,
title: `🤖 CODEOWNERS has changed`,
head: `DefinitelyTyped:${branchName}`,
base: "master",
body:
`Please review the diff and merge if no changes are unexpected.
cc ${reviewers.map(r => "@" + r).join(" ")}`,
})
}).then(r => {
const num = r.data.number;
console.log(`Pull request ${num} created.`);
return gh.pulls.createReviewRequest({
owner: "DefinitelyTyped",
repo: "DefinitelyTyped",
number: num,
reviewers,
});
}).then(() => {
console.log(`Reviewers requested, done.`);
}).catch(e => {
console.error(e);
process.exit(1);
});
/** @param {[string, string[]][]} tasks */
function runSequence(tasks) {
for (const task of tasks) {
console.log(`${task[0]} ${task[1].join(" ")}`);
const result = cp.spawnSync(task[0], task[1], { timeout: 100000, shell: true, stdio: "inherit" });
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
}
}
/** @param {number} number */
function padNum(number) {
const str = "" + number;
return str.length >= 2 ? str : "0" + str;
}
const header =
`# This file is generated.
# Add yourself to the "Definitions by:" list instead.
# See https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package`;
/**
* @param { { contributors: ReadonlyArray<{githubUsername?: string }>, subDirectoryPath: string} } pkg
* @param {number} maxPathLen
* @return {string | undefined}
*/
function getEntry(pkg, maxPathLen) {
const users = mapDefined(pkg.contributors, c => c.githubUsername);
if (!users.length) {
return undefined;
}
const path = `${pkg.subDirectoryPath}/`.padEnd(maxPathLen);
return `/types/${path} ${users.map(u => `@${u}`).join(" ")}`;
}
/**
* @template T,U
* @param {ReadonlyArray<T>} arr
* @param {(t: T) => U | undefined} mapper
* @return U[]
*/
function mapDefined(arr, mapper) {
const out = [];
for (const a of arr) {
const res = mapper(a);
if (res !== undefined) {
out.push(res);
}
}
return out;
}

View File

@ -2,7 +2,7 @@
// Project: https://github.com/ciferox/adone
// Definitions by: am <https://github.com/s0m3on3>, Maximus <https://github.com/maxveres>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
// TypeScript Version: 2.8
/// <reference path="./adone.d.ts" />
/// <reference path="./glosses/app.d.ts" />

View File

@ -16,4 +16,4 @@
"await-promise": false,
"no-restricted-globals": false
}
}
}

View File

@ -98,6 +98,7 @@ let _algoliaIndexSettings: IndexSettings = {
placeholders: { '': [''] },
camelCaseAttributes: [''],
sortFacetValuesBy: 'count',
queryLanguages: ['fr', 'es'],
};
let _algoliaQueryParameters: QueryParameters = {

View File

@ -6,6 +6,7 @@
// Samuel Vaillant <https://github.com/samouss>
// Kai Eichinger <https://github.com/keichinger>
// Nery Ortez <https://github.com/neryortez>
// Antoine Rousseau <https://github.com/antoinerousseau>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -1778,12 +1779,20 @@ declare namespace algoliasearch {
};
/**
* List of attributes on which to do a decomposition of camel case words.
*
https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
* https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/
*/
camelCaseAttributes?: string[];
/**
* Controls how facet values are sorted.
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
*/
sortFacetValuesBy?: 'count' | 'alpha';
/**
* Sets the languages to be used by language-specific settings and functionalities
* such as ignorePlurals, removeStopWords, and CJK word-detection.
* https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/
*/
queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>;
}
interface Response<T=any> {

View File

@ -7,6 +7,7 @@
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
// Kai Eichinger <https://github.com/keichinger>
// Nery Ortez <https://github.com/neryortez>
// Antoine Rousseau <https://github.com/antoinerousseau>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -534,9 +535,16 @@ declare namespace algoliasearch {
userData?: string | object;
/**
* Controls how facet values are sorted.
* https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/
*/
sortFacetValuesBy?: 'count' | 'alpha';
/**
* Sets the languages to be used by language-specific settings and functionalities
* such as ignorePlurals, removeStopWords, and CJK word-detection.
* https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/
*/
queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>;
}
namespace SearchForFacetValues {

File diff suppressed because it is too large Load Diff

10
types/amap-js-api/array-bounds.d.ts vendored Normal file
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
types/amap-js-api/bounds.d.ts vendored Normal file
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
types/amap-js-api/browser.d.ts vendored Normal file
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
types/amap-js-api/common.d.ts vendored Normal file
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
types/amap-js-api/convert-from.d.ts vendored Normal file
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
types/amap-js-api/dom-util.d.ts vendored Normal file
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
types/amap-js-api/event.d.ts vendored Normal file
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
types/amap-js-api/geometry-util.d.ts vendored Normal file
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
types/amap-js-api/index.d.ts vendored Normal file
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
types/amap-js-api/layer/building.d.ts vendored Normal file
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
types/amap-js-api/layer/flexible.d.ts vendored Normal file
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
types/amap-js-api/layer/layer.d.ts vendored Normal file
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
types/amap-js-api/layer/layerGroup.d.ts vendored Normal file
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
types/amap-js-api/layer/massMarks.d.ts vendored Normal file
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
types/amap-js-api/layer/mediaLayer.d.ts vendored Normal file
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
types/amap-js-api/layer/tileLayer.d.ts vendored Normal file
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
types/amap-js-api/layer/wms.d.ts vendored Normal file
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
types/amap-js-api/layer/wmts.d.ts vendored Normal file
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
types/amap-js-api/lngLat.d.ts vendored Normal file
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
types/amap-js-api/map.d.ts vendored Normal file
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;
}
}

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
types/amap-js-api/overlay/circle.d.ts vendored Normal file
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[];
}
}

View File

@ -0,0 +1,4 @@
declare namespace AMap {
// tslint:disable-next-line;
class CircleMarker<ExtraData = any> extends Circle<ExtraData> {}
}

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
types/amap-js-api/overlay/ellipse.d.ts vendored Normal file
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
types/amap-js-api/overlay/geoJSON.d.ts vendored Normal file
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
types/amap-js-api/overlay/icon.d.ts vendored Normal file
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;
}
}

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
types/amap-js-api/overlay/marker.d.ts vendored Normal file
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;
}
}

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
types/amap-js-api/overlay/overlay.d.ts vendored Normal file
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;
}
}

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;
}
}

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
types/amap-js-api/overlay/polygon.d.ts vendored Normal file
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
types/amap-js-api/overlay/polyline.d.ts vendored Normal file
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>>;
}
}

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;
}
}

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
types/amap-js-api/overlay/text.d.ts vendored Normal file
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
types/amap-js-api/pixel.d.ts vendored Normal file
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
types/amap-js-api/size.d.ts vendored Normal file
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;
}
}

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
types/amap-js-api/type-util.d.ts vendored Normal file
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
types/amap-js-api/util.d.ts vendored Normal file
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
types/amap-js-api/view2D.d.ts vendored Normal file
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);
}
}

View File

@ -14,6 +14,14 @@ amqp.connect('amqp://localhost')
amqp.connect('amqp://localhost')
.then(connection => {
connection.serverProperties.copyright; // $ExpectType string | undefined
connection.serverProperties.platform; // $ExpectType string
connection.serverProperties.information; // $ExpectType string
connection.serverProperties.host; // $ExpectType string
connection.serverProperties.product; // $ExpectType string
connection.serverProperties.version; // $ExpectType string
connection.serverProperties.customField; // $ExpectType string | undefined
return connection.createChannel()
.tap(channel => channel.checkQueue('myQueue'))
.then(channel => {
@ -37,6 +45,14 @@ import amqpcb = require('amqplib/callback_api');
amqpcb.connect('amqp://localhost', (err, connection) => {
if (!err) {
connection.serverProperties.copyright; // $ExpectType string | undefined
connection.serverProperties.platform; // $ExpectType string
connection.serverProperties.information; // $ExpectType string
connection.serverProperties.host; // $ExpectType string
connection.serverProperties.product; // $ExpectType string
connection.serverProperties.version; // $ExpectType string
connection.serverProperties.customField; // $ExpectType string | undefined
connection.createChannel((err, channel) => {
if (!err) {
channel.assertQueue('myQueue', {}, (err, ok) => {

View File

@ -1,11 +1,12 @@
import events = require('events');
import { Replies, Options, Message } from './properties';
import { Replies, Options, Message, ServerProperties } from './properties';
export * from './properties';
export interface Connection extends events.EventEmitter {
close(callback?: (err: any) => void): void;
createChannel(callback: (err: any, channel: Channel) => void): void;
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
serverProperties: ServerProperties;
}
export interface Channel extends events.EventEmitter {

View File

@ -8,13 +8,14 @@
import * as Promise from 'bluebird';
import * as events from 'events';
import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties';
import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties';
export * from './properties';
export interface Connection extends events.EventEmitter {
close(): Promise<void>;
createChannel(): Promise<Channel>;
createConfirmChannel(): Promise<ConfirmChannel>;
serverProperties: ServerProperties;
}
export interface Channel extends events.EventEmitter {

View File

@ -210,3 +210,13 @@ export interface XDeath {
"original-expiration"?: any;
"routing-keys": string[];
}
export interface ServerProperties {
host: string;
product: string;
version: string;
platform: string;
copyright?: string;
information: string;
[key: string]: string | undefined;
}

View File

@ -1,4 +1,4 @@
import * as anime from 'animejs';
import anime from 'animejs';
const test1 = anime({
targets: 'div',
@ -17,9 +17,9 @@ const test2 = anime({
},
translateY: '40px',
color: [
{value: '#FF0000', duration: 2000},
{value: '#00FF00', duration: 2000},
{value: '#0000FF', duration: 2000},
{ value: '#FF0000', duration: 2000 },
{ value: '#00FF00', duration: 2000 },
{ value: '#0000FF', duration: 2000 },
],
duration: () => {
return 1000000000000;
@ -69,3 +69,9 @@ const bezier = anime.bezier(0, 0, 100, 100);
anime.easings['hello'] = anime.bezier(0, 0, 1900, 3020);
const runningAnims = anime.running;
anime.remove(".tiny-divvy-div");
anime.timeline().add({
targets: [],
duration: 1000,
easing: "linear",
}, 0);

View File

@ -1,6 +1,7 @@
// Type definitions for animejs 2.0
// Project: http://animejs.com
// Definitions by: Andrew Babin <https://github.com/A-Babin>
// Definitions by: Andrew Babin <https://github.com/A-Babin>
// supaiku0 <https://github.com/supaiku0>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@ -110,7 +111,7 @@ declare namespace anime {
}
interface AnimeTimelineInstance extends AnimeInstance {
add(params: AnimeAnimParams): AnimeTimelineInstance;
add(params: AnimeAnimParams, timelineOffset?: string | number): AnimeTimelineInstance;
}
// Helpers

View File

@ -14,6 +14,7 @@
"../"
],
"types": [],
"allowSyntheticDefaultImports": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true
},

View File

@ -19,10 +19,10 @@ declare namespace Ansi {
interface AnsiEscapes {
cursorTo(x: number, y?: number): string;
cursorMove(x: number, y?: number): string;
cursorUp(count: number): string;
cursorDown(count: number): string;
cursorForward(count: number): string;
cursorBackward(count: number): string;
cursorUp(count?: number): string;
cursorDown(count?: number): string;
cursorForward(count?: number): string;
cursorBackward(count?: number): string;
cursorLeft: string;
cursorSavePosition: string;

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;

View File

@ -27,6 +27,7 @@
// Erik Dalén <https://github.com/dalen>
// Loïk Gaonac'h <https://github.com/loikg>
// Roberto Zen <https://github.com/skyzenr>
// Richard Cornelissen <https://github.com/richardcornelissen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@ -536,10 +537,10 @@ export type StatementResource = MaybeStatementPrincipal & ({ Resource: string |
export type StatementPrincipal = MaybeStatementResource & ({ Principal: PrincipalValue } | { NotPrincipal: PrincipalValue });
/**
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement.
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
* https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
*/
export interface AuthResponseContext {
[name: string]: any;
[name: string]: boolean | number | string;
}
/**
@ -878,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;
}

View File

@ -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);

View File

@ -191,6 +191,7 @@ export class TransactionBuilder {
export const networks: {
bitcoin: Network;
testnet: Network;
regtest: Network;
};
export const opcodes: {

View File

@ -46,4 +46,21 @@ $.notify({
'</div>' +
'<a href="{3}" target="{4}" data-notify="url"></a>' +
'</div>'
});
});
const notifyResult = $.notify({
message: 'Callbacks have the popup element as an argument',
},{
onShow: function($ele) {
notifyResult.$ele === $ele;
},
onShown: function($ele) {
notifyResult.$ele === $ele;
},
onClose: function($ele) {
notifyResult.$ele === $ele;
},
onClosed: function($ele) {
notifyResult.$ele === $ele;
},
});

View File

@ -48,16 +48,16 @@ interface NotifySettings {
enter?: string;
exit?: string;
};
onShow?: () => void;
onShown?: () => void;
onClose?: () => void;
onClosed?: () => void;
onShow?: ($ele: JQuery) => void;
onShown?: ($ele: JQuery) => void;
onClose?: ($ele: JQuery) => void;
onClosed?: ($ele: JQuery) => void;
icon_type?: string;
template?: string;
}
interface NotifyReturn {
$ele: JQueryStatic;
$ele: JQuery;
close: () => void;
update: (command: string, update: any) => void;
}

View File

@ -196,6 +196,12 @@ $("#popover").popover({
offset: 10,
fallbackPlacement: ["flip", "clockwise"],
boundary: "scrollParent",
sanitize: false,
whiteList: {
h1: [],
img: ['src', 'alt', 'title', 'width', 'height'],
},
sanitizeFn: (x: string) => x.replace("<", ""),
});
$("#popover").popover({
@ -207,6 +213,10 @@ $("#popover").popover({
},
});
$("#popover").popover({
sanitizeFn: null,
});
// --------------------------------------------------------------------------------------
// Scrollspy
// --------------------------------------------------------------------------------------
@ -280,10 +290,23 @@ $("#tooltip").on("hide.bs.tooltip", () => {});
$("#tooltip").tooltip({
animation: false,
});
$("#tooltip").tooltip({
container: "#container",
delay: {show: 500, hide: 100},
html: true,
placement: "auto",
selector: "[rel=\"tooltip\"]",
template: '<div class="tooltip empty" role="tooltip"></div>',
title: "Hello world",
trigger: "hover focus",
offset: 10,
fallbackPlacement: ["flip", "clockwise"],
boundary: "scrollParent",
sanitize: false,
whiteList: {
h1: [],
img: ['src', 'alt', 'title', 'width', 'height'],
},
sanitizeFn: (x: string) => x.replace("<", ""),
});
$("#tooltip").tooltip({
@ -298,18 +321,6 @@ $("#tooltip").tooltip({
delay: 250,
});
$("#tooltip").tooltip({
delay: {show: 500, hide: 100},
});
$("#tooltip").tooltip({
html: true,
});
$("#tooltip").tooltip({
placement: "auto",
});
$("#tooltip").tooltip({
placement(this, tooltip, trigger) {
console.log(this.tip === tooltip);
@ -327,22 +338,10 @@ $("#tooltip").tooltip({
},
});
$("#tooltip").tooltip({
selector: "[rel=\"tooltip\"]",
});
$("#tooltip").tooltip({
selector: false,
});
$("#tooltip").tooltip({
template: '<div class="tooltip empty" role="tooltip"></div>',
});
$("#tooltip").tooltip({
title: "Hello world",
});
$("#tooltip").tooltip({
title: document.getElementById("title-element") as HTMLElement,
});
@ -353,14 +352,6 @@ $("#tooltip").tooltip({
},
});
$("#tooltip").tooltip({
trigger: "hover focus",
});
$("#tooltip").tooltip({
offset: 10,
});
$("#tooltip").tooltip({
offset: "10px",
});
@ -369,14 +360,10 @@ $("#tooltip").tooltip({
fallbackPlacement: "clockwise",
});
$("#tooltip").tooltip({
fallbackPlacement: ["flip", "clockwise"],
});
$("#tooltip").tooltip({
boundary: "scrollParent",
});
$("#tooltip").tooltip({
boundary: aHtmlElement,
});
$("#popover").popover({
sanitizeFn: null,
});

View File

@ -1,4 +1,4 @@
// Type definitions for Bootstrap 4.2
// Type definitions for Bootstrap 4.3
// Project: https://github.com/twbs/bootstrap/, https://getbootstrap.com
// Definitions by: denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -352,6 +352,25 @@ export interface TooltipOption {
* @default "scrollParent"
*/
boundary?: Popper.Boundary | HTMLElement;
/**
* Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized.
*
* @default true
*/
sanitize?: boolean;
/**
* Object which contains allowed attributes and tags.
*/
whiteList?: {[key: string]: string[]};
/**
* Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.
*
* @default null
*/
sanitizeFn?: null | ((input: string) => string);
}
// --------------------------------------------------------------------------------------

View File

@ -25,6 +25,7 @@ declare namespace BPMNModdle {
interface TypeDerived {
$type: ElementType;
$parent: TypeDerived;
}
interface BaseElement extends TypeDerived {
/**

View File

@ -7,7 +7,6 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="chokidar"/>
/// <reference types="node" />
/// <reference types="serve-static" />

View File

@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"chokidar": "^2.1.2"
}
}

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');

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 {}

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"
]
}

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
types/cassanknex/index.d.ts vendored Normal file
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>;
}

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"
]
}

View File

@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false,
"strict-export-declare-modifiers": false
}
}

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;

View File

@ -1,5 +1,5 @@
// Type definitions for Chart.js 2.7
// Project: https://github.com/nnnick/Chart.js, http://www.chartjs.org
// Project: https://github.com/nnnick/Chart.js, https://www.chartjs.org
// Definitions by: Alberto Nuti <https://github.com/anuti>
// Fabien Lavocat <https://github.com/FabienLavocat>
// KentarouTakeda <https://github.com/KentarouTakeda>
@ -357,7 +357,7 @@ declare namespace Chart {
cornerRadius?: number;
multiKeyBackground?: string;
callbacks?: ChartTooltipCallback;
filter?(item: ChartTooltipItem): boolean;
filter?(item: ChartTooltipItem, data: ChartData): boolean;
itemSort?(itemA: ChartTooltipItem, itemB: ChartTooltipItem): number;
position?: string;
caretPadding?: number;

View File

@ -24,6 +24,8 @@ if ($fromElement("ul > li").length !== 3) {
throw new Error("Expecting 3 elements when passing `CheerioElement` to `load()`");
}
$ = cheerio.load(Buffer.from(html));
$ = cheerio.load(html, {
normalizeWhitespace: true,
xmlMode: true

View File

@ -1,8 +1,10 @@
// Type definitions for Cheerio v0.22.0
// Project: https://github.com/cheeriojs/cheerio
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>, Ryo Ota <https://github.com/nwtgck>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
interface Cheerio {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
@ -266,7 +268,7 @@ interface CheerioElement {
}
interface CheerioAPI extends CheerioSelector, CheerioStatic {
load(html: string, options?: CheerioOptionsInterface): CheerioStatic;
load(html: string | Buffer, options?: CheerioOptionsInterface): CheerioStatic;
load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic;
}

View File

@ -1,57 +0,0 @@
import * as fs from 'fs';
import chokidar = require('chokidar');
const watcher = chokidar.watch('file, dir, or glob', {
ignored: /[\/\\]\./, persistent: true
});
const log = console.log.bind(console);
watcher
.on('add', (path: string) => {
log('File', path, 'has been added');
})
.on('addDir', (path: string) => {
log('Directory', path, 'has been added');
})
.on('change', (path: string) => {
log('File', path, 'has been changed');
})
.on('unlink', (path: string) => {
log('File', path, 'has been removed');
})
.on('unlinkDir', (path: string) => {
log('Directory', path, 'has been removed');
})
.on('error', (error: any) => {
log('Error happened', error);
})
.on('ready', () => {
log('Initial scan complete. Ready for changes.');
})
.on('raw', (event: string, path: string, details: any) => {
log('Raw event info:', event, path, details);
});
// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', (path: string, stats: fs.Stats) => {
if (stats) {
console.log('File', path, 'changed size to', stats.size);
}
});
// Watch new files.
watcher.add('new-file');
watcher.add(['new-file-2', 'new-file-3', '**/other-file*']);
// Un-watch some files.
watcher.unwatch('new-file*');
// Only needed if watching is `persistent: true`.
watcher.close();
// One-liner
chokidar.watch('.', { ignored: /[\/\\]\./ }).on('all', (event: string, path: string) => {
console.log(event, path);
});

View File

@ -1,170 +0,0 @@
// Type definitions for chokidar 1.7
// Project: https://github.com/paulmillr/chokidar
// Definitions by: Stefan Steinhart <https://github.com/reppners>
// Felix Becker <https://github.com/felixfbecker>
// Zach Cardoza <https://github.com/bayssmekanique>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as fs from 'fs';
import { EventEmitter } from 'events';
/**
* The object's keys are all the directories (using absolute paths unless the `cwd` option was
* used), and the values are arrays of the names of the items contained in each directory.
*/
export interface WatchedPaths {
[directory: string]: string[];
}
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
/**
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
constructor(options?: WatchOptions);
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | string[]): void;
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | string[]): void;
/**
* Returns an object representing all the paths on the file system being watched by this
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
* the `cwd` option was used), and the values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): WatchedPaths;
/**
* Removes all listeners from watched files.
*/
close(): void;
}
export interface WatchOptions {
/**
* Indicates whether the process should continue to run as long as files are being watched. If
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
* even if the process continues to run.
*/
persistent?: boolean;
/**
* ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
* with two arguments is provided, it gets called twice per path - once with a single argument
* (the path), second time with two arguments (the path and the
* [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
*/
ignored?: any;
/**
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
*/
ignoreInitial?: boolean;
/**
* When `false`, only the symlinks themselves will be watched for changes instead of following
* the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
* be relative to this.
*/
cwd?: string;
/**
* If set to true then the strings passed to .watch() and .add() are treated as literal path
* names, even if they look like globs. Default: false.
*/
disableGlobbing?: boolean;
/**
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
* utilization, consider setting this to `false`. It is typically necessary to **set this to
* `true` to successfully watch files over a network**, and it may be necessary to successfully
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
* the `useFsEvents` default.
*/
usePolling?: boolean;
/**
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
* OS X, `usePolling: true` becomes the default.
*/
useFsEvents?: boolean;
/**
* If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
* provided even in cases where it wasn't already available from the underlying watch events.
*/
alwaysStat?: boolean;
/**
* If set, limits how many levels of subdirectories will be traversed.
*/
depth?: number;
/**
* Interval of file system polling.
*/
interval?: number;
/**
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
*/
binaryInterval?: number;
/**
* Indicates whether to watch files that don't have read permissions if possible. If watching
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
* silently.
*/
ignorePermissionErrors?: boolean;
/**
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
* that occur when using editors that use "atomic writes" instead of writing directly to the
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
* you can override it by setting `atomic` to a custom value, in milliseconds.
*/
atomic?: boolean | number;
/**
* can be set to an object in order to adjust timing params:
*/
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
}
export interface AwaitWriteFinishOptions {
/**
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
*/
stabilityThreshold?: number;
/**
* File size polling interval.
*/
pollInterval?: number;
}
/**
* produces an instance of `FSWatcher`.
*/
export function watch(paths: string | string[], options?: WatchOptions): FSWatcher;

View File

@ -0,0 +1,17 @@
import CipherBase = require("cipher-base");
const buf = new Buffer(1);
class CipherTest extends CipherBase {
constructor() {
super();
}
final() {
return buf;
}
update(testBuffer: Buffer) {
return testBuffer;
}
}

14
types/cipher-base/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
// Type definitions for cipher-base 1.0
// Project: https://github.com/crypto-browserify/cipher-base
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare abstract class CipherBase {
constructor(hashMode?: string);
abstract final(): Buffer;
abstract update(value: Buffer, inputEnc?: string, outputEnc?: string): Buffer;
}
export = CipherBase;

View File

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

View File

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

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);

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;

View File

@ -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
types/collectionsjs/index.d.ts vendored Normal file
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>;
}

View File

@ -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"
]
}

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 {

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