Merge remote-tracking branch 'DefinitelyTyped/master'

This commit is contained in:
Brian Love
2017-05-04 17:30:24 -06:00
5626 changed files with 206095 additions and 225486 deletions
+3 -5
View File
@@ -1,25 +1,23 @@
Please fill in this template.
- [ ] Make your PR against the `master` branch.
- [ ] Use a meaningful title for the pull request. Include the name of the package modified.
- [ ] Test the change in your own code. (Compile and run.)
- [ ] Follow the advice from the [readme](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#make-a-pull-request).
- [ ] Avoid [common mistakes](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md#common-mistakes).
- [ ] Run `tsc` without errors.
- [ ] Run `npm run lint package-name` if a `tslint.json` is present.
- [ ] Run `npm run lint package-name` (or `tsc` if no `tslint.json` is present).
Select one of these and delete the others:
If adding a new definition:
- [ ] The package does not provide its own types, and you can not add them.
- [ ] If this is for an NPM package, match the name. If not, do not conflict with the name of an NPM package.
- [ ] Create it with `npm run new-package package-name`, not by basing it on an existing project.
- [ ] Create it with `dts-gen --dt`, not by basing it on an existing project.
- [ ] `tslint.json` should be present, and `tsconfig.json` should have `noImplicitAny`, `noImplicitThis`, and `strictNullChecks` set to `true`.
If changing an existing definition:
- [ ] Provide a URL to documentation or source code which provides context for the suggested changes: <<url here>>
- [ ] Increase the version number in the header if appropriate.
- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "../tslint.json" }`.
- [ ] If you are making substantial changes, consider adding a `tslint.json` containing `{ "extends": "dslint/dt.json" }`.
If removing a declaration:
- [ ] If a package was never on DefinitelyTyped, you don't need to do anything. (If you wrote a package and provided types, you don't need to register it with us.)
+26 -16
View File
@@ -71,7 +71,9 @@ Add to your `tsconfig.json`:
Create `types/foo/index.d.ts` containing declarations for the module "foo".
You should now be able import from `"foo"` in your code and it will route to the new type definition.
Then build *and* run the code to make sure your type definition actually corresponds to what happens at runtime.
Once you've tested your definitions with real code, make a PR contributing the definition by copying `types/foo` to `DefinitelyTyped/foo` and adding a `tsconfig.json` and `foo-tests.ts`.
Once you've tested your definitions with real code, make a [PR](#make-a-pull-request)
then follow the instructions to [edit an existing package](#edit-an-existing-package) or
[create a new package](#create-a-new-package).
### Make a pull request
@@ -83,10 +85,17 @@ First, [fork](https://guides.github.com/activities/forking/) this repository, in
#### Edit an existing package
* `cd my-package-to-edit`
* `cd types/my-package-to-edit`
* Make changes. Remember to edit tests.
* You may also want to add yourself to "Definitions by" section of the package header.
- Do this by adding your name to the end of the line, as in `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
- Or if there are more people, it can be multiline
```typescript
// Definitions by: Alice <https://github.com/alice>
// Bob <https://github.com/bob>
// Steve <https://github.com/steve>
// John <https://github.com/john>
```
* `npm install -g typescript@2.0` and run `tsc`.
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
@@ -110,9 +119,8 @@ Your package should have this structure:
| tsconfig.json | This allows you to run `tsc` within the package. |
| tslint.json | Enables linting. |
Generate these by running `npm run new-package -- --name my-package-name --template module`.
(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`.
This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.)
Generate these by running `npm install -g dts-gen` and `dts-gen --dt --name my-package-name --template module`.
See all options at [dts-gen](https://github.com/Microsoft/dts-gen).
You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option.
@@ -154,22 +162,24 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN
#### Lint
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "../tslint.json" }`. All new packages must be linted.
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "dtslint/dt.json" }`. All new packages must be linted.
If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
```js
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
// This package uses the Function type, and it will take effort to fix.
"forbidden-types": false
"ban-types": false
}
}
```
(To indicate that a lint rule truly does not apply, use `// tslint:disable:rule-name` or better, `//tslint:disable-next-line:rule-name`.)
(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.)
Test by running `npm run lint package-name` where `package-name` is the name of your package.
This script uses [dtslint](https://github.com/Microsoft/dtslint).
Test the linter by running `npm run lint -- package-name`. Do not use a globally installed tslint.
## FAQ
@@ -183,11 +193,6 @@ This usually happens within an hour of changes being merged.
If the module you're referencing is an external module (uses `export`), use an import.
If the module you're referencing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
#### What do I do about older versions of typings?
Currently we don't support this, though it is [planned](https://github.com/Microsoft/types-publisher/issues/3).
If you're adding a new major version of a library, you can copy `index.d.ts` to `foo-v2.3.d.ts` and edit `index.d.ts` to be the new version.
#### I notice some packages having a `package.json` here.
Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it.
@@ -213,7 +218,7 @@ If default imports work in your environment, consider turning on the [`--allowSy
Do not change the type definition if it is accurate.
For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the export, and `export default` is accurate if `node -p 'require("foo").default'` is the export.
#### I want to use features from TypeScript 2.1.
#### I want to use features from TypeScript 2.1 or above.
Then you will have to add a comment to the last line of your definition header (after `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`.
@@ -255,6 +260,11 @@ transitively `react-router-bootstrap` (which depends on `react-router`) also add
Also, `/// <reference types=".." />` will not work with path mapping, so dependencies must use `import`.
#### What about scoped packages?
Types for a scoped package `@foo/bar` should go in `types/foo__bar`. Note the double underscore.
#### The file history in GitHub looks incomplete.
GitHub doesn't [support](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) file history for renamed files. Use [`git log --follow`](https://www.git-scm.com/docs/git-log) instead.
+238 -4
View File
@@ -12,18 +12,54 @@
"sourceRepoURL": "https://github.com/ant-design/ant-design",
"asOfVersion": "1.0.0"
},
{
"libraryName": "anydb-sql",
"typingsPackageName": "anydb-sql",
"sourceRepoURL": "https://github.com/doxout/anydb-sql",
"asOfVersion": "0.6.46"
},
{
"libraryName": "Argon2",
"typingsPackageName": "argon2",
"sourceRepoURL": "https://github.com/ranisalt/node-argon2",
"asOfVersion": "0.15.0"
},
{
"libraryName": "aws-sdk",
"typingsPackageName": "aws-sdk",
"sourceRepoURL": "https://github.com/aws/aws-sdk-js",
"asOfVersion": "2.7.0"
},
{
"libraryName": "axe-core",
"typingsPackageName": "axe-core",
"sourceRepoURL": "https://github.com/dequelabs/axe-core",
"asOfVersion": "2.0.7"
},
{
"libraryName": "axios",
"typingsPackageName": "axios",
"sourceRepoURL": "https://github.com/mzabriskie/axios",
"asOfVersion": "0.14.0"
},
{
"libraryName": "azure-mobile-apps",
"typingsPackageName": "azure-mobile-apps",
"sourceRepoURL": "https://github.com/Azure/azure-mobile-apps-node/",
"asOfVersion": "3.0.0"
},
{
"libraryName": "BabylonJS",
"typingsPackageName": "babylonjs",
"sourceRepoURL": "http://www.babylonjs.com/",
"asOfVersion": "2.4.1"
},
{
"libraryName": "Bugsnag Browser",
"typingsPackageName": "bugsnag-js",
"sourceRepoURL": "https://github.com/bugsnag/bugsnag-js",
"asOfVersion": "3.1.0"
},
{
"libraryName": "camel-case",
"typingsPackageName": "camel-case",
@@ -36,6 +72,12 @@
"sourceRepoURL": "https://github.com/blakeembrey/change-case",
"asOfVersion": "2.3.1"
},
{
"libraryName": "cheap-ruler",
"typingsPackageName": "cheap-ruler",
"sourceRepoURL": "https://github.com/mapbox/cheap-ruler",
"asOfVersion": "2.5.0"
},
{
"libraryName": "constant-case",
"typingsPackageName": "constant-case",
@@ -48,6 +90,12 @@
"sourceRepoURL": "https://github.com/date-fns/date-fns",
"asOfVersion": "2.6.0"
},
{
"libraryName": "DevExtreme",
"typingsPackageName": "devextreme",
"sourceRepoURL": "http://js.devexpress.com/",
"asOfVersion": "16.2.1"
},
{
"libraryName": "Dexie.js",
"typingsPackageName": "dexie",
@@ -72,6 +120,30 @@
"sourceRepoURL": "https://github.com/bterlson/ecmarkup",
"asOfVersion": "3.4.0"
},
{
"libraryName": "electron-builder",
"typingsPackageName": "electron-builder",
"sourceRepoURL": "https://github.com/loopline-systems/electron-builder",
"asOfVersion": "2.8.0"
},
{
"libraryName": "EventEmitter3",
"typingsPackageName": "eventemitter3",
"sourceRepoURL": "https://github.com/primus/eventemitter3",
"asOfVersion": "2.0.2"
},
{
"libraryName": "JSON-Patch",
"typingsPackageName": "fast-json-patch",
"sourceRepoURL": "https://github.com/Starcounter-Jack/JSON-Patch",
"asOfVersion": "1.1.5"
},
{
"libraryName": "FastSimplexNoise",
"typingsPackageName": "fast-simplex-noise",
"sourceRepoURL": "https://www.npmjs.com/package/fast-simplex-noise",
"asOfVersion": "3.0.0"
},
{
"libraryName": "FineUploader",
"typingsPackageName": "fine-uploader",
@@ -84,6 +156,18 @@
"sourceRepoURL": "https://github.com/ascoders/gaea-model",
"asOfVersion": "0.0.0"
},
{
"libraryName": "github",
"typingsPackageName": "github",
"sourceRepoURL": "https://github.com/mikedeboer/node-github",
"asOfVersion": "7.1.0"
},
{
"libraryName": "gulp-typescript",
"typingsPackageName": "gulp-typescript",
"sourceRepoURL": "https://github.com/ivogabe/gulp-typescript",
"asOfVersion": "2.13.0"
},
{
"libraryName": "Facebook's Immutable",
"typingsPackageName": "immutable",
@@ -138,12 +222,30 @@
"sourceRepoURL": "https://github.com/blakeembrey/is-upper-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "JSNLog",
"typingsPackageName": "jsnlog",
"sourceRepoURL": "https://github.com/mperdeck/jsnlog.js",
"asOfVersion": "2.17.2"
},
{
"libraryName": "jsonschema",
"typingsPackageName": "jsonschema",
"sourceRepoURL": "https://github.com/tdegrunt/jsonschema",
"asOfVersion": "1.1.1"
},
{
"libraryName": "knockout-paging",
"typingsPackageName": "knockout-paging",
"sourceRepoURL": "https://github.com/ErikSchierboom/knockout-paging",
"asOfVersion": "0.3.1"
},
{
"libraryName": "knockout-pre-rendered",
"typingsPackageName": "knockout-pre-rendered",
"sourceRepoURL": "https://github.com/ErikSchierboom/knockout-pre-rendered",
"asOfVersion": "0.7.1"
},
{
"libraryName": "Linq.JS",
"typingsPackageName": "linq",
@@ -157,10 +259,10 @@
"asOfVersion": "1.0.0"
},
{
"libraryName": "localforage",
"typingsPackageName": "localforage",
"sourceRepoURL": "https://github.com/localForage/localForage",
"asOfVersion": "0.0.34"
"libraryName": "localforage",
"typingsPackageName": "localforage",
"sourceRepoURL": "https://github.com/localForage/localForage",
"asOfVersion": "0.0.34"
},
{
"libraryName": "lower-case",
@@ -174,12 +276,30 @@
"sourceRepoURL": "https://github.com/blakeembrey/lower-case-first",
"asOfVersion": "1.0.1"
},
{
"libraryName": "maquette",
"typingsPackageName": "maquette",
"sourceRepoURL": "http://maquettejs.org/",
"asOfVersion": "2.1.6"
},
{
"libraryName": "mendixmodelsdk",
"typingsPackageName": "mendixmodelsdk",
"sourceRepoURL": "http://www.mendix.com",
"asOfVersion": "0.8.1"
},
{
"libraryName": "mobservable",
"typingsPackageName": "mobservable",
"sourceRepoURL": "github.com/mweststrate/mobservable",
"asOfVersion": "1.2.5"
},
{
"libraryName": "mobservable-react",
"typingsPackageName": "mobservable-react",
"sourceRepoURL": "https://github.com/mweststrate/mobservable-react",
"asOfVersion": "1.0.0"
},
{
"libraryName": "Moment",
"typingsPackageName": "moment",
@@ -204,12 +324,24 @@
"sourceRepoURL": "https://github.com/foretagsplatsen/numbro/",
"asOfVersion": "1.9.3"
},
{
"libraryName": "Onsen UI",
"typingsPackageName": "onsenui",
"sourceRepoURL": "http://onsen.io",
"asOfVersion": "2.0.0"
},
{
"libraryName": "param-case",
"typingsPackageName": "param-case",
"sourceRepoURL": "https://github.com/blakeembrey/param-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "parse5",
"typingsPackageName": "parse5",
"sourceRepoURL": "https://github.com/inikulin/parse5",
"asOfVersion": "3.0.0"
},
{
"libraryName": "pascal-case",
"typingsPackageName": "pascal-case",
@@ -222,12 +354,30 @@
"sourceRepoURL": "https://github.com/blakeembrey/path-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "path-to-regexp",
"typingsPackageName": "path-to-regexp",
"sourceRepoURL": "https://github.com/pillarjs/path-to-regexp",
"asOfVersion": "1.7.0"
},
{
"libraryName": "pg-promise",
"typingsPackageName": "pg-promise",
"sourceRepoURL": "https://github.com/vitaly-t/pg-promise",
"asOfVersion": "5.4.3"
},
{
"libraryName": "pixi-spine",
"typingsPackageName": "pixi-spine",
"sourceRepoURL": "https://github.com/pixijs/pixi-spine",
"asOfVersion": "1.4.2"
},
{
"libraryName": "pkcs11js",
"typingsPackageName": "pkcs11js",
"sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js",
"asOfVersion": "1.0.4"
},
{
"libraryName": "poly2tri.js",
"typingsPackageName": "poly2tri",
@@ -258,6 +408,12 @@
"sourceRepoURL": "https://github.com/reactjs/redux",
"asOfVersion": "3.6.0"
},
{
"libraryName": "redux-batched-actions",
"typingsPackageName": "redux-batched-actions",
"sourceRepoURL": "https://github.com/tshelburne/redux-batched-actions",
"asOfVersion": "0.1.5"
},
{
"libraryName": "redux-persist",
"typingsPackageName": "redux-persist",
@@ -282,12 +438,36 @@
"sourceRepoURL": "https://github.com/gaearon/redux-thunk",
"asOfVersion": "2.1.0"
},
{
"libraryName": "reselect",
"typingsPackageName": "reselect",
"sourceRepoURL": "https://github.com/rackt/reselect",
"asOfVersion": "2.2.0"
},
{
"libraryName": "rest-io",
"typingsPackageName": "rest-io",
"sourceRepoURL": "https://github.com/EnoF/rest-io",
"asOfVersion": "4.1.0"
},
{
"libraryName": "route-recognizer",
"typingsPackageName": "route-recognizer",
"sourceRepoURL": "https://github.com/tildeio/route-recognizer",
"asOfVersion": "0.3.0"
},
{
"libraryName": "node-scanf",
"typingsPackageName": "scanf",
"sourceRepoURL": "https://github.com/Lellansin/node-scanf",
"asOfVersion": "0.7.3"
},
{
"libraryName": "sendgrid",
"typingsPackageName": "sendgrid",
"sourceRepoURL": "https://github.com/sendgrid/sendgrid-nodejs",
"asOfVersion": "4.3.0"
},
{
"libraryName": "sentence-case",
"typingsPackageName": "sentence-case",
@@ -324,18 +504,42 @@
"sourceRepoURL": "https://github.com/andrewplummer/Sugar",
"asOfVersion": "2.0.2"
},
{
"libraryName": "svg.js",
"typingsPackageName": "svg.js",
"sourceRepoURL": "http://www.svgjs.com/",
"asOfVersion": "2.3.1"
},
{
"libraryName": "swap-case",
"typingsPackageName": "swap-case",
"sourceRepoURL": "https://github.com/blakeembrey/swap-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "Tabris.js",
"typingsPackageName": "tabris",
"sourceRepoURL": "http://tabrisjs.com",
"asOfVersion": "1.8.0"
},
{
"libraryName": "tcomb",
"typingsPackageName": "tcomb",
"sourceRepoURL": "http://gcanti.github.io/tcomb/guide/index.html",
"asOfVersion": "2.6.0"
},
{
"libraryName": "title-case",
"typingsPackageName": "title-case",
"sourceRepoURL": "https://github.com/blakeembrey/title-case",
"asOfVersion": "1.1.2"
},
{
"libraryName": "TsMonad",
"typingsPackageName": "tsmonad",
"sourceRepoURL": "https://github.com/cbowdon/TsMonad",
"asOfVersion": "0.5.0"
},
{
"libraryName": "TypeScript",
"typingsPackageName": "typescript",
@@ -348,6 +552,12 @@
"sourceRepoURL": "https://github.com/Microsoft/TypeScript",
"asOfVersion": "2.0.0"
},
{
"libraryName": "uk.co.workingedge.phonegap.plugin.istablet",
"typingsPackageName": "uk.co.workingedge.phonegap.plugin.istablet",
"sourceRepoURL": "https://github.com/dpa99c/phonegap-istablet",
"asOfVersion": "1.1.3"
},
{
"libraryName": "upper-case",
"typingsPackageName": "upper-case",
@@ -360,6 +570,12 @@
"sourceRepoURL": "https://github.com/blakeembrey/upper-case-first",
"asOfVersion": "1.1.2"
},
{
"libraryName": "vso-node-api",
"typingsPackageName": "vso-node-api",
"sourceRepoURL": "https://github.com/Microsoft/vso-node-api",
"asOfVersion": "4.0.0"
},
{
"libraryName": "vuejs",
"typingsPackageName": "vue",
@@ -372,17 +588,35 @@
"sourceRepoURL": "https://github.com/vuejs/vue-router",
"asOfVersion": "2.0.0"
},
{
"libraryName": "webcola",
"typingsPackageName": "webcola",
"sourceRepoURL": "https://github.com/tgdwyer/WebCola",
"asOfVersion": "3.2.0"
},
{
"libraryName": "x2js",
"typingsPackageName": "x2js",
"sourceRepoURL": "https://code.google.com/p/x2js/",
"asOfVersion": "3.1.0"
},
{
"libraryName": "xml-js",
"typingsPackageName": "xml-js",
"sourceRepoURL": "https://github.com/nashwaan/xml-js",
"asOfVersion": "1.0.0"
},
{
"libraryName": "@xmpp/jid",
"typingsPackageName": "xmpp-jid",
"sourceRepoURL": "github.com/node-xmpp/node-xmpp/",
"asOfVersion": "1.2.0"
},
{
"libraryName": "Zone.js",
"typingsPackageName": "zone.js",
"sourceRepoURL": "https://github.com/angular/zone.js",
"asOfVersion": "0.5.12"
}
]
}
+5 -6
View File
@@ -12,17 +12,16 @@
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"engines": {
"node": ">= 6.9.1"
"node": ">=7.8.0"
},
"scripts": {
"compile-scripts": "tsc -p scripts",
"new-package": "dts-gen --dt",
"not-needed": "node scripts/not-needed.js",
"lint": "node scripts/lint.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1"
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1",
"lint": "dtslint types"
},
"devDependencies": {
"types-publisher": "Microsoft/types-publisher#production",
"dts-gen": "latest"
"dtslint": "Microsoft/dtslint#production",
"types-publisher": "Microsoft/types-publisher#production"
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ function fixTslint(dir: string): void {
if (!fs.existsSync(target)) return;
let json = JSON.parse(fs.readFileSync(target, 'utf-8'));
json = fix(json);
const text = Object.keys(json).length === 1 ? '{ "extends": "../tslint.json" }' : JSON.stringify(json, undefined, 4);
const text = Object.keys(json).length === 1 ? '{ "extends": "dtslint/dt.json" }' : JSON.stringify(json, undefined, 4);
fs.writeFileSync(target, text + "\n", "utf-8");
}
-25
View File
@@ -1,25 +0,0 @@
// Usage: npm run lint -- my-package-name
const pkg = process.argv[2];
const execSync = require("child_process").execSync;
const existsSync = require("fs").existsSync;
const path = require("path");
const pkgPath = path.join("types", pkg);
// Path of tslint when `types-publisher` is symlinked
const symlinkedTslintPath = "../../node_modules/types-publisher/node_modules/tslint"
let tslintPath = existsSync(path.join(pkgPath, symlinkedTslintPath)) ? symlinkedTslintPath : "../node_modules/tslint";
// An older version (e.g. abs/v0) is in a nested directory, so needs to look one more level up for tslint.
if (pkg.includes("/") && pkg[pkg.length - 1] !== "/") {
tslintPath = path.join("..", tslintPath);
}
const cmd = `node ${tslintPath}/lib/tslint-cli --format stylish "**/*.ts"`;
console.log(cmd);
try {
// Child process writes directly to our own stdout
execSync(cmd, { cwd: pkgPath, stdio: "inherit" });
} catch (_) {
// Process should have printed out error info
}
+1 -1
View File
@@ -17,7 +17,7 @@ rmdirRecursive(path.join("types", typingsPackageName));
const notNeededPackages = JSON.parse(fs.readFileSync("notNeededPackages.json", "utf-8"));
notNeededPackages.packages.push({ libraryName, typingsPackageName, sourceRepoURL, asOfVersion });
notNeededPackages.packages.sort((x, y) => x.typingsPackageName < y.typingsPackageName ? -1 : 1);
fs.writeFileSync("notNeededPackages.json", JSON.stringify(notNeededPackages, undefined, 4), "utf-8");
fs.writeFileSync("notNeededPackages.json", JSON.stringify(notNeededPackages, undefined, 4) + "\n", "utf-8");
function rmdirRecursive(dir) {
for (let entry of fs.readdirSync(dir)) {
+9 -12
View File
@@ -1,6 +1,6 @@
import * as Ably from 'ably';
declare var console: { log(message: any): void };
declare const console: { log(message: any): void };
const ApiKey = 'appId.keyId:secret';
const client = new Ably.Realtime(ApiKey);
@@ -19,10 +19,9 @@ client.connection.on('failed', () => {
// failed connection
});
// Subscribing to a channel
var channel = client.channels.get('test');
const channel = client.channels.get('test');
channel.subscribe(message => {
message.name; // 'greeting'
message.data; // 'Hello World!'
@@ -68,7 +67,6 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
console.log(messagesPage.items.length);
});
// Presence on a channel
// Getting presence:
@@ -118,7 +116,7 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
// Generate a random 256-bit key for demonstration purposes (in
// practice you need to create one and distribute it to clients yourselves)
Ably.Realtime.Crypto.generateRandomKey((err, key) => {
var channel = client.channels.get('channelName', { cipher: { key } });
const channel = client.channels.get('channelName', { cipher: { key } });
channel.subscribe(message => {
message.name; // 'name is not encrypted'
@@ -136,7 +134,7 @@ channel.setOptions({cipher: {key: '<KEY>'}}, () => {
// Using the REST API
var restChannel = restClient.channels.get('test');
const restChannel = restClient.channels.get('test');
// Publishing to a channel
@@ -195,7 +193,6 @@ restChannel.presence.history((err, messagesPage) => { // PaginatedResult
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
// Generate Token and Token Request
// See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism.
@@ -206,7 +203,7 @@ client.auth.requestToken((err, tokenDetails) => {
// see https://www.ably.io/documentation/rest/authentication/#token-details for its properties
// Now we have the token, we can send it to someone who can instantiate a client with it:
var clientUsingToken = new Ably.Realtime(tokenDetails.token);
const clientUsingToken = new Ably.Realtime(tokenDetails.token);
});
// requestToken can take two optional params
@@ -242,15 +239,15 @@ client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as Paginat
client.time({}, (err, time) => {}); // time is in ms since epoch
// Getting decoded Message objects from JSON
var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
const messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
console.log(messages[0].id);
var message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
const message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
console.log(message.id);
// Getting decoded PresenceMessage objects from JSON
var presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
const presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
console.log(presenceMessages[0].action);
var presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
const presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
console.log(presenceMessage.action);
+8 -8
View File
@@ -3,7 +3,7 @@
// Definitions by: Ably <https://github.com/ably/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace ablyLib {
export namespace ablyLib {
namespace ChannelState {
type INITIALIZED = 'initialized';
type ATTACHING = 'attaching';
@@ -130,15 +130,15 @@ declare namespace ablyLib {
* A function which is called when a new token is required.
* The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically
* by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object.
**/
authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void;
*/
authCallback?(data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void): void;
authHeaders?: { [index: string]: string };
authMethod?: HTTPMethods;
authParams?: { [index: string]: string };
/**
* A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format).
**/
*/
authUrl?: string;
key?: string;
queryTime?: boolean;
@@ -259,13 +259,13 @@ declare namespace ablyLib {
/**
* A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only),
* 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output).
**/
*/
level?: number;
/**
* A function to handle each line of log output. If handler is not specified, console.log is used.
**/
handler?: (...args: any[]) => void;
*/
handler?(...args: any[]): void;
}
interface ChannelEvent {
@@ -398,7 +398,7 @@ declare namespace ablyLib {
}
interface Crypto {
generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void;
generateRandomKey(callback: (error: ErrorInfo, key: string) => void): void;
}
class Connection extends EventEmitter<connectionEventCallback> {
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
-9
View File
@@ -27,8 +27,6 @@ accounting.formatMoney(5318008, {
// Will recursively format an array of values:
accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]]
// formatColumn
// Format list of numbers for display:
@@ -40,8 +38,6 @@ accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"]
// List of numbers can be a multi-dimensional array (formatColumn is applied recursively):
accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]]
// formatNumber
// Example usage:
@@ -58,16 +54,11 @@ accounting.formatNumber(5318008, {
// Will recursively format an array of values:
accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]]
// toFixed
(0.615).toFixed(2); // "0.61"
accounting.toFixed(0.615, 2); // "0.62"
// unformat
// Example usage:
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -63,7 +63,7 @@ declare namespace acorn {
class SourceLocation implements ESTree.SourceLocation {
start: Position;
end: Position;
source?: string;
source?: string | null;
constructor(p: Parser, start: Position, end: Position);
}
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for ADAL.JS 1.0.13
// Type definitions for ADAL.JS 1.0.14
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -29,6 +29,7 @@ declare namespace adal {
loginResource?: string;
resource?: string;
extraQueryParameter?: string;
navigateToLoginRequestUrl?: boolean;
}
interface User {
+162
View File
@@ -0,0 +1,162 @@
import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
{
let expr = new Expression("x");
expr = expr.subtract(3);
expr = expr.add("x");
expr.toString();
let eq = new Equation(expr, 4);
eq.toString();
let x = eq.solveFor("x");
x.toString();
}
{
let frac = new Fraction(1, 2);
frac.toString();
frac = frac.add(new Fraction(3, 4));
frac.toString();
frac = frac.subtract(2);
frac.toString();
frac = frac.multiply(new Fraction(4, 3));
frac.toString();
frac = frac.divide(5);
frac.toString();
let x = new Expression("x");
x = x.add(3);
x.toString();
x = x.subtract(new Fraction(1, 3));
x.toString();
x = x.add("y");
x.toString();
let otherExp = new Expression("x").add(6);
x = x.add(otherExp);
x.toString();
let expr1 = new Expression("a").add("b").add("c");
let expr2 = new Expression("c").subtract("b");
let expr3 = expr1.subtract(expr2);
expr1.toString() + " - (" + expr2.toString() + ") = " + expr3.toString();
expr1 = new Expression("x");
expr1 = expr1.add(2);
expr1 = expr1.multiply(4);
expr2 = new Expression("x");
expr2 = expr2.multiply("y");
expr2 = expr2.multiply(new Fraction(1, 3));
expr2 = expr2.add(4);
expr3 = expr1.multiply(expr2);
"(" + expr1.toString() + ")(" + expr2.toString() + ") = " + expr3.toString();
x = new Expression("x").divide(2).divide(new Fraction(1, 5));
x.toString();
let exp = new Expression("x");
exp = exp.add("y");
exp = exp.add(3);
exp.toString();
let sum = exp.summation("x", 3, 6);
sum.toString();
exp = new Expression("x").add(2);
let exp3 = exp.pow(3);
"(" + exp.toString() + ")^3 = " + exp3.toString();
let expr = new Expression("x");
expr = expr.multiply(2);
expr = expr.multiply("x");
expr = expr.add("y");
expr = expr.add(new Fraction(1, 3));
expr.toString();
let answer1 = expr.eval({ x: 2 });
let answer2 = expr.eval({ x: 2, y: new Fraction(3, 4) });
answer1.toString();
answer2.toString();
expr = new Expression("x").add(2);
expr.toString();
let sub = new Expression("y").add(4);
let answer = expr.eval({ x: sub });
answer.toString();
exp = new Expression("x").add(2);
exp.toString();
exp = exp.multiply(5, false);
exp.toString();
exp = exp.simplify();
exp.toString();
exp = exp.add(5, false);
exp.toString();
exp = exp.divide(5, false);
exp.toString();
exp = exp.simplify();
exp.toString();
exp = exp.pow(2, false);
exp.toString();
exp = exp.simplify();
exp.toString();
let z = new Expression("z");
let eq1 = new Equation(z.subtract(4).divide(9), z.add(6));
eq1.toString();
let eq2 = new Equation(z.add(4).multiply(9), 6);
eq2.toString();
let eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4));
eq3.toString();
}
{
let x1 = parse("1/5 * x + 2/15");
let x2 = parse("1/7 * x + 4");
let eq = new Equation(x1 as Expression, x2 as Expression);
eq.toString();
let answer = eq.solveFor("x");
"x = " + answer.toString();
let expr1 = parse("1/4 * x + 5/4");
let expr2 = parse("3 * y - 12/5");
eq = new Equation(expr1 as Expression, expr2 as Expression);
eq.toString();
let xAnswer = eq.solveFor("x");
let yAnswer = eq.solveFor("y");
"x = " + xAnswer.toString();
"y = " + yAnswer.toString();
let n1 = parse("x + 5") as Expression;
let n2 = parse("x - 3/4") as Expression;
let quad = new Equation(n1.multiply(n2), 0);
quad.toString();
let answers = quad.solveFor("x");
"x = " + answers.toString();
n1 = parse("x + 2") as Expression;
n2 = parse("x + 3") as Expression;
let n3 = parse("x + 4") as Expression;
let cubic = new Equation(n1.multiply(n2).multiply(n3), 0);
cubic.toString();
answers = cubic.solveFor("x");
"x = " + answers.toString();
let expr = new Expression("x");
expr = expr.multiply("x");
expr = expr.add("x");
expr = expr.add("y");
eq = new Equation(expr, 3);
eq.toString();
xAnswer = eq.solveFor("x");
yAnswer = eq.solveFor("y");
"x = " + xAnswer;
"y = " + yAnswer.toString();
let exp = parse("2 * x^2 + 4 * x + 4");
exp.toString();
exp = parse("x * y + 4");
exp.toString();
}
{
let eq = parse("x^2 + 4 * x + 4 = 0") as Equation;
eq.toString();
let ans = eq.solveFor("x");
"x = " + ans.toString();
let a = new Expression("x").pow(2);
let b = new Expression("x").multiply(new Fraction(5, 4));
let c = new Fraction(-21, 4);
let expr = a.add(b).add(c);
let quad = new Equation(expr, 0);
toTex(quad);
let answers = quad.solveFor("x");
toTex(answers);
let lambda = new Expression("lambda").add(3).divide(4);
let Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda);
toTex(lambda);
toTex(Phi);
}
+62
View File
@@ -0,0 +1,62 @@
// Type definitions for algebra.js 0.2
// Project: http://algebra.js.org
// Definitions by: Federico Caselli <https://github.com/CaselIT>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
declare class Term {
coefficients: algebra.js.Fraction[];
variables: Variable[];
coefficient(): algebra.js.Fraction;
toString(): string;
}
declare class Variable {
variable: string;
toString(): string;
}
type Union = string | number | algebra.js.Fraction | Term;
declare namespace algebra.js {
function parse(input: string): Equation | Expression;
function toTex(input: Fraction | Expression | Equation | object | Array<Fraction | object>): string;
class Equation {
lhs: Expression;
rhs: Expression;
constructor(lhs: Expression, rhs: Expression | Fraction | number)
solveFor(variable: string): Fraction | Fraction[] | number[];
toString(): string;
}
class Expression {
constants: Fraction[];
terms: Term[];
constructor(variable: Union | undefined)
add(other: Union | Expression, simplify?: boolean): Expression;
divide(other: Fraction | number, simplify?: boolean): Expression;
eval(p: object, simplify?: boolean): Expression;
multiply(other: Union | Expression, simplify?: boolean): Expression;
pow(p: number, simplify?: boolean): Expression;
constant(): Fraction;
simplify(): Expression;
subtract(other: Union | Expression, simplify?: boolean): Expression;
summation(variable: string, lower: number, upper: number, simplify?: boolean): Expression;
toString(): string;
}
class Fraction {
denom: number;
numer: number;
constructor(num: number, denom: number)
abs(): Fraction;
add(other: Fraction | number, simplify?: boolean): Fraction;
divide(other: Fraction | number, simplify?: boolean): Fraction;
multiply(other: Fraction | number, simplify?: boolean): Fraction;
subtract(other: Fraction | number, simplify?: boolean): Fraction;
toString(): string;
valueOf(): number;
}
}
export = algebra.js;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"algebra.js-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -109,7 +109,7 @@ declare namespace AltJS {
flush():Object;
recycle( ...stores:Array<AltJS.AltStore<any>>):void;
rollback():void;
dispatch(action?:AltJS.Action<any>, data?:Object, details?:any):void;
dispatch(action?:AltJS.Action<any>|string, data?:Object, details?:any):void;
//Actions methods
addActions(actionsName:string, ActionsClass: ActionsClassConstructor):void;
+2 -2
View File
@@ -1,6 +1,6 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"forbidden-types": false
"ban-types": false
}
}
+14 -23
View File
@@ -16,7 +16,6 @@ amplify.subscribe("dataexample", data => {
alert(data.foo); // bar
});
amplify.publish("dataexample", { foo: "bar" });
amplify.subscribe("dataexample2", (param1, param2) => {
@@ -47,7 +46,6 @@ amplify.subscribe("priorityexample", data => {
}
}, 1);
// Store data with amplify storage picking the default storage technology:
amplify.publish("priorityexample", { foo: "bar" });
@@ -56,9 +54,9 @@ amplify.publish("priorityexample", { foo: "oops" });
amplify.store("storeExample1", { foo: "bar" });
amplify.store("storeExample2", "baz");
// retrieve the data later via the key
var myStoredValue = amplify.store("storeExample1"),
myStoredValue2 = amplify.store("storeExample2"),
myStoredValues = amplify.store();
const myStoredValue = amplify.store("storeExample1");
let myStoredValue2 = amplify.store("storeExample2");
const myStoredValues = amplify.store();
myStoredValue.foo; // bar
myStoredValue2; // baz
myStoredValues.storeExample1.foo; // bar
@@ -68,15 +66,13 @@ myStoredValues.storeExample2; // baz
amplify.store.sessionStorage("explicitExample", { foo2: "baz" });
// retrieve the data later via the key
var myStoredValue2 = amplify.store.sessionStorage("explicitExample");
myStoredValue2 = amplify.store.sessionStorage("explicitExample");
myStoredValue2.foo2; // baz
// REQUEST
// Set up and use a request utilizing Ajax
amplify.request.define("ajaxExample1", "ajax", {
url: "/myApiUrl",
dataType: "json",
@@ -159,15 +155,11 @@ amplify.request("twitter-search", { term: "amplifyjs" } );
// Similarly, we can create a request that searches for mentions, by accepting a username:
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: data => {
return {
q: "@" + data.user
};
}
});
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: data => ({ q: "@" + data.user }),
});
amplify.request("twitter-mentions", { user: "amplifyjs" });
@@ -175,7 +167,7 @@ amplify.request("twitter-mentions", { user: "amplifyjs" });
// Example:
var appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => {
const appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
@@ -197,7 +189,6 @@ amplify.request.decoders.appEnvelope = appEnvelopeDecoder;
// but you can also just add it via an index
amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder;
amplify.request.define("decoderExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
@@ -246,11 +237,11 @@ amplify.request({
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
amplify.request.define("statusExample1", "ajax", {
// ...
});
amplify.request.define("statusExample1", "ajax", {
// ...
});
amplify.request({
amplify.request({
resourceId: "statusExample1",
success: (data, status) => {
},
+2 -2
View File
@@ -9,8 +9,8 @@ declare namespace amplify {
interface RequestSettings {
resourceId: string;
data?: any;
success?: (...args: any[]) => void;
error?: (...args: any[]) => void;
success?(...args: any[]): void;
error?(...args: any[]): void;
}
type Decoder =
+2 -2
View File
@@ -1,7 +1,7 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"forbidden-types": false,
"ban-types": false,
"unified-signatures": false
}
}
+7 -8
View File
@@ -1,7 +1,7 @@
// promise api tests
import amqp = require('amqplib');
var msg = 'Hello World';
const msg = 'Hello World';
// test promise api
amqp.connect('amqp://localhost')
@@ -21,11 +21,10 @@ amqp.connect('amqp://localhost')
});
// test promise api properties
var amqpMessage: amqp.Message;
let amqpMessage: amqp.Message;
amqpMessage.properties.contentType = 'application/json';
var amqpAssertExchangeOptions: amqp.Options.AssertExchange;
var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
let amqpAssertExchangeOptions: amqp.Options.AssertExchange;
let anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
// callback api tests
import amqpcb = require('amqplib/callback_api');
@@ -59,7 +58,7 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
});
// test callback api properties
var amqpcbMessage: amqpcb.Message;
let amqpcbMessage: amqpcb.Message;
amqpcbMessage.properties.contentType = 'application/json';
var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
+1 -1
View File
@@ -1,5 +1,5 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"no-empty-interface": false
}
@@ -0,0 +1,41 @@
let app: angular.IModule = angular.module('at', ['blockUI']);
app.config((blockUIConfig: angular.blockUI.BlockUIConfig) => {
blockUIConfig.message = 'Please stop clicking!';
blockUIConfig.delay = 100;
blockUIConfig.template = '<pre><code>{{ state | json }}</code></pre>';
blockUIConfig.templateUrl = 'my-templates/block-ui-overlay.html';
blockUIConfig.autoBlock = false;
blockUIConfig.resetOnException = false;
blockUIConfig.autoInjectBodyBlock = false;
blockUIConfig.cssClass = 'block-ui my-custom-class';
blockUIConfig.blockBrowserNavigation = true;
blockUIConfig.requestFilter = (config) => {
if (config.url.match(/^\/api\/quote($|\/).*/)) {
return false;
}
return true;
};
blockUIConfig.requestFilter = (config) => {
if (config.url.match(/^\/api\/quote($|\/).*/)) {
return 'Hello World';
}
return 'Loading...';
};
});
app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIService) => {
blockUI.start();
blockUI.start('Hello');
blockUI.start({});
blockUI.start({message: 'World'});
blockUI.start({delay: 100});
blockUI.stop();
blockUI.reset();
blockUI.message("Hello Types");
blockUI.done();
let b: boolean = blockUI.isBlocking();
});
+168
View File
@@ -0,0 +1,168 @@
// Type definitions for angular-block-ui 0.2
// Project: https://github.com/McNull/angular-block-ui
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as angular from "angular";
declare module 'angular' {
namespace blockUI {
interface BlockUIConfig {
/**
* Changes the default message to be used when no message
* has been provided to the start method of the service.
*
* Default value is 'Loading ...'.
*/
message?: string;
/**
* Specifies the amount in milliseconds before the block
* is visible to the user. By delaying a visible block your
* application will appear more responsive.
*
* The default value is 250.
*/
delay?: number;
/**
* Specifies a custom template to use as the overlay.
*/
template?: string;
/**
* Specifies a url to retrieve the template from.
* The current release only works with pre-cached templates,
* which means that this url should be known in the
* $templateCache service of Angular.
*
* If you're using the grunt with html2js or angular-templates,
* which I highly recommend, you're already set.
*/
templateUrl?: string;
/**
* By default the BlockUI module will start a block whenever
* the Angular $http service has an pending request.
*
* If you don't want this behaviour and want to do all the
* blocking manually you can change this value to false.
*/
autoBlock?: boolean;
/**
* By default the BlockUI module will reset the block count and
* hide the overlay whenever an exception has occurred.
*
* You can set this value to false if you don't want this behaviour.
*/
resetOnException?: boolean;
/**
* Allows you to specify a filter function to exclude certain ajax
* requests from blocking the user interface.
* The blockUI service will ignore requests when the function returns `false`.
*
* If the filter function returns a string it will be passed as the message
* argument to the start method of the service.
*
* @param {angular.IRequestConfig} config - the Angular request config object.
*
*/
requestFilter?(config: angular.IRequestConfig): (string | boolean);
/**
* When the module is started it will inject the main block element
* by adding the block-ui directive to the body element.
*/
autoInjectBodyBlock?: boolean;
/**
* A string containing the default css classes, separated by spaces,
* that should be applied to each block-ui element.
*
* The default value is `block-ui block-ui-anim-fade`
*/
cssClass?: string;
/**
* Whenever a user interface block is active, because the single page
* application is still waiting for a response from the backend server,
* the user can still navigate away using the back and forward buttons
* of the browser.
*
* Callbacks registered to handle the responses from the server will
* be executed even if a different view/controller is currently active.
* By setting the blockBrowserNavigation property to true the
* angular-block-ui module will prevent navigation while a fullscreen
* block is active.
*
* Programatic location changes via the $location service are still
* allowed however.
* The navigation block is disabled by default.
*/
blockBrowserNavigation?: boolean;
}
interface BlockUIService {
/**
* The start method will start the user interface block.
* Because multiple user interface elements can request
* a user interface block at the same time, the service
* keeps track of the number of start calls.
*
* Each call to start() will increase the count and every
* call to stop() will decrease the value.
* Whenever the count reaches 0 the block will end.
*
* Note: By default the block is immediately active after
* calling this method, but to prevent trashing the user
* interface each time a button is pressed, the block is
* visible after a short delay.
*
* This behaviour can be modified in the configuration.
*
* @param {string|IBlockUIConfig} messageOrOptions -
* Either supply the message (string) to be show in the
* overlay or specify an IBlockUIConfig object that will be
* merged/extended into the block ui instance state.
* If no argument is specified the default text message
* from the configuration is used.
*/
start(messageOrOptions?: (string | BlockUIConfig)): void;
/**
* This will decrease the block count.
*
* The block will end if the count is 0.
*/
stop(): void;
/**
* The reset will force an unblock by setting the block count to 0.
*/
reset(): void;
/**
* Queues a callback function to be called when the block has finished.
*
* This can be useful whenever you wish to redirect the user
* to a different location while there are still pending AJAX requests.
*/
done(): void;
/**
* Allows the message shown in the overlay to be updated
* while to block is active.
*
* @param {string} message - The message to show in the overlay.
*/
message(message: string): void;
/**
* Returns whether currently a block is shown for the instance or not.
*/
isBlocking(): boolean;
}
}
}
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"uk.co.workingedge.phonegap.plugin.istablet-tests.ts"
"angular-block-ui-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+46 -52
View File
@@ -1,61 +1,55 @@
// Configuring angular-gettext
// https://angular-gettext.rocketeer.be/dev-guide/configure/
//Setting the language
angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) {
gettextCatalog.setCurrentLanguage('nl');
});
//Highlighting untranslated strings
angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) {
gettextCatalog.debug = true;
});
namespace angular_gettext_tests {
// Marking strings in JavaScript code as translatable.
// https://angular-gettext.rocketeer.be/dev-guide/annotate-js/
angular.module("myApp").controller("helloController", function (gettext: angular.gettext.gettextFunction) {
var myString = gettext("Hello");
});
//Translating directly in JavaScript.
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var translated: string = gettextCatalog.getString("Hello");
});
// Configuring angular-gettext
// https://angular-gettext.rocketeer.be/dev-guide/configure/
//Setting the language
angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) {
gettextCatalog.setCurrentLanguage('nl');
});
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds");
});
//Highlighting untranslated strings
angular.module('myApp').run(function (gettextCatalog: angular.gettext.gettextCatalog) {
gettextCatalog.debug = true;
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" });
});
// Setting strings manually
// https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/
angular.module("myApp").run(function (gettextCatalog: angular.gettext.gettextCatalog) {
// Load the strings automatically during initialization.
gettextCatalog.setStrings("nl", {
"Hello": "Hallo",
"One boat": ["Een boot", "{{$count}} boats"]
});
});
// Marking strings in JavaScript code as translatable.
// https://angular-gettext.rocketeer.be/dev-guide/annotate-js/
angular.module("myApp").controller("helloController", function (gettext: angular.gettext.gettextFunction) {
var myString = gettext("Hello");
});
//Translating directly in JavaScript.
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var translated: string = gettextCatalog.getString("Hello");
});
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var myString2: string = gettextCatalog.getPlural(3, "Bird", "Birds");
});
angular.module("myApp").controller("helloController", function (gettextCatalog: angular.gettext.gettextCatalog) {
var translated: string = gettextCatalog.getString("Hello {{name}}", { name: "Ruben" });
});
// Setting strings manually
// https://angular-gettext.rocketeer.be/dev-guide/manual-setstrings/
angular.module("myApp").run(function (gettextCatalog: angular.gettext.gettextCatalog) {
// Load the strings automatically during initialization.
gettextCatalog.setStrings("nl", {
"Hello": "Hallo",
"One boat": ["Een boot", "{{$count}} boats"]
});
});
interface helloControllerScope extends ng.IScope {
switchLanguage: (lang: string) => void;
}
// Lazy-loading languages
// https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/
angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular.gettext.gettextCatalog) {
$scope.switchLanguage = function (lang: string) {
gettextCatalog.setCurrentLanguage(lang);
gettextCatalog.loadRemote("/languages/" + lang + ".json");
};
});
interface helloControllerScope extends ng.IScope {
switchLanguage: (lang: string) => void;
}
// Lazy-loading languages
// https://angular-gettext.rocketeer.be/dev-guide/lazy-loading/
angular.module("myApp").controller("helloController", function ($scope: helloControllerScope, gettextCatalog: angular.gettext.gettextCatalog) {
$scope.switchLanguage = function (lang: string) {
gettextCatalog.setCurrentLanguage(lang);
gettextCatalog.loadRemote("/languages/" + lang + ".json");
};
});
@@ -3,11 +3,10 @@ import * as angular from "angular";
import gridster from "angular-gridster";
var myApp = angular.module("testModule", ["gridster"]);
const myApp = angular.module("testModule", ["gridster"]);
// configure gridster's global options
myApp.run(["gridsterConfig", (gridsterConfig: angular.gridster.GridsterConfig) => {
gridsterConfig.mobileBreakPoint = 697;
gridsterConfig.colWidth = "100";
gridsterConfig.rowHeight = "100";
@@ -24,4 +23,4 @@ myApp.run(["gridsterConfig", (gridsterConfig: angular.gridster.GridsterConfig) =
gridsterConfig.resizable = { enabled: true,
handles: ["n", "s", "e", "w", "ne", "se", "sw", "nw"]};
}
]);
]);
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+55
View File
@@ -0,0 +1,55 @@
## What is it?
This is a typescript interface to be used with [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys/).
## What are declaration files?
See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
## How do I get them?
### npm
This is the preferred method. This is only available for TypeScript 2.0+ users. For these typings:
```sh
npm install --save-dev @types/angular-hotkeys
```
The types should then be automatically included by the compiler.
See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
### Other methods
These can be used by TypeScript 1.0.
* [Typings](https://github.com/typings/typings)
* ~~[NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)~~ (use preferred alternatives, nuget DT type publishing has been turned off)
* Manually download from the `master` branch of this repository
You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
## How to use
After installing a package you can import the definition file and begin using it as so:
```ts
import * as hotkeys from '../../node_modules/@types/angular-hotkeys'
class FooController {
static $inject = [
'hotkeys'
];
constructor(
private hotkeys: ng.hotkeys.HotkeysProvider
) { }
}
```
for a detailed explanation of the behavior of angular-hotkeys please refer to [its documentation](https://github.com/chieffancypants/angular-hotkeys/)
+2
View File
@@ -2,6 +2,8 @@
// Project: https://github.com/chieffancypants/angular-hotkeys
// Definitions by: Jason Zhao <https://github.com/jlz27>, Stefan Steinhart <https://github.com/reppners>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//readme written by David Valentine <https://github.com/dvalenti314/>
/// <reference types="angular" />
+20 -19
View File
@@ -1,4 +1,4 @@
// Type definitions for angular-local-storage v0.1.5
// Type definitions for angular-local-storage v0.1.6
// Project: https://github.com/grevory/angular-local-storage
// Definitions by: Ken Fukuyama <https://github.com/kenfdev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -60,19 +60,19 @@ declare module 'angular' {
*/
set(key: string, val: string): boolean;
/**
* Directly adds a value to cookies with an expiration.
* Note: Typically used as a fallback if local storage is not supported.
* Returns: Boolean
* @param key
* @param val
* @param daysToExpiry
*/
* Directly adds a value to cookies with an expiration.
* Note: Typically used as a fallback if local storage is not supported.
* Returns: Boolean
* @param key
* @param val
* @param daysToExpiry
*/
set(key: string, val: string, daysToExpiry: number): boolean;
/**
* Directly get a value from a cookie.
* Returns: value from local storage
* @param key
*/
* Directly get a value from a cookie.
* Returns: value from local storage
* @param key
*/
get(key: string): string;
/**
* Remove directly value from a cookie.
@@ -84,8 +84,9 @@ declare module 'angular' {
* Remove all data for this app from cookie.
*/
clearAll(): any;
}
type StorageType = 'localStorage' | 'sessionStorage';
interface ILocalStorageService {
/**
@@ -104,19 +105,19 @@ declare module 'angular' {
* @param key
* @param value
*/
set<T>(key: string, value: T): boolean;
set<T>(key: string, value: T, storageType?: StorageType): boolean;
/**
* Directly get a value from local storage.
* If local storage is not supported, use cookies instead.
* Returns: value from local storage
* @param key
*/
get<T>(key: string): T;
get<T>(key: string, storageType?: StorageType): T;
/**
* Return array of keys for local storage, ignore keys that not owned.
* Returns: value from local storage
*/
keys(): string[];
keys(storageType?: StorageType): string[];
/**
* Remove an item from local storage by key.
* If local storage is not supported, use cookies instead.
@@ -131,7 +132,7 @@ declare module 'angular' {
* Returns: Boolean
* @param regularExpression
*/
clearAll(regularExpression?: RegExp): boolean;
clearAll(regularExpression?: RegExp, storageType?: StorageType): boolean;
/**
* Bind $scope key to localStorageService.
* Usage: localStorageService.bind(scope, property, value[optional], key[optional])
@@ -141,7 +142,7 @@ declare module 'angular' {
* @param value optional
* @param key The corresponding key used in local storage
*/
bind(scope: angular.IScope, property: string, value?: any, key?: string): Function;
bind(scope: angular.IScope, property: string, value?: any, key?: string, storageType?: StorageType): Function;
/**
* Return the derive key
* Returns String
@@ -152,7 +153,7 @@ declare module 'angular' {
* Return localStorageService.length, ignore keys that not owned.
* Returns Number
*/
length(): number;
length(storageType?: StorageType): number;
/**
* Deal with browser's cookies directly.
*/
+140 -39
View File
@@ -1,15 +1,12 @@
var myApp = angular.module('testModule', ['ngMaterial']);
const myApp = angular.module('testModule', ['ngMaterial']);
myApp.config((
$mdThemingProvider: ng.material.IThemingProvider,
$mdIconProvider: ng.material.IIconProvider,
$mdProgressCircularProvider: ng.material.IProgressCircularProvider) => {
$mdThemingProvider.alwaysWatchTheme(true);
var neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', {
'500': 'ff0000'
const neonRedMap: ng.material.IPalette = $mdThemingProvider.extendPalette('red', {
500: 'ff0000'
});
// Register the new color palette map with the name <code>neonRed</code>
$mdThemingProvider.definePalette('neonRed', neonRedMap);
@@ -21,12 +18,13 @@ myApp.config((
.warnPalette('red')
.dark(true);
var browserColors: ng.material.IBrowserColors = {
theme: 'default',
palette: 'neonRed',
hue: '500'
const browserColors: ng.material.IBrowserColors = {
theme: 'default',
palette: 'neonRed',
hue: '500'
};
$mdThemingProvider.enableBrowserColor(browserColors);
const removeColors = $mdThemingProvider.enableBrowserColor(browserColors);
removeColors();
// Disable theming generation at runtime
$mdThemingProvider.disableTheming();
@@ -41,44 +39,67 @@ myApp.config((
$mdProgressCircularProvider.configure({
progressSize: 100,
strokeWidth: 20,
duration: 800
duration: 800,
easeFn(t, b, c, d) {
t /= d;
return c * t * t + b;
},
easeFnIndeterminate(t, b, c, d) {
return c * Math.pow(2, 10 * (t / d - 1)) + b;
}
});
});
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService) => {
myApp.controller('BottomSheetController', ($scope: ng.IScope, $mdBottomSheet: ng.material.IBottomSheetService, $q: ng.IQService) => {
$scope['openBottomSheet'] = () => {
$mdBottomSheet.show({
template: '<md-bottom-sheet>Hello!</md-bottom-sheet>',
clickOutsideToClose: true,
disableBackdrop: true,
disableParentScroll: false,
parent: () => {}
});
const options: ng.material.IBottomSheetOptions = {};
options.resolve = {
nativePromise: () => Promise.resolve(),
angularPromise: () => $q.resolve(),
annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()],
annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()]
};
options.controller = 'TestController';
options.controller = (function TestController(param: any) { });
options.controller = (class { });
options.controller = ['fakeService', function TestController(fake: any) { }];
options.controller = ['fakeService', class { }];
options.parent = (scope, element) => new Element();
options.parent = (scope, element) => angular.element(new Element());
options.parent = '#container';
options.parent = new Element();
options.parent = angular.element(new Element());
};
$scope['hideBottomSheet'] = $mdBottomSheet.hide.bind($mdBottomSheet, 'hide');
$scope['cancelBottomSheet'] = $mdBottomSheet.cancel.bind($mdBottomSheet, 'cancel');
});
myApp.controller('ColorController', ($scope: ng.IScope, $mdColor: ng.material.IColorService) => {
var colorExpression : ng.material.IColorExpression;
var element : Element;
colorExpression = { color: '#FFFFFF' }
element = new Element();
const colorExpression: ng.material.IColorExpression = { color: '#FFFFFF' };
const element: Element = new Element();
$scope['applyThemeColors'] = () => {
$mdColor.applyThemeColors(element, colorExpression);
};
$scope['getThemeColor'] = () => {
$mdColor.getThemeColor('default-neonRed')
$mdColor.getThemeColor('default-neonRed');
};
$scope['hasTheme'] = () => {
$mdColor.hasTheme();
};
});
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService) => {
myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.IDialogService, $q: ng.IQService) => {
$scope['openDialog'] = () => {
$mdDialog.show({
template: '<md-dialog>Hello!</md-dialog>'
@@ -120,16 +141,56 @@ myApp.controller('DialogController', ($scope: ng.IScope, $mdDialog: ng.material.
};
$scope['hideDialog'] = $mdDialog.hide.bind($mdDialog, 'hide');
$scope['cancelDialog'] = $mdDialog.cancel.bind($mdDialog, 'cancel');
const alertPreset: ng.material.IAlertDialog = $mdDialog.alert()
.resolve({
nativePromise: () => Promise.resolve(),
angularPromise: () => $q.resolve(),
annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()],
annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()]
})
.controller('TestController')
.controller(function TestController(param) { })
.controller(class { })
.controller(['fakeService', function TestController(fake) { }])
.controller(['fakeService', class { }])
;
const dialogOptions: ng.material.IDialogOptions = {};
dialogOptions.resolve = {
nativePromise: () => Promise.resolve(),
angularPromise: () => $q.resolve(),
annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()],
annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()]
};
dialogOptions.controller = 'TestController';
dialogOptions.controller = (function TestController(param) { });
dialogOptions.controller = (class { });
dialogOptions.controller = ['fakeService', function TestController(fake) { }];
dialogOptions.controller = ['fakeService', class { }];
$mdDialog.show({
onShowing(scope, element) { },
onComplete(scope, element) { },
onRemoving(element, removePromise) { },
});
$mdDialog.show({
onShowing: (scope, element) => { },
onComplete: (scope, element) => { },
onRemoving: (element, removePromise) => { },
});
});
class IconDirective implements ng.IDirective {
private $mdIcon: ng.material.IIcon;
constructor($mdIcon: ng.material.IIcon) {
this.$mdIcon = $mdIcon;
}
public link($scope: ng.IScope, $elm: ng.IAugmentedJQuery) {
link($scope: ng.IScope, $elm: ng.IAugmentedJQuery) {
this.$mdIcon('android').then((iconEl: Element) => $elm.append(iconEl));
this.$mdIcon('work:chair').then((iconEl: Element) => $elm.append(iconEl));
// Load and cache the external SVG using a URL
@@ -150,7 +211,7 @@ myApp.controller('MediaController', ($scope: ng.IScope, $mdMedia: ng.material.IM
});
myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.material.ISidenavService) => {
var componentId = 'left';
const componentId = 'left';
$scope['toggle'] = () => $mdSidenav(componentId).toggle();
$scope['open'] = () => $mdSidenav(componentId).open();
$scope['close'] = () => $mdSidenav(componentId).close();
@@ -165,41 +226,81 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
instance.isLockedOpen();
});
$scope['onClose'] = $mdSidenav(componentId).onClose(() => {});
$scope['onClose'] = $mdSidenav(componentId).onClose(() => { });
});
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService, $q: ng.IQService) => {
$scope['openToast'] = () => {
$mdToast.show($mdToast.simple().textContent('Hello!'));
$mdToast.updateTextContent('New Content');
}
};
$scope['customToast'] = () => {
var options = {
const options: ng.material.IToastOptions = {
hideDelay: 3000,
position: 'top right',
controller : 'ToastCtrl',
templateUrl : 'toast-template.html',
toastClass: 'my-class'
controller: 'ToastCtrl',
templateUrl: 'toast-template.html',
toastClass: 'my-class',
resolve: {
nativePromise: () => Promise.resolve(),
angularPromise: () => $q.resolve(),
annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()],
annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()]
}
};
options.controller = 'TestController';
options.controller = (function TestController(param) { });
options.controller = (class { });
options.controller = ['fakeService', function TestController(fake) { }];
options.controller = ['fakeService', class { }];
$mdToast.show(options);
}
};
});
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService) => {
myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IPanelService, $q: ng.IQService) => {
$scope['createPanel'] = () => {
var config = {
const config: ng.material.IPanelConfig = {
id: 'myPanel',
template: '<h1>Hello!</h1>',
hasBackdrop: true,
disableParentScroll: true,
zIndex: 150
zIndex: 150,
resolve: {
nativePromise: () => Promise.resolve(),
angularPromise: () => $q.resolve(),
annotatedNativePromise: ['fakeService', (fake) => Promise.resolve()],
annotatedAngularPromise: ['fakeService', (fake) => $q.resolve()]
}
};
config.controller = 'TestController';
config.controller = (function TestController(param) { });
config.controller = (class { });
config.controller = ['fakeService', function TestController(fake) { }];
config.controller = ['fakeService', class { }];
config.onDomAdded = (paneRef) => Promise.resolve();
config.onDomAdded = () => $q.reject();
config.onDomAdded = () => { };
config.onOpenComplete = (paneRef) => Promise.resolve();
config.onOpenComplete = () => $q.reject();
config.onOpenComplete = () => { };
config.onRemoving = (paneRef) => Promise.resolve();
config.onRemoving = () => $q.reject();
config.onRemoving = () => { };
config.onDomRemoved = (paneRef) => Promise.resolve();
config.onDomRemoved = () => $q.reject();
config.onDomRemoved = () => { };
$mdPanel.create(config);
var panelRef = $mdPanel.create(config);
let panelRef = $mdPanel.create(config);
panelRef.open()
.then((ref: ng.material.IPanelRef) => {
ref.addClass('foo');
@@ -232,6 +333,6 @@ myApp.controller('PanelController', ($scope: ng.IScope, $mdPanel: ng.material.IP
$scope['newPanelAnimation'] = () => {
$mdPanel.newPanelAnimation().openFrom('.some-target');
$mdPanel.newPanelAnimation().openFrom({top: 0, left: 0});
$mdPanel.newPanelAnimation().openFrom({ top: 0, left: 0 });
};
});
+35 -34
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular Material (angular.material module) 1.1
// Type definitions for angular-material 1.1
// Project: https://github.com/angular/material
// Definitions by: Blake Bigelow <https://github.com/blbigelow>, Peter Hajdu <https://github.com/PeterHajdu>, Davide Donadello <https://github.com/Dona278>, Geert Jansen <https://github.com/geertjansen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -9,21 +9,25 @@ declare var _: string;
export = _;
declare module 'angular' {
export namespace material {
namespace material {
interface ResolveObject {
[name: string]: Injectable<(...args: any[]) => PromiseLike<any>>;
}
interface IBottomSheetOptions {
templateUrl?: string;
template?: string;
scope?: angular.IScope; // default: new child scope
preserveScope?: boolean; // default: false
controller?: string | Function;
controller?: string | Injectable<IControllerConstructor>;
locals?: { [index: string]: any };
clickOutsideToClose?: boolean;
bindToController?: boolean; // default: false
disableBackdrop?: boolean;
escapeToClose?: boolean;
resolve?: { [index: string]: () => angular.IPromise<any> };
resolve?: ResolveObject;
controllerAs?: string;
parent?: Function | string | Object; // default: root node
parent?: ((scope: angular.IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node
disableParentScroll?: boolean; // default: true
}
@@ -49,16 +53,16 @@ declare module 'angular' {
clickOutsideToClose(clickOutsideToClose?: boolean): T; // default: false
escapeToClose(escapeToClose?: boolean): T; // default: true
focusOnOpen(focusOnOpen?: boolean): T; // default: true
controller(controller?: string | Function): T;
controller(controller?: string | Injectable<IControllerConstructor>): T;
locals(locals?: { [index: string]: any }): T;
bindToController(bindToController?: boolean): T; // default: false
resolve(resolve?: { [index: string]: () => angular.IPromise<any> }): T;
resolve(resolve?: ResolveObject): T;
controllerAs(controllerAs?: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
onComplete(onComplete?: Function): T;
ariaLabel(ariaLabel: string): T;
}
// tslint:disable-next-line no-empty-interface
interface IAlertDialog extends IPresetDialog<IAlertDialog> {
}
@@ -97,15 +101,15 @@ declare module 'angular' {
clickOutsideToClose?: boolean; // default: false
escapeToClose?: boolean; // default: true
focusOnOpen?: boolean; // default: true
controller?: string | Function;
controller?: string | Injectable<IControllerConstructor>;
locals?: { [index: string]: any };
bindToController?: boolean; // default: false
resolve?: { [index: string]: () => angular.IPromise<any> }
resolve?: ResolveObject;
controllerAs?: string;
parent?: string | Element | JQuery; // default: root node
onShowing?: Function;
onComplete?: Function;
onRemoving?: Function;
onShowing?(scope: angular.IScope, element: JQuery): void;
onComplete?(scope: angular.IScope, element: JQuery): void;
onRemoving?(element: JQuery, removePromise: angular.IPromise<any>): void;
skipHide?: boolean;
multiple?: boolean;
fullscreen?: boolean; // default: false
@@ -120,9 +124,7 @@ declare module 'angular' {
cancel(response?: any): void;
}
interface IIcon {
(id: string): angular.IPromise<Element>; // id is a unique ID or URL
}
type IIcon = (id: string) => angular.IPromise<Element>; // id is a unique ID or URL
interface IIconProvider {
icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24
@@ -132,9 +134,7 @@ declare module 'angular' {
defaultFontSet(name: string): IIconProvider;
}
interface IMedia {
(media: string): boolean;
}
type IMedia = (media: string) => boolean;
interface ISidenavObject {
toggle(): angular.IPromise<void>;
@@ -142,7 +142,7 @@ declare module 'angular' {
close(): angular.IPromise<void>;
isOpen(): boolean;
isLockedOpen(): boolean;
onClose(onClose: Function): void;
onClose(onClose: () => void): void;
}
interface ISidenavService {
@@ -163,6 +163,7 @@ declare module 'angular' {
toastClass(toastClass: string): T;
}
// tslint:disable-next-line no-empty-interface
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
}
@@ -175,10 +176,10 @@ declare module 'angular' {
hideDelay?: number | false; // default (ms): 3000
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
toastClass?: string;
controller?: string | Function;
controller?: string | Injectable<IControllerConstructor>;
locals?: { [index: string]: any };
bindToController?: boolean; // default: false
resolve?: { [index: string]: () => angular.IPromise<any> }
resolve?: ResolveObject;
controllerAs?: string;
parent?: string | Element | JQuery; // default: root node
}
@@ -263,19 +264,19 @@ declare module 'angular' {
interface IThemeConfig {
disableTheming: boolean;
generateOnDemand: boolean;
generateOnDemand: boolean;
nonce: string;
defaultTheme: string;
alwaysWatchTheme: boolean;
registeredStyles: Array<string>;
registeredStyles: string[];
}
interface IThemingProvider {
alwaysWatchTheme(alwaysWatch: boolean): void;
definePalette(name: string, palette: IPalette): IThemingProvider;
enableBrowserColor(browserColors: IBrowserColors): Function;
enableBrowserColor(browserColors: IBrowserColors): () => void;
extendPalette(name: string, palette: IPalette): IPalette;
registerStyles(styles: String): void;
registerStyles(styles: string): void;
setDefaultTheme(theme: string): void;
setNonce(nonce: string): void;
theme(name: string, inheritFrom?: string): ITheme;
@@ -328,11 +329,11 @@ declare module 'angular' {
id?: string;
template?: string;
templateUrl?: string;
controller?: string | Function;
controller?: string | Injectable<IControllerConstructor>;
controllerAs?: string;
bindToController?: boolean; // default: true
locals?: { [index: string]: any };
resolve?: { [index: string]: () => angular.IPromise<any> }
resolve?: ResolveObject;
attachTo?: string | JQuery | Element;
propagateContainerEvents?: boolean;
panelClass?: string;
@@ -346,10 +347,10 @@ declare module 'angular' {
animation?: IPanelAnimation;
hasBackdrop?: boolean; // default: false
disableParentScroll?: boolean; // default: false
onDomAdded?: Function;
onOpenComplete?: Function;
onRemoving?: Function;
onDomRemoved?: Function;
onDomAdded?(...args: any[]): PromiseLike<void> | void;
onOpenComplete?(...args: any[]): PromiseLike<void> | void;
onRemoving?(...args: any[]): PromiseLike<void> | void;
onDomRemoved?(...args: any[]): PromiseLike<void> | void;
origin?: string | JQuery | Element;
onCloseSuccess?: ((panel: IPanelRef, closeReason: string) => any);
}
@@ -442,11 +443,11 @@ declare module 'angular' {
progressSize?: number;
strokeWidth?: number;
duration?: number;
easeFn?: Function;
easeFn?(t: number, b: number, c: number, d: number): number;
durationIndeterminate?: number;
startIndeterminate?: number;
endIndeterminate?: number;
easeFnIndeterminate?: Function;
easeFnIndeterminate?(t: number, b: number, c: number, d: number): number;
}
interface IProgressCircularProvider {
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"interface-name": false,
"max-line-length": false
}
}
+1 -1
View File
@@ -7,4 +7,4 @@ angular.module('angular-oauth2-test', ['angular-oauth2'])
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET' // optional
});
}]);
}]);
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
@@ -1,7 +1,7 @@
angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
($q: angular.IQService, promiseTracker: angular.promisetracker.PromiseTrackerService) => {
const trackerWithoutOptions = promiseTracker();
const options = {
activationDelay: 10,
minDuration: 500
@@ -17,4 +17,6 @@ angular.module('promise-tracker-tests', []).run(['$q', 'promiseTracker',
const promiseToAdd = $q.defer().promise;
const addedPromise: angular.IDeferred<void> = trackerWithOptions.addPromise(promiseToAdd);
const trackerWithSomeOptions = promiseTracker({activationDelay: 500});
}]);
+2 -2
View File
@@ -10,8 +10,8 @@ import * as angular from 'angular';
declare module 'angular' {
export namespace promisetracker {
interface PromiseTrackerOptions {
activationDelay: number;
minDuration: number;
activationDelay?: number;
minDuration?: number;
}
interface PromiseTracker {
@@ -1,74 +1,72 @@
angular
.module('app', ['SignalR'])
.factory('Employees', ngSignalrTest.EmployeesFactory);
class EmployeesFactory {
static $inject = ['$rootScope', 'Hub', '$timeout'];
private hub: ngSignalr.Hub;
public all: Array<Employee>;
namespace ngSignalrTest {
export class EmployeesFactory {
static $inject = ['$rootScope', 'Hub', '$timeout'];
private hub: ngSignalr.Hub;
public all: Array<Employee>;
constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) {
// declaring the hub connection
this.hub = new Hub('employee', {
// client-side methods
listeners: {
'lockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = true;
$rootScope.$apply();
},
'unlockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = false;
$rootScope.$apply();
}
constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) {
// declaring the hub connection
this.hub = new Hub('employee', {
// client-side methods
listeners: {
'lockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = true;
$rootScope.$apply();
},
// server-side methods
methods: ['lock', 'unlock'],
// query params sent on initial connection
queryParams:{
'token': 'exampletoken'
},
// handle connection error
errorHandler: (message: string) => {
console.error(message);
},
stateChanged: (state: SignalR.StateChanged) => {
// your code here
'unlockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = false;
$rootScope.$apply();
}
});
}
},
private find(id: number) {
for (var i = 0; i < this.all.length; i++) {
if (this.all[i].Id === id) return this.all[i];
// server-side methods
methods: ['lock', 'unlock'],
// query params sent on initial connection
queryParams:{
'token': 'exampletoken'
},
// handle connection error
errorHandler: (message: string) => {
console.error(message);
},
stateChanged: (state: SignalR.StateChanged) => {
// your code here
}
return null;
}
public edit = (employee: Employee) => {
employee.Edit = true;
this.hub.invoke('lock', employee.Id);
};
public done = (employee: Employee) => {
employee.Edit = false;
this.hub.invoke('unlock', employee.Id);
}
});
}
interface Employee {
Id: number;
Name: string;
Email: string;
Salary: number;
Edit: boolean;
Locked: boolean;
private find(id: number) {
for (var i = 0; i < this.all.length; i++) {
if (this.all[i].Id === id) return this.all[i];
}
return null;
}
public edit = (employee: Employee) => {
employee.Edit = true;
this.hub.invoke('lock', employee.Id);
};
public done = (employee: Employee) => {
employee.Edit = false;
this.hub.invoke('unlock', employee.Id);
}
}
interface Employee {
Id: number;
Name: string;
Email: string;
Salary: number;
Edit: boolean;
Locked: boolean;
}
angular
.module('app', ['SignalR'])
.factory('Employees', EmployeesFactory);
@@ -2,11 +2,9 @@
var myApp = angular.module('testModule');
namespace AngularSpinnerTest {
var app = angular.module("angularSpinnerTest", ["angular-spinner"]);
var app = angular.module("angularSpinnerTest", ["angular-spinner"]);
app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) {
usSpinnerService.spin('key1');
usSpinnerService.stop('key2');
}]);
}
app.config(['usSpinnerService', function(usSpinnerService: ISpinnerService) {
usSpinnerService.spin('key1');
usSpinnerService.stop('key2');
}]);
+4 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for Angular Toastr v1.6.0
// Project: https://github.com/Foxandxss/angular-toastr
// Definitions by: Niko Kovačič <https://github.com/nkovacic>
// Definitions by: Niko Kovačič <https://github.com/nkovacic>, Troy McKinnon <https://github.com/trodi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
@@ -15,9 +15,9 @@ declare module 'angular' {
closeHtml?: string;
extendedTimeOut?: number;
messageClass?: string;
onHidden?: Function;
onShown?: Function;
onTap?: Function;
onHidden?: (wasClicked: boolean, toast: angular.toastr.IToast) => void;
onShown?: (toast: angular.toastr.IToast) => void;
onTap?: (toast: angular.toastr.IToast) => void;
progressBar?: boolean;
tapToDismiss?: boolean;
templates?: {
@@ -1,6 +1,7 @@
import * as angular from 'angular';
import * as angularTranslate from 'angular-translate';
var app = angular.module('at', ['pascalprecht.translate']);
var app = angular.module('at', [angularTranslate]);
app.factory('customLoader', ($q:angular.IQService) => {
return (options:any) => {
+7 -4
View File
@@ -1,10 +1,13 @@
// Type definitions for Angular Translate (pascalprecht.translate module) 2.4
// Type definitions for Angular Translate (pascalprecht.translate module) 2.15
// Project: https://github.com/PascalPrecht/angular-translate
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="angular" />
declare var _: string;
export = _;
import * as angular from 'angular';
declare module 'angular' {
@@ -45,8 +48,8 @@ declare module 'angular' {
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string): angular.IPromise<{ [key: string]: string }>;
(translationId: string, interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<{ [key: string]: string }>;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
@@ -117,7 +120,7 @@ declare module 'angular' {
interface IFilterService {
(name: 'translate'): {
(translationId: string, interpolateParams?: any, interpolation?: string): string;
(translationId: string, interpolateParams?: any, interpolation?: string, forceLanguage?: string): string;
};
}
}
+79 -64
View File
@@ -62,7 +62,6 @@ angular.module('http-auth-interceptor', [])
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', ($httpProvider: ng.IHttpProvider, authServiceProvider: any) => {
$httpProvider.defaults.headers.common = {Authorization: 'Bearer token'};
$httpProvider.defaults.headers.get['Authorization'] = 'Bearer token';
$httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) => 'Bearer token';
@@ -108,7 +107,7 @@ namespace HttpAndRegularPromiseTests {
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// const i: number = response.data
// would type check
$scope.person = response.data;
});
@@ -116,7 +115,7 @@ namespace HttpAndRegularPromiseTests {
$http.get<ExpectedResponse>('http://somewhere/some/resource')
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// const i: number = response.data
// would NOT type check
$scope.person = response.data;
});
@@ -153,7 +152,13 @@ namespace HttpAndRegularPromiseTests {
// Test for AngularJS Syntax
namespace My.Namespace {
export var x: any; // need to export something for module to kick in
export const x: any = null; // need to export something for module to kick in
}
class TestProvider implements ng.IServiceProvider {
constructor(private $scope: ng.IScope) {}
$get() {}
}
// IModule Registering Test
@@ -229,14 +234,6 @@ mod.value(My.Namespace);
mod.decorator('name', ($scope: ng.IScope) => {});
mod.decorator('name', ['$scope', ($scope: ng.IScope) => {}]);
class TestProvider implements ng.IServiceProvider {
constructor(private $scope: ng.IScope) {
}
$get() {
}
}
// QProvider tests
angular.module('qprovider-test', [])
.config(['$qProvider', ($qProvider: ng.IQProvider) => {
@@ -276,8 +273,8 @@ foo.then((x) => {
// Object is inferred here
x.a = 123;
// Try a promise
var y: ng.IPromise<number>;
var condition: boolean;
const y: ng.IPromise<number> = null;
const condition: boolean = null;
return condition ? y : x.a; // IPromise<T> | T, both are good for the 1st arg of .then()
}).then((x) => {
// x is infered to be a number, which is the resolved value of a promise
@@ -299,15 +296,15 @@ namespace TestQ {
g: string;
h: number;
}
var tResult: TResult;
var promiseTResult: angular.IPromise<TResult>;
var tValue: TValue;
var promiseTValue: angular.IPromise<TValue>;
var tOther: TOther;
var promiseTOther: angular.IPromise<TOther>;
const tResult: TResult = null;
const promiseTResult: angular.IPromise<TResult> = null;
const tValue: TValue = null;
const promiseTValue: angular.IPromise<TValue> = null;
const tOther: TOther = null;
const promiseTOther: angular.IPromise<TOther> = null;
var $q: angular.IQService;
var promiseAny: angular.IPromise<any>;
const $q: angular.IQService = null;
const promiseAny: angular.IPromise<any> = null;
const assertPromiseType = <T>(arg: angular.IPromise<T>) => arg;
@@ -346,7 +343,7 @@ namespace TestQ {
let result: angular.IDeferred<TResult>;
result = $q.defer<TResult>();
result.resolve(tResult);
var anyValue: any;
const anyValue: any = null;
result.reject(anyValue);
result.promise.then(result => {
return $q.resolve<TResult>(result);
@@ -411,7 +408,7 @@ namespace TestQ {
let httpFoo: ng.IHttpPromise<number>;
httpFoo.then((x) => {
// When returning a promise the generic type must be inferred.
var innerPromise: ng.IPromise<number>;
const innerPromise: ng.IPromise<number> = null;
return innerPromise;
}).then((x) => {
// must still be number.
@@ -427,16 +424,16 @@ httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
// Deferred signature tests
namespace TestDeferred {
var any: any;
const any: any = null;
interface TResult {
a: number;
b: string;
c: boolean;
}
var tResult: TResult;
const tResult: TResult = null;
var deferred: angular.IDeferred<TResult>;
const deferred: angular.IDeferred<TResult> = null;
// deferred.resolve
{
@@ -467,17 +464,40 @@ namespace TestDeferred {
}
namespace TestInjector {
var $injector: angular.auto.IInjectorService;
const $injector: angular.auto.IInjectorService = null;
$injector.strictDi = true;
$injector.annotate(() => {});
$injector.annotate(() => {}, true);
// $injector.instantiate
{
class Foobar {
constructor($q) {}
}
let result: Foobar = $injector.instantiate(Foobar);
}
// $injector.invoke
{
function foobar(v: boolean): number {
return 7;
}
let result = $injector.invoke(foobar);
if (!(typeof result === 'number')) {
// This fails to compile if 'result' is not exactly a number.
let expectNever: never = result;
}
let anyFunction: Function = foobar;
let anyResult: string = $injector.invoke(anyFunction);
}
}
// Promise signature tests
namespace TestPromise {
var any: any;
const any: any = null;
interface TResult {
kind: 'result';
@@ -497,16 +517,16 @@ namespace TestPromise {
return x.kind === 'result';
}
var tresult: TResult;
var tresultPromise: ng.IPromise<TResult>;
var tresultHttpPromise: ng.IHttpPromise<TResult>;
const tresult: TResult = null;
const tresultPromise: ng.IPromise<TResult> = null;
const tresultHttpPromise: ng.IHttpPromise<TResult> = null;
var tother: TOther;
var totherPromise: ng.IPromise<TOther>;
var totherHttpPromise: ng.IHttpPromise<TOther>;
const tother: TOther = null;
const totherPromise: ng.IPromise<TOther> = null;
const totherHttpPromise: ng.IHttpPromise<TOther> = null;
var promise: angular.IPromise<TResult>;
var $q: angular.IQService;
const promise: angular.IPromise<TResult> = null;
const $q: angular.IQService = null;
const assertPromiseType = <T>(arg: angular.IPromise<T>) => arg;
const reject = $q.reject();
@@ -608,9 +628,9 @@ namespace TestTimeout {
b: string;
c: boolean;
}
var fnTResult: (...args: any[]) => TResult;
var promiseAny: angular.IPromise<any>;
var $timeout: angular.ITimeoutService;
const fnTResult: (...args: any[]) => TResult = null;
const promiseAny: angular.IPromise<any> = null;
const $timeout: angular.ITimeoutService = null;
// $timeout
{
@@ -670,9 +690,7 @@ class SampleDirective implements ng.IDirective {
return new SampleDirective();
}
link(scope: ng.IScope) {
}
link(scope: ng.IScope) {}
}
class SampleDirective2 implements ng.IDirective {
@@ -688,9 +706,7 @@ class SampleDirective2 implements ng.IDirective {
return new SampleDirective2();
}
link(scope: ng.IScope) {
}
link(scope: ng.IScope) {}
}
angular.module('SameplDirective', []).directive('sampleDirective', SampleDirective.instance).directive('sameplDirective2', SampleDirective2.instance);
@@ -825,11 +841,10 @@ angular.module('docsTimeDirective', [])
$scope.format = 'M/d/yy h:mm:ss a';
}])
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
return {
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
let format: any,
timeoutId: any;
let format: any;
let timeoutId: any;
function updateTime() {
element.text(dateFilter(new Date(), format));
@@ -904,7 +919,10 @@ angular.module('docsIsoFnBindExample', [])
angular.module('dragModule', [])
.directive('myDraggable', ['$document', ($document: any) => {
return (scope: any, element: any, attr: any) => {
let startX = 0, startY = 0, x = 0, y = 0;
let startX = 0;
let startY = 0;
let x = 0;
let y = 0;
element.css({
position: 'relative',
@@ -1030,11 +1048,10 @@ interface ICopyExampleUser {
}
interface ICopyExampleScope {
user: ICopyExampleUser;
master: ICopyExampleUser;
update: (copyExampleUser: ICopyExampleUser) => any;
reset: () => any;
update(copyExampleUser: ICopyExampleUser): any;
reset(): any;
}
angular.module('copyExample', [])
@@ -1055,8 +1072,7 @@ angular.module('copyExample', [])
}]);
namespace locationTests {
var $location: ng.ILocationService;
const $location: ng.ILocationService = null;
/*
* From https://docs.angularjs.org/api/ng/service/$location
@@ -1114,9 +1130,9 @@ namespace locationTests {
// NgModelController
function NgModelControllerTyping() {
var ngModel: angular.INgModelController;
var $http: angular.IHttpService;
var $q: angular.IQService;
const ngModel: angular.INgModelController = null;
const $http: angular.IHttpService = null;
const $q: angular.IQService = null;
// See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators
ngModel.$validators['validCharacters'] = (modelValue, viewValue) => {
@@ -1141,8 +1157,7 @@ function NgModelControllerTyping() {
let $filter: angular.IFilterService;
function testFilter() {
var items: string[];
const items: string[] = null;
$filter('filter')(items, 'test');
$filter('filter')(items, {name: 'test'});
$filter('filter')(items, (val, index, array) => {
@@ -1224,7 +1239,7 @@ function testCustomFilter() {
}
function parseTyping() {
var $parse: angular.IParseService;
const $parse: angular.IParseService = null;
const compiledExp = $parse('a.b.c');
if (compiledExp.constant) {
return compiledExp({});
@@ -1234,7 +1249,7 @@ function parseTyping() {
}
function parseWithParams() {
var $parse: angular.IParseService;
const $parse: angular.IParseService = null;
const compiledExp1 = $parse('a.b.c', () => null);
const compiledExp2 = $parse('a.b.c', null, false);
}
@@ -1255,7 +1270,7 @@ function doBootstrap(element: Element | JQuery, mode: string): ng.auto.IInjector
}
function testIHttpParamSerializerJQLikeProvider() {
var serializer: angular.IHttpParamSerializer;
const serializer: angular.IHttpParamSerializer = null;
serializer({
a: 'b'
});
@@ -1271,6 +1286,6 @@ function anyOf3<T1, T2, T3>(v1: T1, v2: T2, v3: T3) {
}
function toPromise<T>(val: T): ng.IPromise<T> {
var p: ng.IPromise<T>;
const p: ng.IPromise<T> = null;
return p;
}
+83 -11
View File
@@ -1,6 +1,6 @@
// Type definitions for Angular JS 1.6
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Georgii Dolzhykov <http://github.com/thorn0>
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Georgii Dolzhykov <http://github.com/thorn0>, Caleb St-Denis <https://github.com/calebstdenis>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="jquery" />
@@ -413,7 +413,7 @@ declare namespace angular {
// https://docs.angularjs.org/api/ng/directive/ngModelOptions
interface INgModelOptions {
updateOn?: string;
debounce?: any;
debounce?: number | { [key: string]: number; };
allowInvalid?: boolean;
getterSetter?: boolean;
timezone?: string;
@@ -602,7 +602,7 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(delay?: number, invokeApply?: boolean): IPromise<void>;
<T>(fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
<T>(fn: (...args: any[]) => T | IPromise<T>, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
cancel(promise?: IPromise<any>): boolean;
}
@@ -782,7 +782,7 @@ declare namespace angular {
// Check angular's i18n files for exemples
NUMBER_FORMATS: ILocaleNumberFormatDescriptor;
DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor;
pluralCat: (num: any) => string;
pluralCat(num: any): string;
}
interface ILocaleNumberFormatDescriptor {
@@ -875,7 +875,8 @@ declare namespace angular {
* @param identifierStart The function that will decide whether the given character is a valid identifier start character.
* @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
**/
setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
setIdentifierFns(
identifierStart?: (character: string, codePoint: number) => boolean,
identifierContinue?: (character: string, codePoint: number) => boolean): void;
}
@@ -1591,10 +1592,10 @@ declare namespace angular {
}
interface IHttpInterceptor {
request?: (config: IRequestConfig) => IRequestConfig|IPromise<IRequestConfig>;
requestError?: (rejection: any) => any;
response?: <T>(response: IHttpPromiseCallbackArg<T>) => IPromise<IHttpPromiseCallbackArg<T>>|IHttpPromiseCallbackArg<T>;
responseError?: (rejection: any) => any;
request?(config: IRequestConfig): IRequestConfig|IPromise<IRequestConfig>;
requestError?(rejection: any): any;
response?<T>(response: IHttpPromiseCallbackArg<T>): IPromise<IHttpPromiseCallbackArg<T>>|IHttpPromiseCallbackArg<T>;
responseError?(rejection: any): any;
}
interface IHttpInterceptorFactory {
@@ -1846,6 +1847,77 @@ declare namespace angular {
$postLink?(): void;
}
/**
* Interface for the $onInit lifecycle hook
* https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
*/
interface IOnInit {
/**
* Called on each controller after all the controllers on an element have been constructed and had their bindings
* initialized (and before the pre & post linking functions for the directives on this element). This is a good
* place to put initialization code for your controller.
*/
$onInit(): void;
}
/**
* Interface for the $doCheck lifecycle hook
* https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
*/
interface IDoCheck {
/**
* Called on each turn of the digest cycle. Provides an opportunity to detect and act on changes.
* Any actions that you wish to take in response to the changes that you detect must be invoked from this hook;
* implementing this has no effect on when `$onChanges` is called. For example, this hook could be useful if you wish
* to perform a deep equality check, or to check a `Dat`e object, changes to which would not be detected by Angular's
* change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments; if detecting changes,
* you must store the previous value(s) for comparison to the current values.
*/
$doCheck(): void;
}
/**
* Interface for the $onChanges lifecycle hook
* https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
*/
interface IOnChanges {
/**
* Called whenever one-way bindings are updated. The onChangesObj is a hash whose keys are the names of the bound
* properties that have changed, and the values are an {@link IChangesObject} object of the form
* { currentValue, previousValue, isFirstChange() }. Use this hook to trigger updates within a component such as
* cloning the bound value to prevent accidental mutation of the outer value.
*/
$onChanges(onChangesObj: IOnChangesObject): void;
}
/**
* Interface for the $onDestroy lifecycle hook
* https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
*/
interface IOnDestroy {
/**
* Called on a controller when its containing scope is destroyed. Use this hook for releasing external resources,
* watches and event handlers.
*/
$onDestroy(): void;
}
/**
* Interface for the $postLink lifecycle hook
* https://docs.angularjs.org/api/ng/service/$compile#life-cycle-hooks
*/
interface IPostLink {
/**
* Called after this controller's element and its children have been linked. Similar to the post-link function this
* hook can be used to set up DOM event handlers and do direct DOM manipulation. Note that child elements that contain
* templateUrl directives will not have been compiled and linked since they are waiting for their template to load
* asynchronously and their own compilation and linking has been suspended until that occurs. This hook can be considered
* analogous to the ngAfterViewInit and ngAfterContentInit hooks in Angular 2. Since the compilation process is rather
* different in Angular 1 there is no direct mapping and care should be taken when upgrading.
*/
$postLink(): void;
}
interface IOnChangesObject {
[property: string]: IChangesObject<any>;
}
@@ -1977,8 +2049,9 @@ declare namespace angular {
get(name: '$window'): IWindowService;
get<T>(name: '$xhrFactory'): IXhrFactory<T>;
has(name: string): boolean;
instantiate<T>(typeConstructor: Function, locals?: any): T;
instantiate<T>(typeConstructor: {new(...args: any[]): T}, locals?: any): T;
invoke(inlineAnnotatedFunction: any[]): any;
invoke<T>(func: (...args: any[]) => T, context?: any, locals?: any): T;
invoke(func: Function, context?: any, locals?: any): any;
strictDi: boolean;
}
@@ -2025,7 +2098,6 @@ declare namespace angular {
service(name: string, inlineAnnotatedFunction: any[]): IServiceProvider;
value(name: string, value: any): IServiceProvider;
}
}
/**
+11 -24
View File
@@ -1,33 +1,20 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"class-name": true,
"curly": true,
"max-line-length": false,
"no-consecutive-blank-lines": true,
"no-shadowed-variable": true,
"quotemark": [
true,
"single"
],
"align": true,
"indent": [true, "spaces"],
"quotemark": [true, "single"],
"variable-name": [true, "check-format"],
// Below are all TODOs
"callable-types": false,
"forbidden-types": false,
"indent": [
true,
"spaces"
],
"ban-types": false,
"interface-name": false,
"linebreak-style": [
true,
"LF"
],
"jsdoc-format": false,
"max-line-length": false,
"no-empty-interface": false,
"no-namespace": false,
"unified-signatures": false,
"variable-name": [
true,
"check-format"
],
"void-return": false
}
}
}
@@ -1,8 +1,6 @@
namespace AnimationFrameTests {
var animation = new AnimationFrame();
function frame() {
animation.request(frame);
}
var animation = new AnimationFrame();
function frame() {
animation.request(frame);
}
animation.request(frame);
-2
View File
@@ -3,8 +3,6 @@
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="bluebird" />
import Promise = require('bluebird');
import { Column, Table, Transaction, AnydbSql } from 'anydb-sql';
export interface Migration {
+5
View File
@@ -0,0 +1,5 @@
{
"dependencies": {
"anydb-sql": "^0.6.53"
}
}
-70
View File
@@ -1,70 +0,0 @@
import anydbsql = require('anydb-sql');
import { Table, Column } from 'anydb-sql'
function do_not_run() {
var db = anydbsql({
url: 'postgres://user:pass@host:port/database',
connections: { min: 2, max: 20 }
});
// Table Post
interface Post {
content: string;
userId: string;
date: string;
}
interface PostTable extends Table<Post> {
content: Column<string>;
userId: Column<string>;
date: Column<string>;
}
var post = <PostTable>db.define<Post>({
name: 'posts',
columns: {
content: {},
userId: {},
date: {}
}
});
// Table User
interface User {
id: string;
email: string;
password: string;
name: string;
}
interface UserTable extends Table<User> {
id: Column<string>;
email: Column<string>;
password: Column<string>;
name: Column<string>;
}
var user = <UserTable>db.define<User>({
name: 'users',
columns: {
id: { primaryKey: true },
email: {},
password: {},
name: {},
date: {}
},
has: {
posts: { from: 'posts', many: true },
group: { from: 'groups'}
}
});
user.select(user.name, post.content)
.from(user.join(post).on(user.id.equals(post.userId)))
.where(post.date.gt('123'))
.all()
}
-193
View File
@@ -1,193 +0,0 @@
// Type definitions for anydb-sql
// Project: https://github.com/doxout/anydb-sql
// Definitions by: Gorgi Kosev <https://github.com/spion>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface AnyDBPool extends anydbSQL.DatabaseConnection {
query: (text: string, values: any[], callback: (err: Error, result: any) => void) => void
begin: () => anydbSQL.Transaction
close: (err: Error) => void
}
interface Dictionary<T> { [key: string]: T; }
declare namespace anydbSQL {
export interface OrderByValueNode { }
export interface ColumnDefinition {
primaryKey?: boolean;
dataType?: string;
references?: { table: string; column: string }
notNull?: boolean
}
export interface TableDefinition {
name: string
columns: Dictionary<ColumnDefinition>
has?: Dictionary<{ from: string; many?: boolean }>
}
export interface QueryLike {
query: string;
values: any[]
text: string
}
export interface DatabaseConnection {
queryAsync<T>(query: string, ...params: any[]): Promise<{ rowCount: number; rows: T[] }>
queryAsync<T>(query: QueryLike): Promise<{ rowCount: number; rows: T[] }>
}
export interface Transaction extends DatabaseConnection {
rollback(): void
commitAsync(): Promise<void>
}
export interface SubQuery<T> {
select(node: Column<T>): SubQuery<T>
where(...nodes: any[]): SubQuery<T>
from(table: TableNode): SubQuery<T>
group(...nodes: any[]): SubQuery<T>
order(criteria: OrderByValueNode): SubQuery<T>
notExists(subQuery: SubQuery<any>): SubQuery<T>
}
interface Executable<T> {
get(): Promise<T>
getWithin(tx: DatabaseConnection): Promise<T>
exec(): Promise<void>
all(): Promise<T[]>
execWithin(tx: DatabaseConnection): Promise<void>
allWithin(tx: DatabaseConnection): Promise<T[]>
toQuery(): QueryLike;
}
interface Queryable<T> {
where(...nodes: any[]): Query<T>
delete(): ModifyingQuery
select<U>(...nodes: any[]): Query<U>
selectDeep<U>(table: Table<T>): Query<T>
selectDeep<U>(...nodesOrTables: any[]): Query<U>
}
export interface Query<T> extends Executable<T>, Queryable<T> {
from(table: TableNode): Query<T>
update(o: Dictionary<any>): ModifyingQuery
update(o: {}): ModifyingQuery
group(...nodes: any[]): Query<T>
order(...criteria: OrderByValueNode[]): Query<T>
limit(l: number): Query<T>
offset(o: number): Query<T>
}
export interface ModifyingQuery extends Executable<void> {
returning<U>(...nodes: any[]): Query<U>
where(...nodes: any[]): ModifyingQuery
}
export interface TableNode {
join(table: TableNode): JoinTableNode
leftJoin(table: TableNode): JoinTableNode
}
export interface JoinTableNode extends TableNode {
on(filter: BinaryNode): TableNode
on(filter: string): TableNode
}
interface CreateQuery extends Executable<void> {
ifNotExists(): Executable<void>
}
interface DropQuery extends Executable<void> {
ifExists(): Executable<void>
}
export interface Table<T> extends TableNode, Queryable<T> {
create(): CreateQuery
drop(): DropQuery
as(name: string): Table<T>
update(o: any): ModifyingQuery
insert(row: T): ModifyingQuery
insert(rows: T[]): ModifyingQuery
select(): Query<T>
select<U>(...nodes: any[]): Query<U>
from<U>(table: TableNode): Query<U>
star(): Column<any>
subQuery<U>(): SubQuery<U>
eventEmitter: {
emit: (type: string, ...args: any[]) => void
on: (eventName: string, handler: Function) => void
}
columns: Column<any>[]
sql: SQL;
alter(): AlterQuery<T>
}
export interface AlterQuery<T> extends Executable<void> {
addColumn(column: Column<any>): AlterQuery<T>;
addColumn(name: string, options: string): AlterQuery<T>;
dropColumn(column: Column<any>): AlterQuery<T>;
renameColumn(column: Column<any>, newColumn: Column<any>): AlterQuery<T>;
renameColumn(column: Column<any>, newName: string): AlterQuery<T>;
renameColumn(name: string, newName: string): AlterQuery<T>;
rename(newName: string): AlterQuery<T>
}
export interface SQL {
functions: {
LOWER(c: Column<string>): Column<string>
}
}
export interface BinaryNode {
and(node: BinaryNode): BinaryNode
or(node: BinaryNode): BinaryNode
}
export interface Column<T> {
in(arr: T[]): BinaryNode
in(subQuery: SubQuery<T>): BinaryNode
notIn(arr: T[]): BinaryNode
equals(node: any): BinaryNode
notEquals(node: any): BinaryNode
gte(node: any): BinaryNode
lte(node: any): BinaryNode
gt(node: any): BinaryNode
lt(node: any): BinaryNode
like(str: string): BinaryNode
multiply: {
(node: Column<T>): Column<T>
(n: number): Column<number>
}
isNull(): BinaryNode
isNotNull(): BinaryNode
sum(): Column<number>
count(): Column<number>
count(name: string): Column<number>
distinct(): Column<T>
as(name: string): Column<T>
ascending: OrderByValueNode
descending: OrderByValueNode
asc: OrderByValueNode
desc: OrderByValueNode
}
export interface AnydbSql extends DatabaseConnection {
define<T>(map: TableDefinition): Table<T>;
transaction<T>(fn: (tx: Transaction) => Promise<T>): Promise<T>
allOf(...tables: Table<any>[]): any
models: Dictionary<Table<any>>
functions: {
LOWER: (name: Column<string>) => Column<string>
RTRIM: (name: Column<string>) => Column<string>
}
makeFunction(name: string): Function
begin(): Transaction
open(): void;
close(): void;
getPool(): AnyDBPool;
dialect(): string;
}
}
declare function anydbSQL(config: Object): anydbSQL.AnydbSql;
export = anydbSQL;
-22
View File
@@ -1,22 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"anydb-sql-tests.ts"
]
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
-4
View File
@@ -21,7 +21,6 @@ describe("ApplePaySession", () => {
}
});
it("can create a new instance", () => {
const version = 1;
const paymentRequest = {
countryCode: "US",
@@ -42,7 +41,6 @@ describe("ApplePaySession", () => {
const session = new ApplePaySession(version, paymentRequest);
});
it("can call static methods", () => {
const merchantIdentifier = "MyMerchantId";
let canMakePayments: boolean = ApplePaySession.canMakePayments();
@@ -59,7 +57,6 @@ describe("ApplePaySession", () => {
});
});
it("can call instance methods", () => {
const version = 1;
const paymentRequest = {
countryCode: "US",
@@ -171,7 +168,6 @@ describe("ApplePaySession", () => {
});
describe("ApplePayPaymentRequest", () => {
it("can create a new instance", () => {
let paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
applicationData: "ApplicationData",
countryCode: "GB",
+1 -17
View File
@@ -7,7 +7,6 @@
* A session object for managing the payment process on the web.
*/
declare class ApplePaySession extends EventTarget {
/**
* Creates a new instance of the ApplePaySession class.
* @param version - The version of the ApplePay JS API you are using.
@@ -164,12 +163,10 @@ declare class ApplePaySession extends EventTarget {
}
declare namespace ApplePayJS {
/**
* Defines a line item in a payment request - for example, total, tax, discount, or grand total.
*/
interface ApplePayLineItem {
/**
* A short, localized description of the line item.
*/
@@ -190,7 +187,6 @@ declare namespace ApplePayJS {
* Represents the result of authorizing a payment request and contains encrypted payment information.
*/
interface ApplePayPayment {
/**
* The encrypted token for an authorized payment.
*/
@@ -211,7 +207,6 @@ declare namespace ApplePayJS {
* The Apple​Pay​Payment​Authorized​Event class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
*/
abstract class ApplePayPaymentAuthorizedEvent extends Event {
/**
* The payment token used to authorize a payment.
*/
@@ -222,7 +217,6 @@ declare namespace ApplePayJS {
* Encapsulates contact information needed for billing and shipping.
*/
interface ApplePayPaymentContact {
/**
* An email address for the contact.
*/
@@ -278,7 +272,6 @@ declare namespace ApplePayJS {
* Contains information about an Apple Pay payment card.
*/
interface ApplePayPaymentMethod {
/**
* A string, suitable for display, that describes the card.
*/
@@ -305,7 +298,6 @@ declare namespace ApplePayJS {
* The Apple​Pay​Payment​Method​Selected​Event class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
*/
abstract class ApplePayPaymentMethodSelectedEvent extends Event {
/**
* The card used to complete a payment.
*/
@@ -316,7 +308,6 @@ declare namespace ApplePayJS {
* Represents a provisioned payment card for Apple Pay payments.
*/
interface ApplePayPaymentPass {
/**
* The unique identifier for the primary account number for the payment card.
*/
@@ -347,7 +338,6 @@ declare namespace ApplePayJS {
* Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information.
*/
interface ApplePayPaymentRequest {
/**
* The merchant's two-letter ISO 3166 country code.
*/
@@ -402,7 +392,7 @@ declare namespace ApplePayJS {
/**
* A set of shipping method objects that describe the available shipping methods.
*/
shippingMethods?: ApplePayShippingMethod[] | string[];
shippingMethods?: ApplePayShippingMethod[];
/**
* How the items are to be shipped.
@@ -419,7 +409,6 @@ declare namespace ApplePayJS {
* Contains the user's payment credentials.
*/
interface ApplePayPaymentToken {
/**
* An object containing the encrypted payment data.
*/
@@ -440,7 +429,6 @@ declare namespace ApplePayJS {
* The Apple​Pay​Shipping​Contact​Selected​Event class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
*/
abstract class ApplePayShippingContactSelectedEvent extends Event {
/**
* The shipping address selected by the user.
*/
@@ -451,7 +439,6 @@ declare namespace ApplePayJS {
* Defines a shipping method for delivering physical goods.
*/
interface ApplePayShippingMethod {
/**
* A short description of the shipping method.
*/
@@ -477,7 +464,6 @@ declare namespace ApplePayJS {
* The Apple​Pay​Shipping​Method​Selected​Event class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
*/
abstract class ApplePayShippingMethodSelectedEvent extends Event {
/**
* The shipping method selected by the user.
*/
@@ -488,7 +474,6 @@ declare namespace ApplePayJS {
* The Apple​Pay​Validate​Merchant​Event class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
*/
abstract class ApplePayValidateMerchantEvent extends Event {
/**
* The URL used to validate the merchant server.
*/
@@ -496,7 +481,6 @@ declare namespace ApplePayJS {
}
abstract class Event {
readonly bubbles: boolean;
cancelBubble: boolean;
+1 -3
View File
@@ -1,3 +1 @@
{
"extends": "../tslint.json"
}
{ "extends": "dtslint/dt.json" }
@@ -1,6 +1,6 @@
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
var config: Microsoft.ApplicationInsights.IConfig = {
const config: Microsoft.ApplicationInsights.IConfig = {
instrumentationKey: "<your iKey>",
endpointUrl: "endpointUrl",
emitLineDelimitedJson: false,
@@ -30,7 +30,7 @@ var config: Microsoft.ApplicationInsights.IConfig = {
isStorageUseDisabled: true
};
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
appInsights = {
config,
context: null,
queue: null,
@@ -91,9 +91,8 @@ appInsights.setAuthenticatedUserContext("userId", "accountId");
// set config dynamically
appInsights.config.instrumentationKey = "<new key>";
// TelementryContext
var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
const context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
context.application.ver = "v0.0.0";
context.application.build = "1.1.1";
@@ -113,54 +112,54 @@ context.operation.id = "1";
context.operation.syntheticSource = "testAgent";
// track
var data = new Microsoft.Telemetry.Base();
var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
const data = new Microsoft.Telemetry.Base();
const envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
context.track(envelope);
context.addTelemetryInitializer((envelope) => false);
context.addTelemetryInitializer(telemetryEnvelope => false);
// track event
var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
const eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
const eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
const eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
context.track(eventEnvelope);
// track exception
var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
const exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
const exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
const exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
context.track(exceptionEnvelope);
// track metric
var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
const metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
const metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
const metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
context.track(metricEnvelope);
// track page view
var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
const pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
const pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
const pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
context.track(pageViewEnvelope);
// track page view performance
var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
const pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
const pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
const pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
context.track(pageViewPerfEnvelope);
// track remote dependency
var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
const remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
const remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
const remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
context.track(pageViewPerfEnvelope);
// track trace
var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
context.track(traceEnvelope);
const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
context.track(traceEnvelope);
+85 -84
View File
@@ -195,8 +195,8 @@ declare module Microsoft.ApplicationInsights.Context {
interface IInternal {
/**
* The SDK version used to create this telemetry item.
*/
* The SDK version used to create this telemetry item.
*/
sdkVersion: string;
/**
* The SDK agent version.
@@ -206,15 +206,15 @@ declare module Microsoft.ApplicationInsights.Context {
interface ISample {
/**
* Sample rate
*/
* Sample rate
*/
sampleRate: number;
}
interface ISession {
/**
* The session ID.
*/
* The session ID.
*/
id: string;
/**
* The true if this is the first session
@@ -258,8 +258,8 @@ declare module Microsoft.ApplicationInsights.Context {
interface IUser {
/**
* The telemetry configuration.
*/
* The telemetry configuration.
*/
config: any;
/**
* The user ID.
@@ -345,12 +345,12 @@ declare module Microsoft.ApplicationInsights.Telemetry {
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new isntance of the ExceptionTelemetry object
*/
* Constructs a new isntance of the ExceptionTelemetry object
*/
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
/**
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception;
}
@@ -414,8 +414,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
getIsValid(): boolean;
private durationMs;
/**
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
*/
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
*/
getDurationMs(): number;
/**
* Constructs a new instance of the PageEventTelemetry object
@@ -423,8 +423,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
constructor(name: string, url: string, unused: number, properties?: any, measurements?: any);
static getPerformanceTiming(): PerformanceTiming;
/**
* Returns true is window performance timing API is supported, false otherwise.
*/
* Returns true is window performance timing API is supported, false otherwise.
*/
static isPerformanceTimingSupported(): PerformanceTiming;
/**
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
@@ -615,16 +615,16 @@ declare module Microsoft.ApplicationInsights {
interface ITelemetryContext {
/**
* The object describing a component tracked by this object.
*/
* The object describing a component tracked by this object.
*/
application: Context.IApplication;
/**
* The object describing a device tracked by this object.
*/
device: Context.IDevice;
/**
* The object describing internal settings.
*/
* The object describing internal settings.
*/
internal: Context.IInternal;
/**
* The object describing a location tracked by this object.
@@ -635,8 +635,8 @@ declare module Microsoft.ApplicationInsights {
*/
operation: Context.IOperation;
/**
* The object describing sampling settings.
*/
* The object describing sampling settings.
*/
sample: Context.ISample;
/**
* The object describing a user tracked by this object.
@@ -647,13 +647,13 @@ declare module Microsoft.ApplicationInsights {
*/
session: Context.ISession;
/**
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
* before telemetry item is pushed for sending and in the order they were added.
*/
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
* before telemetry item is pushed for sending and in the order they were added.
*/
addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
/**
* Tracks telemetry object.
*/
* Tracks telemetry object.
*/
track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
}
@@ -662,23 +662,23 @@ declare module Microsoft.ApplicationInsights {
context: ITelemetryContext;
queue: Array<() => void>;
/**
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
startTrackPage(name?: string): any;
/**
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackPage(name?: string, url?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackPage(
name?: string,
url?: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }): any;
/**
* Logs that a page or other item was viewed.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
@@ -687,11 +687,11 @@ declare module Microsoft.ApplicationInsights {
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
*/
trackPageView(name?: string, url?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}, duration?: number): any;
trackPageView(
name?: string,
url?: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }, duration?: number): any;
/**
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
@@ -703,22 +703,20 @@ declare module Microsoft.ApplicationInsights {
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackEvent(name: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
stopTrackEvent(
name: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }): any;
/**
* Log a user action or other occurrence.
* @param name A string to identify this event in the portal.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
trackEvent(name: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
* Log a user action or other occurrence.
* @param name A string to identify this event in the portal.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
trackEvent(
name: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }): any;
/**
* Log a dependency call
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
@@ -737,11 +735,12 @@ declare module Microsoft.ApplicationInsights {
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param severityLevel AI.SeverityLevel - severity level
*/
trackException(exception: Error, handledAt?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}, severityLevel?: AI.SeverityLevel): any;
trackException(
exception: Error,
handledAt?: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number },
severityLevel?: AI.SeverityLevel): any;
/**
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
@@ -752,28 +751,30 @@ declare module Microsoft.ApplicationInsights {
* @param min The smallest measurement in the sample. Defaults to the average.
* @param max The largest measurement in the sample. Defaults to the average.
*/
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
[name: string]: string;
}): any;
trackMetric(
name: string,
average: number,
sampleCount?: number,
min?: number,
max?: number,
properties?: { [name: string]: string }): any;
/**
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: {
[name: string]: string;
}): any;
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: { [name: string]: string }): any;
/**
* Immediately send all queued telemetry.
*/
flush(): any;
/**
* Sets the autheticated user id and the account id in this session.
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
*
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
*/
* Sets the autheticated user id and the account id in this session.
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
*
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
*/
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
/**
* Clears the authenticated user id and the account id from the user context.
@@ -796,4 +797,4 @@ declare module 'applicationinsights-js' {
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
+2 -2
View File
@@ -1,8 +1,8 @@
{
"extends": "../tslint.json",
"extends": "dtslint/dt.json",
"rules": {
"interface-name": [ false ],
"no-internal-module": false,
"no-single-declare-module": false
}
}
}
+1 -3
View File
@@ -2,8 +2,6 @@ import Map = require("esri/Map");
import MapView = require("esri/views/MapView");
import Point = require("esri/geometry/Point");
export = MapController;
class MapController {
map: Map;
@@ -19,7 +17,7 @@ class MapController {
this.map = new Map({
basemap: "topo"
});
let view = new MapView({
center: point,
container: this.mapDiv,
+48 -48
View File
@@ -667,6 +667,8 @@ declare namespace __esri {
export type EasingFunction = (t: number, duration: number) => number;
export type EventHandler = (event: any) => void;
export interface PromisedWatchHandle extends IPromise<any> {
remove(): void;
}
@@ -1337,7 +1339,7 @@ declare namespace __esri {
maxZoom?: number;
snapToZoom?: boolean;
rotationEnabled?: boolean;
effectiveLODs?: number;
effectiveLODs?: LOD[];
effectiveMinZoom?: number;
effectiveMaxZoom?: number;
effectiveMinScale?: number;
@@ -1868,21 +1870,6 @@ declare namespace __esri {
worldScale?: boolean;
}
interface Evented {
emit(type: string, event: any): IHandle;
on(name: string, callback: Function): IHandle;
}
interface EventedConstructor {
new(): Evented;
hasEventListener(type: string): boolean;
on(type: string, listener: Function): any;
}
export const Evented: EventedConstructor;
interface Basemap extends Accessor, Loadable, JSONSupport {
baseLayers: Collection;
id: string;
@@ -1907,11 +1894,11 @@ declare namespace __esri {
export const Basemap: BasemapConstructor;
interface BasemapProperties extends LoadableProperties {
baseLayers?: Collection;
baseLayers?: Collection | any[];
id?: string;
loaded?: boolean;
portalItem?: PortalItemProperties;
referenceLayers?: Collection;
referenceLayers?: Collection | any[];
thumbnailUrl?: string;
title?: string;
}
@@ -2013,7 +2000,7 @@ declare namespace __esri {
export const Ground: GroundConstructor;
interface GroundProperties {
layers?: Collection;
layers?: Collection | any[];
}
interface Map extends Accessor, LayersMixin {
@@ -2029,7 +2016,7 @@ declare namespace __esri {
export const Map: MapConstructor;
interface MapProperties extends LayersMixinProperties {
allLayers?: Collection;
allLayers?: Collection | any[];
basemap?: BasemapProperties;
ground?: GroundProperties;
}
@@ -2053,7 +2040,7 @@ declare namespace __esri {
export const PopupTemplate: PopupTemplateConstructor;
interface PopupTemplateProperties {
actions?: Collection;
actions?: Collection | any[];
content?: string | any[] | Function;
fieldInfos?: PopupTemplateFieldInfos[];
overwriteActions?: boolean;
@@ -2718,6 +2705,7 @@ declare namespace __esri {
definitionExpression: string;
elevationInfo: FeatureLayerElevationInfo;
fields: Field[];
gdbVersion: string;
geometryType: string;
hasAttachments: boolean;
hasM: boolean;
@@ -2762,6 +2750,7 @@ declare namespace __esri {
definitionExpression?: string;
elevationInfo?: FeatureLayerElevationInfo;
fields?: FieldProperties[];
gdbVersion?: string;
geometryType?: string;
hasAttachments?: boolean;
hasM?: boolean;
@@ -2777,7 +2766,7 @@ declare namespace __esri {
renderer?: RendererProperties;
returnM?: boolean;
returnZ?: boolean;
source?: Collection;
source?: Collection | any[];
spatialReference?: SpatialReferenceProperties;
token?: string;
url?: string;
@@ -2823,7 +2812,7 @@ declare namespace __esri {
interface GraphicsLayerProperties extends LayerProperties, ScaleRangeLayerProperties {
elevationInfo?: GraphicsLayerElevationInfo;
graphics?: Collection;
graphics?: Collection | any[];
}
interface GroupLayer extends Layer, LayersMixin, JSONSupport, PortalLayer {
@@ -3419,7 +3408,7 @@ declare namespace __esri {
popupTemplate?: PopupTemplateProperties;
renderer?: RendererProperties;
source?: any | any;
sublayers?: Collection;
sublayers?: Collection | any[];
title?: string;
url?: string;
visible?: boolean;
@@ -4506,7 +4495,7 @@ declare namespace __esri {
interface Symbol3DProperties extends SymbolProperties {
styleOrigin?: Symbol3DStyleOrigin;
symbolLayers?: Collection;
symbolLayers?: Collection | any[];
}
interface Symbol3DLayer extends Accessor, JSONSupport {
@@ -6170,7 +6159,7 @@ declare namespace __esri {
goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | any, options?: MapViewGoToOptions): IPromise<any>;
hasEventListener(type: string): boolean;
hitTest(screenPoint: MapViewHitTestScreenPoint): IPromise<any>;
on(type: string | string[], modifiersOrHandler: string[] | Function, handler?: Function): any;
on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle;
toMap(screenPoint: ScreenPoint, mapPoint?: Point): Point;
toScreen(point: Point, screenPoint?: ScreenPoint): ScreenPoint;
}
@@ -6208,7 +6197,7 @@ declare namespace __esri {
goTo(target: number[] | Geometry | Geometry[] | Graphic | Graphic[] | Viewpoint | Camera | any, options?: SceneViewGoToOptions): IPromise<any>;
hasEventListener(type: string): boolean;
hitTest(screenPoint: SceneViewHitTestScreenPoint): IPromise<any>;
on(type: string | string[], modifiersOrHandler: string[] | Function, handler?: Function): any;
on(type: string | string[], modifiersOrHandler: string[] | EventHandler, handler?: EventHandler): IHandle;
toMap(screenPoint: ScreenPoint, mapPoint?: Point): Point;
toScreen(point: Point, screenPoint?: ScreenPoint): ScreenPoint;
}
@@ -6257,11 +6246,11 @@ declare namespace __esri {
export const View: ViewConstructor;
interface ViewProperties extends BreakpointsOwnerProperties, DOMContainerProperties {
allLayerViews?: Collection;
allLayerViews?: Collection | any[];
animation?: ViewAnimationProperties;
graphics?: Collection;
graphics?: Collection | any[];
interacting?: boolean;
layerViews?: Collection;
layerViews?: Collection | any[];
map?: MapProperties;
padding?: ViewPadding;
ready?: boolean;
@@ -6502,7 +6491,7 @@ declare namespace __esri {
export const Presentation: PresentationConstructor;
interface PresentationProperties {
slides?: Collection;
slides?: Collection | any[];
}
interface Slide extends Accessor {
@@ -6736,7 +6725,7 @@ declare namespace __esri {
interface LayerListProperties extends WidgetProperties {
createActionsFunction?: Function;
operationalItems?: Collection;
operationalItems?: Collection | any[];
view?: MapView | SceneView;
viewModel?: LayerListViewModelProperties;
}
@@ -6813,7 +6802,6 @@ declare namespace __esri {
features: Graphic[];
location: Point;
promises: IPromise<any>[];
rendered: boolean;
selectedFeature: Graphic;
selectedFeatureIndex: number;
title: string;
@@ -6836,7 +6824,7 @@ declare namespace __esri {
export const Popup: PopupConstructor;
interface PopupProperties extends WidgetteProperties {
actions?: Collection;
actions?: Collection | any[];
content?: string | any;
currentDockPosition?: string;
dockEnabled?: boolean;
@@ -6845,7 +6833,6 @@ declare namespace __esri {
features?: GraphicProperties[];
location?: PointProperties;
promises?: IPromise<any>[];
rendered?: boolean;
selectedFeature?: GraphicProperties;
selectedFeatureIndex?: number;
title?: string;
@@ -7142,7 +7129,7 @@ declare namespace __esri {
interface BasemapGalleryViewModelProperties {
activeBasemap?: BasemapProperties;
items?: Collection;
items?: Collection | any[];
source?: LocalBasemapsSource | PortalBasemapsSource;
state?: string;
view?: MapView | SceneView;
@@ -7245,7 +7232,7 @@ declare namespace __esri {
interface LayerListViewModelProperties {
createActionsFunction?: Function;
operationalItems?: Collection;
operationalItems?: Collection | any[];
state?: string;
view?: MapView | SceneView;
}
@@ -7356,7 +7343,7 @@ declare namespace __esri {
export const PopupViewModel: PopupViewModelConstructor;
interface PopupViewModelProperties {
actions?: Collection;
actions?: Collection | any[];
content?: string | any;
featureCount?: number;
features?: GraphicProperties[];
@@ -7491,6 +7478,17 @@ declare namespace __esri {
view?: MapView | SceneView;
}
interface Evented {
hasEventListener(type: string): boolean;
on(type: string, listener: EventHandler): IHandle;
}
interface EventedConstructor {
new(): Evented;
}
export const Evented: EventedConstructor;
interface JSONSupport {
toJSON(): any;
}
@@ -7627,14 +7625,14 @@ declare namespace __esri {
export const ArcGISDynamicMapService: ArcGISDynamicMapServiceConstructor;
interface ArcGISDynamicMapServiceProperties {
allSublayers?: Collection;
allSublayers?: Collection | any[];
dpi?: number;
gdbVersion?: string;
imageFormat?: string;
imageMaxHeight?: number;
imageMaxWidth?: number;
imageTransparency?: boolean;
sublayers?: Collection;
sublayers?: Collection | any[];
}
interface ArcGISImageService {
@@ -7809,7 +7807,7 @@ declare namespace __esri {
export const LayersMixin: LayersMixinConstructor;
interface LayersMixinProperties {
layers?: Collection;
layers?: Collection | any[];
}
interface BreakpointsOwner {
@@ -7833,7 +7831,7 @@ declare namespace __esri {
}
interface DOMContainer {
container: string;
container: HTMLDivElement | string;
height: number;
popup: Popup;
resizing: boolean;
@@ -7850,7 +7848,7 @@ declare namespace __esri {
export const DOMContainer: DOMContainerConstructor;
interface DOMContainerProperties {
container?: string;
container?: HTMLDivElement | string;
height?: number;
popup?: Popup;
resizing?: boolean;
@@ -8381,6 +8379,8 @@ declare module "esri" {
export import EasingFunction = __esri.EasingFunction;
export import EventHandler = __esri.EventHandler;
export import PromisedWatchHandle = __esri.PromisedWatchHandle;
export import GroundQueryElevationOptions = __esri.GroundQueryElevationOptions;
@@ -8748,11 +8748,6 @@ declare module "esri" {
export import sizeGetSchemesParams = __esri.sizeGetSchemesParams;
}
declare module "esri/core/Evented" {
import Evented = __esri.Evented;
export = Evented;
}
declare module "esri/Basemap" {
import Basemap = __esri.Basemap;
export = Basemap;
@@ -9833,6 +9828,11 @@ declare module "esri/widgets/Zoom/ZoomViewModel" {
export = ZoomViewModel;
}
declare module "esri/core/Evented" {
import Evented = __esri.Evented;
export = Evented;
}
declare module "esri/core/JSONSupport" {
import JSONSupport = __esri.JSONSupport;
export = JSONSupport;
@@ -2,8 +2,6 @@ import esri = require("esri");
import Map = require("esri/map");
import Point = require("esri/geometry/Point");
export = MapController;
class MapController {
map: Map;
@@ -8,4 +8,4 @@ point = {
spatialReference: {
wkid: 4326
}
};
};
+2 -5
View File
@@ -1,4 +1,4 @@
// Type definitions for arcgis-to-geojson-utils 10.4
// Type definitions for ArcGIS REST API 10.4
// Project: http://resources.arcgis.com/en/help/arcgis-rest-api/
// Definitions by: Jeff Jacobson <https://github.com/JeffJacobson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -65,7 +65,6 @@ export interface BezierCurve {
export type JsonCurve = CircularArc | Arc | OldCircularArc | BezierCurve;
export interface SpatialReferenceWkid {
wkid?: number;
latestWkid?: number;
@@ -131,7 +130,6 @@ export interface Envelope extends Geometry {
export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" | "esriGeometryPolyline" | "esriGeometryPolygon" | "esriGeometryEnvelope";
export type Color = [number, number, number, number];
export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle";
export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid";
@@ -181,7 +179,6 @@ export interface PictureSourced {
"angle"?: number;
"xoffset"?: number;
"yoffset"?: number;
}
export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced {
@@ -217,4 +214,4 @@ export interface TextSymbol extends MarkerSymbol {
"kerning"?: boolean;
"font"?: Font;
"text"?: string; // only applicable when specified as a client-side graphic.
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
@@ -14,7 +14,7 @@ const geojsonPoint: GeoJSON.Point = {
};
// parse ArcGIS JSON, convert it to GeoJSON
var geojson = utils.arcgisToGeoJSON(arcgisPoint);
const geojson = utils.arcgisToGeoJSON(arcgisPoint);
// take GeoJSON and convert it to ArcGIS JSON
var arcgis = utils.geojsonToArcGIS(geojsonPoint);
const arcgis = utils.geojsonToArcGIS(geojsonPoint);
+1 -1
View File
@@ -15,4 +15,4 @@ export function arcgisToGeoJSON<T extends ArcGis.Geometry>(arcgis: T): GeoJSON.G
/**
* Converts a GeoJSON geometry into a ArcGIS geometry.
*/
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+33 -11
View File
@@ -1,19 +1,41 @@
import Archiver = require('archiver');
import FS = require('fs');
import * as Archiver from 'archiver';
import * as fs from 'fs';
var archiver = Archiver.create('zip');
const archiver = Archiver.create('zip');
var writeStream = FS.createWriteStream('./archiver.d.ts');
var readStream = FS.createReadStream('./archiver.d.ts');
const writeStream = fs.createWriteStream('./archiver.d.ts');
const readStream = fs.createReadStream('./archiver.d.ts');
archiver.abort();
archiver.pipe(writeStream);
archiver.append(readStream, {name: 'archiver.d.ts'});
archiver.finalize();
archiver.append(readStream, { name: 'archiver.d.ts' });
archiver.append(readStream, {name: 'archiver.d.ts'})
.append(readStream, {name: 'archiver.d.ts'});
archiver.bulk({ mappaing: {} });
archiver.directory('./path', './someOtherPath');
archiver.directory('./path', { name: "testName"} );
archiver.directory('./path', { name: "testName" });
archiver.directory('./', "", {});
archiver.directory('./', {name: 'test'}, {});
archiver.directory('./', { name: 'test' }, {});
archiver.bulk({ mappaing: {} });
archiver.append(readStream, {
name: "sub/folder.xml"
});
archiver.glob("**", {
cwd: 'path/to/files',
});
archiver.glob('./path', {}, {});
archiver.file('./path', { name: 'test' });
archiver.setFormat('zip');
archiver.setModule(() => {});
archiver.pointer();
archiver.use(() => {});
archiver.finalize();
+38 -19
View File
@@ -1,47 +1,66 @@
// Type definitions for archiver v0.15.0
// Type definitions for archiver 1.3
// Project: https://github.com/archiverjs/node-archiver
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>
// Definitions by: Esri <https://github.com/archiverjs/node-archiver>, Dolan Miu <https://github.com/dolanmiu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/* =================== USAGE ===================
import Archiver = require('archiver);
var archiver = Archiver.create('zip');
archiver.pipe(FS.createWriteStream('xxx'));
archiver.append(FS.createReadStream('xxx'));
archiver.pipe(fs.createWriteStream('xxx'));
archiver.append(fs.createReadStream('xxx'));
archiver.finalize();
=============================================== */
/// <reference types="node" />
import * as FS from 'fs';
import * as STREAM from 'stream';
import * as fs from 'fs';
import * as stream from 'stream';
import * as express from 'express';
import * as glob from 'glob';
declare function archiver(format: string, options?: archiver.Options): archiver.Archiver;
declare function archiver(format: archiver.Format, options?: archiver.ArchiverOptions): archiver.Archiver;
declare namespace archiver {
type Format = 'zip' | 'tar';
export function create(format: string, options?: Options): Archiver;
function create(format: string, options?: ArchiverOptions): Archiver;
function registerFormat(format: string, module: Function): void;
export interface nameInterface {
interface EntryData {
name?: string;
prefix?: string;
stats?: string;
}
export interface Archiver extends STREAM.Transform {
append(source: STREAM.Readable | Buffer | string, name: nameInterface): void;
interface Archiver extends stream.Transform {
abort(): this;
append(source: stream.Readable | Buffer | string, name?: EntryData): this;
directory(dirpath: string, destpath: nameInterface | string): void;
directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void;
bulk(mappings: any): this;
bulk(mappings: any): void;
finalize(): void;
directory(dirpath: string, options: EntryData | string, data?: EntryData): this;
file(filename: string, data: EntryData): this;
glob(pattern: string, options?: glob.IOptions, data?: EntryData): this;
finalize(): this;
pipe(stream: fs.WriteStream | express.Response): void;
setFormat(format: string): this;
setModule(module: Function): this;
pointer(): number;
use(plugin: Function): this;
}
export interface Options {
interface ArchiverOptions {
store?: boolean;
gzip?: boolean;
gzipOptions?: {
level: number,
};
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"ban-types": false
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -2,4 +2,4 @@ import arrayUniq = require("array-uniq");
arrayUniq([1, 1, 2, 3, 3]);
arrayUniq(["foo", "foo", "bar", "foo"]);
arrayUniq(["foo", "foo", "bar", "foo"]);
+1 -1
View File
@@ -5,4 +5,4 @@
declare function arrayUniq<T>(arr: T[]): T[];
export = arrayUniq;
export = arrayUniq;
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -29,4 +29,4 @@ artyom.getVoices();
artyom.getLanguage();
// Get the artyom.js version
artyom.getVersion();
artyom.getVersion();
+20 -20
View File
@@ -22,16 +22,16 @@ interface SpeechRecognition extends EventTarget {
start(): void;
stop(): void;
abort(): void;
onaudiostart: (ev: Event) => any;
onsoundstart: (ev: Event) => any;
onspeechstart: (ev: Event) => any;
onspeechend: (ev: Event) => any;
onsoundend: (ev: Event) => any;
onresult: (ev: SpeechRecognitionEvent) => any;
onnomatch: (ev: SpeechRecognitionEvent) => any;
onerror: (ev: SpeechRecognitionError) => any;
onstart: (ev: Event) => any;
onend: (ev: Event) => any;
onaudiostart(ev: Event): any;
onsoundstart(ev: Event): any;
onspeechstart(ev: Event): any;
onspeechend(ev: Event): any;
onsoundend(ev: Event): any;
onresult(ev: SpeechRecognitionEvent): any;
onnomatch(ev: SpeechRecognitionEvent): any;
onerror(ev: SpeechRecognitionError): any;
onstart(ev: Event): any;
onend(ev: Event): any;
}
interface SpeechRecognitionStatic {
@@ -106,7 +106,7 @@ interface SpeechSynthesis extends EventTarget {
speaking: boolean;
paused: boolean;
onvoiceschanged: (ev: Event) => any;
onvoiceschanged(ev: Event): any;
speak(utterance: SpeechSynthesisUtterance): void;
cancel(): void;
pause(): void;
@@ -128,13 +128,13 @@ interface SpeechSynthesisUtterance extends EventTarget {
rate: number;
pitch: number;
onstart: (ev: SpeechSynthesisEvent) => any;
onend: (ev: SpeechSynthesisEvent) => any;
onerror: (ev: SpeechSynthesisErrorEvent) => any;
onpause: (ev: SpeechSynthesisEvent) => any;
onresume: (ev: SpeechSynthesisEvent) => any;
onmark: (ev: SpeechSynthesisEvent) => any;
onboundary: (ev: SpeechSynthesisEvent) => any;
onstart(ev: SpeechSynthesisEvent): any;
onend(ev: SpeechSynthesisEvent): any;
onerror(ev: SpeechSynthesisErrorEvent): any;
onpause(ev: SpeechSynthesisEvent): any;
onresume(ev: SpeechSynthesisEvent): any;
onmark(ev: SpeechSynthesisEvent): any;
onboundary(ev: SpeechSynthesisEvent): any;
}
interface SpeechSynthesisUtteranceStatic {
@@ -211,7 +211,7 @@ declare namespace Artyom {
/** Triggers of the command */
indexes: string[];
/** Logic to execute when the command is triggered */
action: (i: number, wildcard?: string, full?: string) => void;
action(i: number, wildcard?: string, full?: string): void;
/** Description of the command */
description?: string;
/** Flag to specify is a command is either normal or smart */
@@ -502,7 +502,7 @@ declare namespace Artyom {
/**
* Method to bla, bla, bla...
*/
static getInstance(): ArtyomJS
static getInstance(): ArtyomJS;
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,16 @@
import * as React from 'react';
import assertEqualJSX = require('assert-equal-jsx');
function sanitizeId(str: string): string {
return str.replace(/my-component-id-(\d+)/ig, 'my-component-id-0');
}
assertEqualJSX(
<div id='my-component-id-314159265' />,
// should equal:
<div id='my-component-id-0' />,
// with sanitization:
{
sanitize: sanitizeId
}
);
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for assert-equal-jsx 1.0
// Project: https://github.com/thejameskyle/assert-equal-jsx
// Definitions by: Josh Toft <https://github.com/seryl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as React from 'react';
declare namespace assertEqualJSX {
interface AsssertOptions {
sanitize?(str: string): string;
}
}
declare function assertEqualJSX(actual: JSX.Element, expected: JSX.Element, opts?: assertEqualJSX.AsssertOptions): void;
export = assertEqualJSX;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"assert-equal-jsx-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
-2
View File
@@ -122,7 +122,6 @@ export function AssertionError(options: any, message ?: string): void;
*/
export function fail(actual: any, expected: any, message: any, operator: any): void;
/**
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
@@ -353,5 +352,4 @@ export function doesNotThrow(block: any, error ?: any, message ?: string): void;
*/
export function ifError(value: any): void;
export as namespace AssertPlus;
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+6
View File
@@ -0,0 +1,6 @@
import * as autosni from "auto-sni";
let a = autosni({
agreeTos: true,
email: '',
domains: ['']
});
+25
View File
@@ -0,0 +1,25 @@
// Type definitions for auto-sni 2.1
// Project: https://www.npmjs.com/package/auto-sni
// Definitions by: Jan Wolf <https://github.com/janwo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import {Server} from "https";
declare namespace createServer {
interface Options {
email: string;
agreeTos: boolean;
domains: Array<string | string[]>;
ports?: {
http?: number,
https?: number
};
debug?: boolean;
}
}
declare function createServer(opts: createServer.Options, app?: any): Server;
export = createServer;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"auto-sni-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+8 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for AutobahnJS v0.9.7
// Project: http://autobahn.ws/js/
// Definitions by: Elad Zelingher <https://github.com/darkl/>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>
// Definitions by: Elad Zelingher <https://github.com/darkl/>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Wladimir Totino <https://github.com/valepu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="when" />
@@ -167,8 +167,14 @@ declare namespace autobahn {
interface IPublishOptions {
acknowledge?: boolean;
exclude?: number[];
exclude_authid?: string[];
exclude_authrole?: string[];
eligible?: number[];
disclose_me?: Boolean;
eligible_authid?: string[];
eligible_authrole?: string[];
retain?: boolean;
disclose_me?: boolean;
exclude_me?: boolean;
}
interface ISubscribeOptions {
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }
+5 -5
View File
@@ -1,6 +1,6 @@
import * as Awesomplete from 'awesomplete';
var input = document.getElementById("myinput");
const input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
new Awesomplete(input, {list: document.querySelector("#mylist")});
@@ -9,7 +9,7 @@ new Awesomplete(input, {
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
});
var awesomplete = new Awesomplete(input);
const awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
@@ -46,15 +46,15 @@ new Awesomplete('input[data-multiple]', {
},
replace: (text: string) => {
var before = this.input.value.match(/^.+,\s*|/)[0];
const before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
var ajax = new XMLHttpRequest();
const ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = () => {
var list = JSON.parse(ajax.responseText).map((i: any) => i.name);
const list = JSON.parse(ajax.responseText).map((i: any) => i.name);
new Awesomplete(document.querySelector("#ajax-example input"), { list });
};
ajax.send();
+10 -10
View File
@@ -6,14 +6,14 @@
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options);
static all: any[];
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static $$(expr: string | NodeSelector, con?: any): NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
regExpEscape(s: { replace(arg0: RegExp, arg1: string): void }): any;
create(tag: string, o: any): HTMLElement;
fire(target: EventTarget, type: string, properties: any): any;
siblingIndex(el: Element): number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
@@ -45,11 +45,11 @@ declare namespace Awesomplete {
minChars?: number;
maxItems?: number;
autoFirst?: boolean;
data?: (item: Suggestion, input: string) => string;
filter?: (text: string, input: string) => boolean;
sort?: (left: number | any[], right: number | any[]) => number;
item?: (text: string, input: string) => HTMLElement;
replace?: (text: string) => void;
data?(item: Suggestion, input: string): string;
filter?(text: string, input: string): boolean;
sort?(left: number | any[], right: number | any[]): number;
item?(text: string, input: string): HTMLElement;
replace?(text: string): void;
}
}
+1 -1
View File
@@ -1 +1 @@
{ "extends": "../tslint.json" }
{ "extends": "dtslint/dt.json" }

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