mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-03 11:41:44 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
+3413
File diff suppressed because it is too large
Load Diff
@@ -144,6 +144,10 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
|
||||
Example where a type parameter is acceptable: `function id<T>(value: T): T;`.
|
||||
Example where it is not acceptable: `function parseJson<T>(json: string): T;`.
|
||||
Exception: `new Map<string, number>()` is OK.
|
||||
* Using the types `Function` and `Object` is almost never a good idea. In 99% of cases it's possible to specify a more specific type. Examples are `(x: number) => number` for [functions](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) and `{ x: number, y: number }` for objects. If there is no certainty at all about the type, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) is the right choice, not `Object`. If the only known fact about the type is that it's some object, use the type [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), not `Object` or `{ [key: string]: any }`.
|
||||
* `var foo: string | any`:
|
||||
When `any` is used in a union type, the resulting type is still `any`. So while the `string` portion of this type annotation may _look_ useful, it in fact offers no additional typechecking over simply using `any`.
|
||||
Depending on the intention, acceptable alternatives could be `any`, `string`, or `string | object`.
|
||||
|
||||
|
||||
#### Removing a package
|
||||
@@ -178,6 +182,18 @@ If a `tslint.json` turns rules off, this is because that hasn't been fixed yet.
|
||||
|
||||
(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.)
|
||||
|
||||
To assert that an expression is of a given type, use `$ExpectType`. To assert that an expression causes a compile error, use `$ExpectError`.
|
||||
|
||||
```js
|
||||
// $ExpectType void
|
||||
f(1);
|
||||
|
||||
// $ExpectError
|
||||
f("one");
|
||||
```
|
||||
|
||||
For more details, see [dtslint](https://github.com/Microsoft/dtslint#write-tests) readme.
|
||||
|
||||
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).
|
||||
|
||||
@@ -187,7 +203,14 @@ This script uses [dtslint](https://github.com/Microsoft/dtslint).
|
||||
#### What exactly is the relationship between this repository and the `@types` packages on NPM?
|
||||
|
||||
The `master` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
This usually happens within an hour of changes being merged.
|
||||
|
||||
#### I've submitted a pull request. How long until it is merged?
|
||||
|
||||
It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or DefinitelyTyped team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs.
|
||||
|
||||
#### My PR is merged; when will the `@types` NPM package be updated?
|
||||
|
||||
NPM packages should update within a few hours. If it's been more than 24 hours, ping @RyanCavanaugh and @andy-ms on the PR to investigate.
|
||||
|
||||
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
|
||||
|
||||
@@ -265,6 +288,17 @@ Also, `/// <reference types=".." />` will not work with path mapping, so depende
|
||||
|
||||
Types for a scoped package `@foo/bar` should go in `types/foo__bar`. Note the double underscore.
|
||||
|
||||
When `dts-gen` is used to scaffold a scoped package, the `paths` property has to be manually adapted in the generated
|
||||
`tsconfig.json` to correctly reference the scoped package:
|
||||
|
||||
```json
|
||||
{
|
||||
"paths":{
|
||||
"@foo/bar": ["foo__bar"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### The file history in GitHub looks incomplete.
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"packages": [
|
||||
{
|
||||
"libraryName": "3d-bin-packing",
|
||||
"typingsPackageName": "3d-bin-packing",
|
||||
"sourceRepoURL": "https://github.com/betterwaysystems/packer",
|
||||
"asOfVersion": "1.1.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "ag-grid",
|
||||
"typingsPackageName": "ag-grid",
|
||||
@@ -18,6 +24,12 @@
|
||||
"sourceRepoURL": "https://github.com/nonplus/angular-ui-router-default",
|
||||
"asOfVersion": "0.0.5"
|
||||
},
|
||||
{
|
||||
"libraryName": "angular-ui-router-uib-modal",
|
||||
"typingsPackageName": "angular-ui-router-uib-modal",
|
||||
"sourceRepoURL": "https://github.com/nonplus/angular-ui-router-uib-modal",
|
||||
"asOfVersion": "0.0.11"
|
||||
},
|
||||
{
|
||||
"libraryName": "antd",
|
||||
"typingsPackageName": "antd",
|
||||
@@ -270,6 +282,12 @@
|
||||
"sourceRepoURL": "https://github.com/blakeembrey/is-upper-case",
|
||||
"asOfVersion": "1.1.2"
|
||||
},
|
||||
{
|
||||
"libraryName": "jpush-react-native",
|
||||
"typingsPackageName": "jpush-react-native",
|
||||
"sourceRepoURL": "https://github.com/jpush/jpush-react-native",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "jquery.ajaxfile",
|
||||
"typingsPackageName": "jquery.ajaxfile",
|
||||
@@ -468,6 +486,12 @@
|
||||
"sourceRepoURL": "https://github.com/getsentry/raven-js",
|
||||
"asOfVersion": "3.10.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "raw-body",
|
||||
"typingsPackageName": "raw-body",
|
||||
"sourceRepoURL": "https://github.com/stream-utils/raw-body",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "react-day-picker",
|
||||
"typingsPackageName": "react-day-picker",
|
||||
@@ -534,6 +558,30 @@
|
||||
"sourceRepoURL": "https://github.com/tildeio/route-recognizer",
|
||||
"asOfVersion": "0.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "router5",
|
||||
"typingsPackageName": "router5",
|
||||
"sourceRepoURL": "https://github.com/router5/router5",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "samchon",
|
||||
"typingsPackageName": "samchon",
|
||||
"sourceRepoURL": "https://github.com/samchon/framework",
|
||||
"asOfVersion": "2.0.22"
|
||||
},
|
||||
{
|
||||
"libraryName": "samchon-framework",
|
||||
"typingsPackageName": "samchon-framework",
|
||||
"sourceRepoURL": "https://github.com/samchon/framework",
|
||||
"asOfVersion": "2.0.21"
|
||||
},
|
||||
{
|
||||
"libraryName": "samchon-library",
|
||||
"typingsPackageName": "samchon-library",
|
||||
"sourceRepoURL": "https://github.com/samchon/framework",
|
||||
"asOfVersion": "0.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "node-scanf",
|
||||
"typingsPackageName": "scanf",
|
||||
@@ -618,6 +666,12 @@
|
||||
"sourceRepoURL": "https://github.com/cbowdon/TsMonad",
|
||||
"asOfVersion": "0.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "tstl",
|
||||
"typingsPackageName": "tstl",
|
||||
"sourceRepoURL": "https://github.com/samchon/tstl",
|
||||
"asOfVersion": "1.5.7"
|
||||
},
|
||||
{
|
||||
"libraryName": "TypeScript",
|
||||
"typingsPackageName": "typescript",
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
"lint": "dtslint types"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "Microsoft/dtslint#production",
|
||||
"dtslint": "github:Microsoft/dtslint#production",
|
||||
"types-publisher": "Microsoft/types-publisher#production"
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -39,7 +39,16 @@ function fix(config: any): any {
|
||||
const out: any = {};
|
||||
for (const key in config) {
|
||||
let value = config[key];
|
||||
out[key] = value;
|
||||
out[key] = key === "rules" ? fixRules(value) : value;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function fixRules(rules: any): any {
|
||||
const out: any = {};
|
||||
for (const key in rules) {
|
||||
out[key] = rules[key];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
import packer = require("3d-bin-packing");
|
||||
import samchon = require("samchon");
|
||||
|
||||
function main(): void
|
||||
{
|
||||
///////////////////////////
|
||||
// CONSTRUCT OBJECTS
|
||||
///////////////////////////
|
||||
let wrapperArray: bws.packer.WrapperArray = new packer.WrapperArray();
|
||||
let instanceArray: bws.packer.InstanceArray = new packer.InstanceArray();
|
||||
|
||||
// Wrappers
|
||||
wrapperArray.push
|
||||
(
|
||||
new packer.Wrapper("Large", 1000, 40, 40, 15, 0),
|
||||
new packer.Wrapper("Medium", 700, 20, 20, 10, 0),
|
||||
new packer.Wrapper("Small", 500, 15, 15, 8, 0)
|
||||
);
|
||||
|
||||
///////
|
||||
// Each Instance is repeated #15
|
||||
///////
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Eraser", 1, 2, 5));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Book", 15, 30, 3));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Drink", 3, 3, 10));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Product("Umbrella", 5, 5, 20));
|
||||
|
||||
// Wrappers also can be packed into another Wrapper.
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Notebook-Box", 2000, 30, 40, 4, 2));
|
||||
instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Tablet-Box", 2500, 20, 28, 2, 0));
|
||||
|
||||
///////////////////////////
|
||||
// BEGINS PACKING
|
||||
///////////////////////////
|
||||
// CONSTRUCT PACKER
|
||||
let my_packer: bws.packer.Packer = new packer.Packer(wrapperArray, instanceArray);
|
||||
|
||||
///////
|
||||
// PACK (OPTIMIZE)
|
||||
let result: bws.packer.WrapperArray = my_packer.optimize();
|
||||
///////
|
||||
|
||||
///////////////////////////
|
||||
// TRACE PACKING RESULT
|
||||
///////////////////////////
|
||||
let xml: samchon.library.XML = result.toXML();
|
||||
console.log(xml.toString());
|
||||
}
|
||||
|
||||
main();
|
||||
Vendored
-1383
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
import abbrev = require('abbrev');
|
||||
|
||||
let abbrs: { [abbreviation: string]: string; };
|
||||
abbrs = abbrev();
|
||||
abbrs = abbrev('foo', 'fool', 'folding', 'flop');
|
||||
abbrs = abbrev(['foo', 'fool', 'folding', 'flop']);
|
||||
|
||||
abbrev.monkeyPatch();
|
||||
|
||||
abbrs = [].abbrev();
|
||||
const roArr: ReadonlyArray<string> = [];
|
||||
abbrs = roArr.abbrev();
|
||||
abbrs = ({}).abbrev();
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for abbrev 1.1
|
||||
// Project: https://github.com/isaacs/abbrev-js#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = abbrev;
|
||||
|
||||
declare function abbrev(words: string[]): {[abbreviation: string]: string};
|
||||
declare function abbrev(...words: string[]): {[abbreviation: string]: string};
|
||||
|
||||
declare namespace abbrev {
|
||||
function monkeyPatch(): void;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Array<T> {
|
||||
abbrev(): {[abbreviation: string]: string};
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
abbrev(): {[abbreviation: string]: string};
|
||||
}
|
||||
|
||||
interface Object {
|
||||
abbrev(): {[abbreviation: string]: string};
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"raw-body-tests.ts"
|
||||
"abbrev-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Ably Realtime and Rest client library 0.9
|
||||
// Project: https://www.ably.io/
|
||||
// Definitions by: Ably <https://github.com/ably/>
|
||||
// Definitions by: Ably <https://github.com/ably>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export namespace ablyLib {
|
||||
@@ -287,7 +287,7 @@ export namespace ablyLib {
|
||||
}
|
||||
|
||||
// Common Listeners
|
||||
type paginatedResultCallback<T> = (error: ErrorInfo, results: PaginatedResult<T> ) => void;
|
||||
type paginatedResultCallback<T> = (error: ErrorInfo, results: PaginatedResult<T>) => void;
|
||||
type standardCallback = (error: ErrorInfo, results: any) => void;
|
||||
type messageCallback<T> = (message: T) => void;
|
||||
type errorCallback = (error: ErrorInfo) => void;
|
||||
@@ -410,7 +410,7 @@ export namespace ablyLib {
|
||||
state: ConnectionState;
|
||||
close: () => void;
|
||||
connect: () => void;
|
||||
ping: (callback?: (error: ErrorInfo, responseTime: number ) => void ) => void;
|
||||
ping: (callback?: (error: ErrorInfo, responseTime: number) => void) => void;
|
||||
}
|
||||
|
||||
class Stats {
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
// Type definitions for accounting.js 0.4
|
||||
// Project: http://openexchangerates.github.io/accounting.js/
|
||||
// Definitions by: Sergey Gerasimov <https://github.com/gerich-home/>
|
||||
// Christopher Eck <https://github.com/chrisleck/>
|
||||
// Definitions by: Sergey Gerasimov <https://github.com/gerich-home>
|
||||
// Christopher Eck <https://github.com/chrisleck>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace accounting {
|
||||
|
||||
Vendored
+4
-1
@@ -50,7 +50,10 @@ interface Acl {
|
||||
allowedPermissions: (userId: Value, resources: strings, cb?: AnyCallback) => Promise<void>;
|
||||
isAllowed: (userId: Value, resources: strings, permissions: strings, cb?: AllowedCallback) => Promise<boolean>;
|
||||
areAnyRolesAllowed: (roles: strings, resource: strings, permissions: strings, cb?: AllowedCallback) => Promise<any>;
|
||||
whatResources: (roles: strings, permissions: strings, cb?: AnyCallback) => Promise<any>;
|
||||
whatResources: {
|
||||
(roles: strings, cb?: AnyCallback): Promise<any>;
|
||||
(roles: strings, permissions: strings, cb?: AnyCallback): Promise<any>;
|
||||
}
|
||||
permittedResources: (roles: strings, permissions: strings, cb?: Function) => Promise<void>;
|
||||
middleware: (numPathComponents?: number, userId?: Value | GetUserId, actions?: strings) => express.RequestHandler;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,18 @@ acl.isAllowed('joed', 'blogs', 'view', (err, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
acl.whatResources('foo', (err, res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
|
||||
acl.whatResources('foo', 'view', (err, res) => {
|
||||
if (res) {
|
||||
console.log(res);
|
||||
}
|
||||
});
|
||||
|
||||
acl.isAllowed('jsmith', 'blogs', ['edit','view','delete'])
|
||||
.then((result) => {
|
||||
console.dir('jsmith is allowed blogs ' + result);
|
||||
|
||||
@@ -14,9 +14,7 @@ let obj5 = new ActiveXObject('ADODB.Stream');
|
||||
let pathToExcelFile = 'C:\\path\\to\\excel\\file.xlsx';
|
||||
let conn = new ActiveXObject('ADODB.Connection');
|
||||
conn.Provider = 'Microsoft.ACE.OLEDB.12.0';
|
||||
conn.ConnectionString =
|
||||
'Data Source="' + pathToExcelFile + '";' +
|
||||
'Extended Properties="Excel 12.0;HDR=Yes"';
|
||||
conn.ConnectionString = `Data Source="${pathToExcelFile}";Extended Properties="Excel 12.0;HDR=Yes"`;
|
||||
conn.Open();
|
||||
|
||||
// create a Command to access the data
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"activex-helpers": "*"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx
|
||||
|
||||
// Generates a string describing the drive type of a given Drive object.
|
||||
let showDriveType = (drive: Scripting.Drive) => {
|
||||
function showDriveType(drive: Scripting.Drive) {
|
||||
switch (drive.DriveType) {
|
||||
case Scripting.DriveTypeConst.Removable:
|
||||
return 'Removeable';
|
||||
@@ -16,15 +16,15 @@ let showDriveType = (drive: Scripting.Drive) => {
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Generates a string describing the attributes of a file or folder.
|
||||
let showFileAttributes = (file: Scripting.File) => {
|
||||
let attr = file.Attributes;
|
||||
function showFileAttributes(file: Scripting.File) {
|
||||
const attr = file.Attributes;
|
||||
if (attr === 0) {
|
||||
return 'Normal';
|
||||
}
|
||||
let attributeStrings: string[] = [];
|
||||
const attributeStrings: string[] = [];
|
||||
if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); }
|
||||
if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); }
|
||||
if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); }
|
||||
@@ -34,22 +34,22 @@ let showFileAttributes = (file: Scripting.File) => {
|
||||
if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); }
|
||||
if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); }
|
||||
return attributeStrings.join(',');
|
||||
};
|
||||
}
|
||||
|
||||
// source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx
|
||||
let showFreeSpace = (drvPath: string) => {
|
||||
let fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
let d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
let s = 'Drive ' + drvPath + ' - ';
|
||||
function showFreeSpace(drvPath: string) {
|
||||
const fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
const d = fso.GetDrive(fso.GetDriveName(drvPath));
|
||||
let s = `Drive ${drvPath} - `;
|
||||
s += d.VolumeName + '<br>';
|
||||
s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes';
|
||||
s += `Free Space: ${d.FreeSpace / 1024} Kbytes`;
|
||||
return (s);
|
||||
};
|
||||
}
|
||||
|
||||
// source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx
|
||||
let getALine = (filespec: string) => {
|
||||
let fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
let file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
function getALine(filespec: string) {
|
||||
const fso = new ActiveXObject('Scripting.FileSystemObject');
|
||||
const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false);
|
||||
|
||||
let s = '';
|
||||
while (!file.AtEndOfLine) {
|
||||
@@ -57,4 +57,4 @@ let getALine = (filespec: string) => {
|
||||
}
|
||||
file.Close();
|
||||
return (s);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"activex-helpers": "*"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -7,7 +7,7 @@ let img = commonDialog.ShowAcquireImage();
|
||||
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
|
||||
let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}';
|
||||
if (img.FormatID !== jpegFormatID) {
|
||||
let ip = new ActiveXObject('WIA.ImageProcess');
|
||||
const ip = new ActiveXObject('WIA.ImageProcess');
|
||||
ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID);
|
||||
ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID;
|
||||
img = ip.Apply(img);
|
||||
@@ -24,8 +24,8 @@ if (img.FormatID !== jpegFormatID) {
|
||||
let dev = commonDialog.ShowSelectDevice();
|
||||
if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) {
|
||||
// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these:
|
||||
let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}';
|
||||
let itm = dev.ExecuteCommand(commandID);
|
||||
const commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}';
|
||||
const itm = dev.ExecuteCommand(commandID);
|
||||
|
||||
// with this:
|
||||
// let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture);
|
||||
@@ -36,15 +36,15 @@ dev = commonDialog.ShowSelectDevice();
|
||||
let e = new Enumerator<WIA.Property>(dev.Properties); // no foreach over ActiveX collections
|
||||
e.moveFirst();
|
||||
while (!e.atEnd()) {
|
||||
let p = e.item();
|
||||
let s = p.Name + ' (' + p.PropertyID + ') = ';
|
||||
const p = e.item();
|
||||
let s = `${p.Name} (${p.PropertyID}) = `;
|
||||
if (p.IsVector) {
|
||||
s += '[vector of data]';
|
||||
} else {
|
||||
s += p.Value;
|
||||
if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType) {
|
||||
if (p.Value !== p.SubTypeDefault) {
|
||||
s += ' (Default = ' + p.SubTypeDefault + ')';
|
||||
s += ` (Default = ${p.SubTypeDefault})`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ while (!e.atEnd()) {
|
||||
} else {
|
||||
s += ' [valid values include: ';
|
||||
}
|
||||
let count = p.SubTypeValues.Count;
|
||||
const count = p.SubTypeValues.Count;
|
||||
for (let i = 1; i <= count; i++) {
|
||||
s += p.SubTypeValues.Item(i);
|
||||
if (i < count) {
|
||||
@@ -70,7 +70,7 @@ while (!e.atEnd()) {
|
||||
s += ']';
|
||||
break;
|
||||
case WIA.WiaSubType.RangeSubType:
|
||||
s += ' [valid values in the range from ' + p.SubTypeMin + ' to ' + p.SubTypeMax + ' in increments of ' + p.SubTypeStep + ']';
|
||||
s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"activex-helpers": "*"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
Vendored
+2
@@ -31,6 +31,8 @@ declare namespace adal {
|
||||
resource?: string;
|
||||
extraQueryParameter?: string;
|
||||
navigateToLoginRequestUrl?: boolean;
|
||||
logOutUri?: string;
|
||||
isAngular?: boolean;
|
||||
}
|
||||
|
||||
interface User {
|
||||
|
||||
Vendored
+8
@@ -73,5 +73,13 @@ export { std };
|
||||
export * from "./glosses/common";
|
||||
export * from "./glosses/math";
|
||||
export * from "./glosses/utils";
|
||||
export * from "./glosses/assertion";
|
||||
export * from "./glosses/promise";
|
||||
export * from "./glosses/shani";
|
||||
|
||||
import "./glosses/shani-global";
|
||||
|
||||
export const assert: adone.assertion.I.AssertFunction;
|
||||
export const expect: adone.assertion.I.ExpectFunction;
|
||||
|
||||
export as namespace adone;
|
||||
|
||||
Vendored
+1074
File diff suppressed because it is too large
Load Diff
Vendored
+3
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* predicates
|
||||
*/
|
||||
export namespace is {
|
||||
function _null(obj: any): boolean;
|
||||
export { _null as null };
|
||||
|
||||
Vendored
+3
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* math related things
|
||||
*/
|
||||
export namespace math {
|
||||
namespace I {
|
||||
interface LowHighBits {
|
||||
|
||||
Vendored
+114
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* promise helpers
|
||||
*/
|
||||
export namespace promise {
|
||||
namespace I {
|
||||
interface Deferred<T> {
|
||||
/**
|
||||
* Resolves the promise
|
||||
*/
|
||||
resolve(value?: T): void;
|
||||
|
||||
/**
|
||||
* Rejects the promise
|
||||
*/
|
||||
reject(value?: any): void;
|
||||
|
||||
promise: Promise<T>;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a promise and returns an interface to control the state
|
||||
*/
|
||||
export function defer<T>(): I.Deferred<T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be resolved after given milliseconds
|
||||
*
|
||||
* @param ms delay in milliseconds
|
||||
* @param value resolving value
|
||||
*/
|
||||
export function delay<T>(ms: number, value?: T): Promise<T>;
|
||||
|
||||
/**
|
||||
* Creates a promise that will be rejected after given milliseconds if the given promise is not fulfilled
|
||||
*
|
||||
* @param ms timeout in milliseconds
|
||||
*/
|
||||
export function timeout<T>(promise: Promise<T>, ms: number): Promise<T>;
|
||||
|
||||
/**
|
||||
* Converts a promise to node.js style callback
|
||||
*/
|
||||
export function nodeify<T>(promise: Promise<T>, callback: (err?: any, value?: T) => void): Promise<T>;
|
||||
|
||||
namespace I {
|
||||
interface PromisifyOptions {
|
||||
/**
|
||||
* Context to bind to new function
|
||||
*/
|
||||
context?: object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a callback function to a promise-based function
|
||||
*/
|
||||
export function promisify<R>(fn: (callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): () => Promise<R>;
|
||||
export function promisify<T, R>(fn: (a: T, callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): (a: T) => Promise<R>;
|
||||
export function promisify<T>(fn: (a: T, callback: (err?: any) => void) => void, options?: I.PromisifyOptions): (a: T) => Promise<void>;
|
||||
export function promisify<T1, T2, R>(fn: (a: T1, b: T2, callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2) => Promise<R>;
|
||||
export function promisify<T1, T2>(fn: (a: T1, b: T2, callback: (err?: any) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, R>(fn: (a: T1, b: T2, c: T3, callback: (err?: any, result?: R) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2, c: T3) => Promise<R>;
|
||||
export function promisify<T1, T2, T3>(fn: (a: T1, b: T2, c: T3, callback: (err?: any) => void) => void, options?: I.PromisifyOptions): (a: T1, b: T2, c: T3) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, T4, R>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, callback: (err?: any, result?: R) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4) => Promise<R>;
|
||||
export function promisify<T1, T2, T3, T4>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, callback: (err?: any) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4) => Promise<void>;
|
||||
export function promisify<T1, T2, T3, T4, T5, R>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, e: T5, callback: (err?: any, result?: R) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise<R>;
|
||||
export function promisify<T1, T2, T3, T4, T5>(
|
||||
fn: (a: T1, b: T2, c: T3, d: T4, callback: (err?: any) => void) => void,
|
||||
options?: I.PromisifyOptions
|
||||
): (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise<void>;
|
||||
export function promisify(fn: (...args: any[]) => void, options?: I.PromisifyOptions): (...args: any[]) => Promise<any>;
|
||||
|
||||
namespace I {
|
||||
interface PromisifyAllOptions {
|
||||
/**
|
||||
* Suffix to use for keys
|
||||
*/
|
||||
suffix?: string;
|
||||
|
||||
/**
|
||||
* Function to filter keys
|
||||
*/
|
||||
|
||||
filter?(key: string): boolean;
|
||||
/**
|
||||
* Context to bind to new functions
|
||||
*/
|
||||
context?: object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Promisifies entire object
|
||||
*/
|
||||
export function promisifyAll(source: object, options?: I.PromisifyAllOptions): object;
|
||||
|
||||
/**
|
||||
* Executes a function after promise fulfillment
|
||||
*
|
||||
* @returns the original promise
|
||||
*/
|
||||
function _finally<T>(promise: Promise<T>, onFinally?: (...args: any[]) => void): Promise<T>;
|
||||
export { _finally as finally };
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Defines a tests block
|
||||
*/
|
||||
declare const describe: adone.shani.I.DescribeFunction;
|
||||
|
||||
/**
|
||||
* Defines a tests block
|
||||
*/
|
||||
declare const context: adone.shani.I.DescribeFunction;
|
||||
|
||||
/**
|
||||
* Defines a test
|
||||
*/
|
||||
declare const it: adone.shani.I.TestFunction;
|
||||
|
||||
/**
|
||||
* Defines a test
|
||||
*/
|
||||
declare const specify: adone.shani.I.TestFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called only once before the block's tests
|
||||
*/
|
||||
declare const before: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called only once after the block's tests
|
||||
*/
|
||||
declare const after: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called before each test
|
||||
*/
|
||||
declare const beforeEach: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* Defines a hook that will be called after each test
|
||||
*/
|
||||
declare const afterEach: adone.shani.I.HookFunction;
|
||||
|
||||
/**
|
||||
* assertion functions
|
||||
*/
|
||||
declare const assert: adone.assertion.I.AssertFunction;
|
||||
|
||||
/**
|
||||
* bdd-style assertion functons
|
||||
*/
|
||||
declare const expect: adone.assertion.I.ExpectFunction;
|
||||
|
||||
/**
|
||||
* tools for installing controllable timer functions
|
||||
*/
|
||||
declare const fakeClock: adone.util.I.fakeClock.FakeClock;
|
||||
|
||||
/**
|
||||
* defines a spy function
|
||||
*/
|
||||
declare const spy: typeof adone.shani.util.spy;
|
||||
|
||||
/**
|
||||
* defines a stub function
|
||||
*/
|
||||
declare const stub: typeof adone.shani.util.stub;
|
||||
|
||||
/**
|
||||
* defines a mock function
|
||||
*/
|
||||
declare const mock: typeof adone.shani.util.mock;
|
||||
|
||||
/**
|
||||
* defines a matcher for spies/stubs/mocks
|
||||
*/
|
||||
declare const match: typeof adone.shani.util.match;
|
||||
|
||||
/**
|
||||
* assertion tool for http server responses
|
||||
*/
|
||||
declare const request: typeof adone.shani.util.request;
|
||||
Vendored
+1655
File diff suppressed because it is too large
Load Diff
Vendored
+12
-1
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* various utility functions
|
||||
*/
|
||||
export namespace util {
|
||||
function arrify<T>(val: T[]): T[];
|
||||
function arrify<T>(val: T): [T];
|
||||
@@ -184,6 +187,14 @@ export namespace util {
|
||||
}
|
||||
function jsesc(argument: any, options?: I.JSEscOptions): string;
|
||||
|
||||
namespace I {
|
||||
type PossibleTypes = "object" | "class" | "null" | "global" | "Array" | "RegExp" | "Date"
|
||||
| "Promise" | "Set" | "Map" | "WeakSet" | "DataView" | "Map Iterator" | "Set Iterator"
|
||||
| "Array Iterator" | "String Iterator" | "Object" | "function" | "boolean" | "number"
|
||||
| "undefined" | "string" | "symbol";
|
||||
}
|
||||
|
||||
function typeOf(obj: any): I.PossibleTypes;
|
||||
function typeOf(obj: any): string;
|
||||
|
||||
namespace memcpy {
|
||||
@@ -394,7 +405,7 @@ export namespace util {
|
||||
interface FakeClock {
|
||||
timers: Timers;
|
||||
createClock(now?: number, loopLimit?: number): Clock;
|
||||
install(now: number | Date | InstallOptions): InstalledClock;
|
||||
install(now?: number | Date | InstallOptions): InstalledClock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,653 @@
|
||||
namespace assertionTests {
|
||||
const { assertion } = adone;
|
||||
|
||||
namespace assertionInterface {
|
||||
namespace exception {
|
||||
const a: adone.x.Exception = new assertion.AssertionError();
|
||||
const b: adone.x.Exception = new assertion.AssertionError("hello");
|
||||
const c: adone.x.Exception = new assertion.AssertionError("hello", { actual: 2, expected: 3 }, () => {});
|
||||
}
|
||||
|
||||
namespace config {
|
||||
assertion.config.includeStack = true;
|
||||
assertion.config.proxyExcludedKeys = ["a"];
|
||||
assertion.config.showDiff = false;
|
||||
assertion.config.truncateThreshold = 20;
|
||||
assertion.config.useProxy = false;
|
||||
}
|
||||
|
||||
namespace loadInterfaces {
|
||||
assertion.loadAssertInterface().config.includeStack = true;
|
||||
assertion.loadExpectInterface().config.includeStack = true;
|
||||
assertion.loadMockInterface().config.includeStack = true;
|
||||
}
|
||||
|
||||
namespace use {
|
||||
assertion.use(() => {}).use(() => {}).config.includeStack = true;
|
||||
}
|
||||
}
|
||||
|
||||
const { assert } = assertion;
|
||||
|
||||
namespace assertTests {
|
||||
assert(1);
|
||||
assert(1, "hello");
|
||||
assert.fail();
|
||||
assert.fail(1);
|
||||
assert.fail(1, 2);
|
||||
assert.fail(1, 2, "hello");
|
||||
assert.fail(1, 2, "hello", "<");
|
||||
|
||||
assert.isOk(1);
|
||||
assert.isOk(1, "hello");
|
||||
|
||||
assert.isNotOk(1);
|
||||
assert.isNotOk(1, "hello");
|
||||
|
||||
assert.equal(1, 2);
|
||||
assert.equal(1, 2, "hello");
|
||||
|
||||
assert.notEqual(1, 2);
|
||||
assert.notEqual(1, 2, "hello");
|
||||
|
||||
assert.strictEqual(1, 2);
|
||||
assert.strictEqual(1, 2, "hello");
|
||||
|
||||
assert.notStrictEqual(1, 2);
|
||||
assert.notStrictEqual(1, 2, "hello");
|
||||
|
||||
assert.deepEqual(1, 2);
|
||||
assert.deepEqual(1, 2, "hello");
|
||||
|
||||
assert.deepStrictEqual(1, 2);
|
||||
assert.deepStrictEqual(1, 2, "hello");
|
||||
|
||||
assert.equalArrays([1, 2, 3], [4, 5, 6]);
|
||||
assert.equalArrays([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notDeepEqual(1, 2);
|
||||
assert.notDeepEqual(1, 2, "hello");
|
||||
|
||||
assert.isAbove(1, 2);
|
||||
assert.isAbove(1, 2, "hello");
|
||||
|
||||
assert.isAtLeast(1, 2);
|
||||
assert.isAtLeast(1, 2, "hello");
|
||||
|
||||
assert.isBelow(1, 2);
|
||||
assert.isBelow(1, 2, "hello");
|
||||
|
||||
assert.isAtMost(1, 2);
|
||||
assert.isAtMost(1, 2, "hello");
|
||||
|
||||
assert.isTrue(1);
|
||||
assert.isTrue(1, "hello");
|
||||
|
||||
assert.isNotTrue(1);
|
||||
assert.isNotTrue(1, "hello");
|
||||
|
||||
assert.isFalse(1);
|
||||
assert.isFalse(1, "hello");
|
||||
|
||||
assert.isNotFalse(1);
|
||||
assert.isNotFalse(1, "hello");
|
||||
|
||||
assert.isNull(1);
|
||||
assert.isNull(1, "hello");
|
||||
|
||||
assert.isNaN(1);
|
||||
assert.isNaN(1, "hello");
|
||||
|
||||
assert.isNotNaN(1);
|
||||
assert.isNotNaN(1, "hello");
|
||||
|
||||
assert.exists(1);
|
||||
assert.exists(1, "hello");
|
||||
|
||||
assert.notExists(1);
|
||||
assert.notExists(1, "hello");
|
||||
|
||||
assert.isUndefined(1);
|
||||
assert.isUndefined(1, "hello");
|
||||
|
||||
assert.isDefined(1);
|
||||
assert.isDefined(1, "hello");
|
||||
|
||||
assert.isFunction(1);
|
||||
assert.isFunction(1, "hello");
|
||||
|
||||
assert.isNotFunction(1);
|
||||
assert.isNotFunction(1, "hello");
|
||||
|
||||
assert.isObject(1);
|
||||
assert.isObject(1, "hello");
|
||||
|
||||
assert.isNotObject(1);
|
||||
assert.isNotObject(1, "hello");
|
||||
|
||||
assert.isArray(1);
|
||||
assert.isArray(1, "hello");
|
||||
|
||||
assert.isNotArray(1);
|
||||
assert.isNotArray(1, "hello");
|
||||
|
||||
assert.isString(1, "hello");
|
||||
|
||||
assert.isNotString(1);
|
||||
assert.isNotString(1, "hello");
|
||||
|
||||
assert.isNumber(1);
|
||||
assert.isNumber(1, "hello");
|
||||
|
||||
assert.isNotNumber(1);
|
||||
assert.isNotNumber(1, "hello");
|
||||
|
||||
assert.isFinite(1);
|
||||
assert.isFinite(1, "hello");
|
||||
|
||||
assert.isBoolean(1);
|
||||
assert.isBoolean(1, "hello");
|
||||
|
||||
assert.isNotBoolean(1);
|
||||
assert.isNotBoolean(1, "hello");
|
||||
|
||||
assert.typeOf(1, "string");
|
||||
assert.typeOf(1, "number", "hello");
|
||||
|
||||
assert.notTypeOf(1, "string");
|
||||
assert.notTypeOf(1, "number", "hello");
|
||||
|
||||
assert.instanceOf(1, Date);
|
||||
class A {}
|
||||
assert.instanceOf("4", A, "hello");
|
||||
|
||||
assert.notInstanceOf(1, Date);
|
||||
assert.notInstanceOf(Date, A, "hello");
|
||||
|
||||
assert.include([1, 2, 3], 4);
|
||||
assert.include([1, 2, 3], 4, "hello");
|
||||
assert.include("string", "string");
|
||||
assert.include("string", "string", "string");
|
||||
|
||||
assert.notInclude([1, 2, 3], 4);
|
||||
assert.notInclude([1, 2, 3], 4, "hello");
|
||||
assert.notInclude("string", "string");
|
||||
assert.notInclude("string", "string", "string");
|
||||
|
||||
assert.deepInclude([1, 2, 3], 4);
|
||||
assert.deepInclude([1, 2, 3], 4, "hello");
|
||||
assert.deepInclude("string", "string");
|
||||
assert.deepInclude("string", "string", "string");
|
||||
|
||||
assert.notDeepInclude([1, 2, 3], 4);
|
||||
assert.notDeepInclude([1, 2, 3], 4, "hello");
|
||||
assert.notDeepInclude("string", "string");
|
||||
assert.notDeepInclude("string", "string", "string");
|
||||
|
||||
assert.nestedInclude({ a: 1 }, {});
|
||||
assert.nestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notNestedInclude({ a: 1 }, {});
|
||||
assert.notNestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.deepNestedInclude({ a: 1 }, {});
|
||||
assert.deepNestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notDeepNestedInclude({ a: 1 }, {});
|
||||
assert.notDeepNestedInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.ownInclude({ a: 1 }, {});
|
||||
assert.ownInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notOwnInclude({ a: 1 }, {});
|
||||
assert.notOwnInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.deepOwnInclude({ a: 1 }, {});
|
||||
assert.deepOwnInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.notDeepOwnInclude({ a: 1 }, {});
|
||||
assert.notDeepOwnInclude({ a: 1 }, {}, "hello");
|
||||
|
||||
assert.match("1", /\d+/);
|
||||
assert.match("1", /\d+/, "hello");
|
||||
|
||||
assert.notMatch("1", /\d+/);
|
||||
assert.notMatch("1", /\d+/, "hello");
|
||||
|
||||
assert.property({ a: 1 }, "a");
|
||||
assert.property({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.notProperty({ a: 1 }, "a");
|
||||
assert.notProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.propertyVal({ a: 1 }, "a", 1);
|
||||
assert.propertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.deepPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.deepPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notDeepPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notDeepPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.ownProperty({ a: 1 }, "a");
|
||||
assert.ownProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.notOwnProperty({ a: 1 }, "a");
|
||||
assert.notOwnProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.ownPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.ownPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.deepOwnPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.deepOwnPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notDeepOwnPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notDeepOwnPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.nestedProperty({ a: 1 }, "a");
|
||||
assert.nestedProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.notNestedProperty({ a: 1 }, "a");
|
||||
assert.notNestedProperty({ a: 1 }, "a", "hello");
|
||||
|
||||
assert.nestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.nestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notNestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notNestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.deepNestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.deepNestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.notDeepNestedPropertyVal({ a: 1 }, "a", 1);
|
||||
assert.notDeepNestedPropertyVal({ a: 1 }, "a", 1, "hello");
|
||||
|
||||
assert.lengthOf([1, 2, 3], 3);
|
||||
assert.lengthOf([1, 2, 3], 3, "hello");
|
||||
|
||||
assert.hasAnyKeys({ a: 1 }, "a");
|
||||
assert.hasAnyKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAnyKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAnyKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAnyKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.hasAllKeys({ a: 1 }, "a");
|
||||
assert.hasAllKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAllKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAllKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAllKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.containsAllKeys({ a: 1 }, "a");
|
||||
assert.containsAllKeys({ a: 1 }, ["a"]);
|
||||
assert.containsAllKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.containsAllKeys({ a: 1 }, { a: 1 });
|
||||
assert.containsAllKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAnyKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.hasAnyDeepKeys({ a: 1 }, "a");
|
||||
assert.hasAnyDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAnyDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAnyDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAnyDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.hasAllDeepKeys({ a: 1 }, "a");
|
||||
assert.hasAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.hasAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.hasAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.hasAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.containsAllDeepKeys({ a: 1 }, "a");
|
||||
assert.containsAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.containsAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.containsAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.containsAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAnyDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, "a");
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"]);
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, ["a"], "hello");
|
||||
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 });
|
||||
assert.doesNotHaveAllDeepKeys({ a: 1 }, { a: 1 }, "hello");
|
||||
|
||||
assert.throws(() => {});
|
||||
assert.throws(() => {}, Error);
|
||||
assert.throws(() => {}, Error, /\d+/);
|
||||
assert.throws(() => {}, Error, "string");
|
||||
assert.throws(() => {}, Error, "string", "hello");
|
||||
|
||||
assert.throws(async () => {}).then(() => 42);
|
||||
assert.throws(async () => {}, Error).then(() => 42);
|
||||
assert.throws(async () => {}, Error, /\d+/).then(() => 42);
|
||||
assert.throws(async () => {}, Error, "string").then(() => 42);
|
||||
assert.throws(async () => {}, Error, "string", "hello").then(() => 42);
|
||||
|
||||
assert.doesNotThrow(() => {});
|
||||
assert.doesNotThrow(() => {}, Error);
|
||||
assert.doesNotThrow(() => {}, Error, /\d+/);
|
||||
assert.doesNotThrow(() => {}, Error, "string");
|
||||
assert.doesNotThrow(() => {}, Error, "string", "hello");
|
||||
|
||||
assert.doesNotThrow(async () => {}).then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error).then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error, /\d+/).then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error, "string").then(() => 42);
|
||||
assert.doesNotThrow(async () => {}, Error, "string", "hello").then(() => 42);
|
||||
|
||||
assert.operator(1, "<", 2);
|
||||
assert.operator(1, "<", 2, "hello");
|
||||
|
||||
assert.closeTo(1, 2, 1);
|
||||
assert.closeTo(1, 2, 1, "hello");
|
||||
|
||||
assert.approximately(1, 2, 2);
|
||||
assert.approximately(1, 2, 2, "hello");
|
||||
|
||||
assert.sameMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.sameMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notSameMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.notSameMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.sameDeepMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.sameDeepMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notSameDeepMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.notSameDeepMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.sameOrderedMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.sameOrderedMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.notSameOrderedMembers([1, 2, 3], [4, 5, 6]);
|
||||
assert.notSameOrderedMembers([1, 2, 3], [4, 5, 6], "hello");
|
||||
|
||||
assert.includeMembers([1, 2, 3], [3]);
|
||||
assert.includeMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.includeDeepMembers([1, 2, 3], [3]);
|
||||
assert.includeDeepMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeDeepMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeDeepMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.includeOrderedMembers([1, 2, 3], [3]);
|
||||
assert.includeOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeOrderedMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.includeDeepOrderedMembers([1, 2, 3], [3]);
|
||||
assert.includeDeepOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.notIncludeDeepOrderedMembers([1, 2, 3], [3]);
|
||||
assert.notIncludeDeepOrderedMembers([1, 2, 3], [3], "hello");
|
||||
|
||||
assert.oneOf(1, [1, 2, 3]);
|
||||
assert.oneOf(1, [1, 2, 3], "hello");
|
||||
|
||||
assert.changes(() => {}, {}, "a");
|
||||
assert.changes(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.changesBy(() => {}, {}, "a", 2);
|
||||
assert.changesBy(() => {}, {}, "a", 2, "hello");
|
||||
|
||||
assert.doesNotChange(() => {}, {}, "a");
|
||||
assert.doesNotChange(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.changesButNotBy(() => {}, {}, "a", 20);
|
||||
assert.changesButNotBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.increases(() => {}, {}, "a");
|
||||
assert.increases(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.increasesBy(() => {}, {}, "a", 20);
|
||||
assert.increasesBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.doesNotIncrease(() => {}, {}, "a");
|
||||
assert.doesNotIncrease(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.increasesButNotBy(() => {}, {}, "a", 20);
|
||||
assert.increasesButNotBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.decreases(() => {}, {}, "a");
|
||||
assert.decreases(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.decreasesBy(() => {}, {}, "a", 20);
|
||||
assert.decreasesBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.doesNotDecrease(() => {}, {}, "a");
|
||||
assert.doesNotDecrease(() => {}, {}, "a", "hello");
|
||||
|
||||
assert.doesNotDecreaseBy(() => {}, {}, "a", 20);
|
||||
assert.doesNotDecreaseBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.decreasesButNotBy(() => {}, {}, "a", 20);
|
||||
assert.decreasesButNotBy(() => {}, {}, "a", 20, "hello");
|
||||
|
||||
assert.ifError(1);
|
||||
|
||||
assert.isExtensible({});
|
||||
assert.isExtensible({}, "hello");
|
||||
|
||||
assert.isNotExtensible({});
|
||||
assert.isNotExtensible({}, "hello");
|
||||
|
||||
assert.isSealed({});
|
||||
assert.isSealed({}, "hello");
|
||||
|
||||
assert.isNotSealed({});
|
||||
assert.isNotSealed({}, "hello");
|
||||
|
||||
assert.isFrozen({});
|
||||
assert.isFrozen({}, "hello");
|
||||
|
||||
assert.isNotFrozen({});
|
||||
assert.isNotFrozen({}, "hello");
|
||||
|
||||
assert.isEmpty({});
|
||||
assert.isEmpty({}, "hello");
|
||||
}
|
||||
|
||||
const { expect } = assertion;
|
||||
|
||||
namespace expectTests {
|
||||
expect(1);
|
||||
expect(1, "hello");
|
||||
expect.fail(1, 2);
|
||||
expect.fail(1, 2, "hello");
|
||||
expect.fail(1, 2, "hello", "+");
|
||||
expect(1).to.be.been.is.and.has.have.with.that.which.at.of.same.but.does.not.deep.nested.own.ordered.any.all.a("number");
|
||||
expect(1).to.be.a("number", "hello").and;
|
||||
expect(1).to.be.an("array").and;
|
||||
expect(1).to.be.an("array", "hello").and;
|
||||
expect(1).to.include(1).and;
|
||||
expect(1).to.include(1, "hello").and;
|
||||
expect(1).but.includes(2).and;
|
||||
expect(1).but.includes(2, "hello").and;
|
||||
expect(1).to.contain(2).and;
|
||||
expect(1).to.contain(2, "hello").and;
|
||||
expect(1).but.contains(2).and;
|
||||
expect(1).but.contains(2, "hello").and;
|
||||
expect(1).to.ok.not.ok;
|
||||
expect(1).to.be.true.but.false;
|
||||
expect(1).to.be.false.but.true;
|
||||
expect(1).to.be.null.and.null;
|
||||
expect(1).to.be.undefined.and.true;
|
||||
expect(1).to.be.NaN.and.null;
|
||||
expect(1).to.exist.and.be.null;
|
||||
expect(1).to.be.empty.and.true;
|
||||
expect(1).to.be.arguments.and.a("number");
|
||||
expect(1).to.be.Arguments.and.false;
|
||||
expect(1).to.be.equal(2).and;
|
||||
expect(1).to.be.equal(2, "hello").and;
|
||||
expect(1).but.equals(2).and;
|
||||
expect(1).but.equals(2, "hello").and;
|
||||
expect(1).to.eq(2).and;
|
||||
expect(1).to.eq(2, "hello").and;
|
||||
expect(1).but.eqls(2).and;
|
||||
expect(1).but.eqls(2, "hello").and;
|
||||
expect(1).to.eqlArray([1, 2, 3]).and;
|
||||
expect(1).to.eqlArray([1, 2, 3], "hello").and;
|
||||
expect(1).to.be.above(2).and;
|
||||
expect(1).to.be.above(2, "hello").and;
|
||||
expect(1).to.be.gt(2).and;
|
||||
expect(1).to.be.gt(2, "hello").and;
|
||||
expect(1).to.be.greaterThan(2).and;
|
||||
expect(1).to.be.greaterThan(2, "hello").and;
|
||||
expect(1).to.be.at.least(10).and;
|
||||
expect(1).to.be.at.least(10, "hello").and;
|
||||
expect(1).to.be.gte(10).and;
|
||||
expect(1).to.be.gte(10, "hello").and;
|
||||
expect(1).to.be.below(100).and;
|
||||
expect(1).to.be.below(100, "hello").and;
|
||||
expect(1).to.be.lt(10).and;
|
||||
expect(1).to.be.lt(10, "hello").and;
|
||||
expect(1).to.be.lessThan(10, "hello").and;
|
||||
expect(1).to.be.at.most(10).and;
|
||||
expect(1).to.be.at.most(10, "hello").and;
|
||||
expect(1).to.be.lte(10).and;
|
||||
expect(1).to.be.lte(10, "hello").and;
|
||||
expect(1).to.be.within(1, 10).and;
|
||||
expect(1).to.be.within(1, 10, "hello").and;
|
||||
expect(1).to.be.instanceof(Number).and;
|
||||
expect(1).to.be.instanceof(Number, "hello").and;
|
||||
expect(1).to.be.instanceOf(Number).and;
|
||||
expect(1).to.be.instanceOf(Number, "hello").and;
|
||||
expect(1).to.have.property("a").and;
|
||||
expect(1).to.have.property("a", 1).and;
|
||||
expect(1).to.have.property("a", 1, "hello").and;
|
||||
expect(1).to.have.ownProperty("a").and;
|
||||
expect(1).to.have.ownProperty("a", 1).and;
|
||||
expect(1).to.have.ownProperty("a", 1, "hello").and;
|
||||
expect(1).to.haveOwnProperty("a").and;
|
||||
expect(1).to.haveOwnProperty("a", 1).and;
|
||||
expect(1).to.haveOwnProperty("a", 1, "hello").and;
|
||||
expect(1).to.have.ownPropertyDescriptor("a").and;
|
||||
expect(1).to.have.ownPropertyDescriptor("a", {}).and;
|
||||
expect(1).to.have.ownPropertyDescriptor("a", {}, "hello").and;
|
||||
expect(1).to.haveOwnPropertyDescriptor("a").and;
|
||||
expect(1).to.haveOwnPropertyDescriptor("a", {}).and;
|
||||
expect(1).to.haveOwnPropertyDescriptor("a", {}, "hello").and;
|
||||
expect("a").to.have.length(1).and;
|
||||
expect("a").to.have.length(1, "hello").and;
|
||||
expect("a").to.have.lengthOf(1).and;
|
||||
expect("a").to.have.lengthOf(1, "hello").and;
|
||||
expect(1).to.match(/\d+/).and;
|
||||
expect(1).to.match(/\d+/, "hello").and;
|
||||
expect(1).to.have.string("1230").and;
|
||||
expect(1).to.have.string("1230", "hello").and;
|
||||
expect(1).to.have.key("a").and;
|
||||
expect(1).to.have.key("a", "b").and;
|
||||
expect(1).to.have.key(["a", "b"]).and;
|
||||
expect(1).to.have.key({ a: 1, b: 2 }).and;
|
||||
expect(1).to.have.keys("a").and;
|
||||
expect(1).to.have.keys("a", "b").and;
|
||||
expect(1).to.have.keys(["a", "b"]).and;
|
||||
expect(1).to.have.keys({ a: 1, b: 2 }).and;
|
||||
expect(() => {}).to.throw().and;
|
||||
expect(() => {}).to.throw(Error).and;
|
||||
expect(() => {}).to.throw(Error, "string").and;
|
||||
expect(() => {}).to.throw(Error, "string", "hello").and;
|
||||
expect(() => {}).to.throw(Error, /\d+/).and;
|
||||
expect(() => {}).to.throw(Error, /\d+/, "hello").and;
|
||||
expect(() => {}).but.throws().and;
|
||||
expect(() => {}).but.throws(Error).and;
|
||||
expect(() => {}).but.throws(Error, "string").and;
|
||||
expect(() => {}).but.throws(Error, "string", "hello").and;
|
||||
expect(() => {}).but.throws(Error, /\d+/).and;
|
||||
expect(() => {}).but.throws(Error, /\d+/, "hello").and;
|
||||
expect(1).to.respondTo("a").and;
|
||||
expect(1).to.respondTo("a", "hello").and;
|
||||
expect(1).to.respondsTo("a").and;
|
||||
expect(1).to.respondsTo("a", "hello").and;
|
||||
expect(1).itself.to.respondsTo("a").and;
|
||||
expect(1).to.satisfy(() => true).and;
|
||||
expect(1).to.satisfy(() => true, "hello").and;
|
||||
expect(1).but.satisfies(() => true).and;
|
||||
expect(1).but.satisfies(() => true, "hello").and;
|
||||
expect(1).to.be.closeTo(2, 1).and;
|
||||
expect(1).to.be.closeTo(2, 1, "hello").and;
|
||||
expect(1).to.be.approximately(1, 2).and;
|
||||
expect(1).to.be.approximately(1, 2, "hello").and;
|
||||
expect(1).to.have.members([1, 2, 3]).and;
|
||||
expect(1).to.have.members([1, 2, 3], "hello").and;
|
||||
expect(1).to.be.oneOf([1, 2, 3]).and;
|
||||
expect(1).to.be.oneOf([1, 2, 3], "hello").and;
|
||||
expect(() => {}).to.change(() => {}).and;
|
||||
expect(() => {}).to.change({}, "a").and;
|
||||
expect(() => {}).to.change({}, "a", "hello").and;
|
||||
expect(() => {}).but.changes(() => {}).and;
|
||||
expect(() => {}).but.changes({}, "a").and;
|
||||
expect(() => {}).but.changes({}, "a", "hello").and;
|
||||
expect(() => {}).to.increase({}).and;
|
||||
expect(() => {}).to.increase({}, "a").and;
|
||||
expect(() => {}).to.increase({}, "a", "hello").and;
|
||||
expect(() => {}).but.increases({}).and;
|
||||
expect(() => {}).but.increases({}, "a").and;
|
||||
expect(() => {}).but.increases({}, "a", "hello").and;
|
||||
expect(() => {}).to.decrease({}).and;
|
||||
expect(() => {}).to.decrease({}, "a").and;
|
||||
expect(() => {}).to.decrease({}, "a", "hello").and;
|
||||
expect(() => {}).but.decreases({}).and;
|
||||
expect(() => {}).but.decreases({}, "a").and;
|
||||
expect(() => {}).but.decreases({}, "a", "hello").and;
|
||||
expect(() => {}).to.decreases({}).by(2).and;
|
||||
expect(() => {}).to.decreases({}).by(2, "hello").and;
|
||||
expect({}).to.be.extensible.and;
|
||||
expect({}).to.be.sealed.and;
|
||||
expect({}).to.be.frozen.and;
|
||||
expect({}).to.be.finite.and;
|
||||
|
||||
namespace mockTests {
|
||||
const s1 = adone.shani.util.spy();
|
||||
const s2 = adone.shani.util.spy();
|
||||
|
||||
expect(s1).to.have.been.called;
|
||||
expect(s1).to.have.been.calledOnce;
|
||||
expect(s1).to.have.been.calledTwice;
|
||||
expect(s1).to.have.been.calledThrice;
|
||||
expect(s1).to.have.callCount(100);
|
||||
expect(s1).to.have.been.calledBefore(s2);
|
||||
expect(s1).to.have.been.calledAfter(s2);
|
||||
expect(s1).to.have.been.calledImmediatelyAfter(s2);
|
||||
expect(s1).to.have.been.calledImmediatelyBefore(s2);
|
||||
expect(s1).to.have.been.calledOn({});
|
||||
expect(s1).to.have.been.calledOn({});
|
||||
expect(s1).to.have.been.calledWith(1, 2, 3);
|
||||
expect(s1).to.have.been.calledWithExactly(1, 2, 3);
|
||||
expect(s1).to.have.returned(1);
|
||||
expect(s1).to.have.thrown({});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
namespace promiseTests {
|
||||
const { promise } = adone;
|
||||
|
||||
namespace defer {
|
||||
const a = promise.defer();
|
||||
a.promise.then((x) => 2);
|
||||
a.resolve(2);
|
||||
a.reject(3);
|
||||
const b = promise.defer<string>();
|
||||
b.resolve("3");
|
||||
b.reject(2);
|
||||
b.promise.then((x: string) => x);
|
||||
}
|
||||
|
||||
namespace delay {
|
||||
const a: Promise<any> = promise.delay(10);
|
||||
const b: Promise<number> = promise.delay(10, 2);
|
||||
promise.delay(20, "3").then((x: string) => x);
|
||||
}
|
||||
|
||||
namespace timeout {
|
||||
promise.timeout(Promise.resolve(2), 100).then((x: number) => x);
|
||||
}
|
||||
|
||||
namespace nodeify {
|
||||
promise.nodeify(Promise.resolve(2), (err: any, value: number) => value).then((x: number) => x);
|
||||
promise.nodeify(Promise.resolve(2), () => 42).then((x: number) => x);
|
||||
}
|
||||
|
||||
namespace promisify {
|
||||
type Callback<T> = (err?: any, result?: T) => void;
|
||||
namespace noargs {
|
||||
const f = (cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)().then((x: number) => { });
|
||||
}
|
||||
namespace nargs1 {
|
||||
const f = (a: number, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1).then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs2 {
|
||||
const f = (a: number, b: string, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1").then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs3 {
|
||||
const f = (a: number, b: string, c: number, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1", 1).then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs4 {
|
||||
const f = (a: number, b: string, c: number, d: string, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1", 1, "1").then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace nargs5 {
|
||||
const f = (a: number, b: string, c: number, d: string, e: number, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, "1", 1, "1", 1).then((x: number) => { });
|
||||
}
|
||||
|
||||
namespace moreargs {
|
||||
const f = (a: number, b: string, c: number, d: string, e: number, f: string, cb: Callback<number>) => {
|
||||
cb(null, 32);
|
||||
};
|
||||
promise.promisify(f)(1, 2, 3).then((x) => x);
|
||||
}
|
||||
|
||||
namespace options {
|
||||
promise.promisify((cb: Callback<number>) => cb(null, 42), {});
|
||||
promise.promisify((cb: Callback<number>) => cb(null, 42), { context: {} });
|
||||
}
|
||||
}
|
||||
|
||||
namespace promisifyAll {
|
||||
const a: object = promise.promisifyAll({});
|
||||
promise.promisifyAll({}, {});
|
||||
promise.promisifyAll({}, { context: {} });
|
||||
promise.promisifyAll({}, { filter: () => true });
|
||||
promise.promisifyAll({}, { suffix: "Async" });
|
||||
}
|
||||
|
||||
namespace _finally {
|
||||
promise.finally(Promise.resolve(2), () => 2).then((x: number) => {});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
namespace shaniGlobalTests {
|
||||
namespace describeTests {
|
||||
describe("hello", () => {});
|
||||
|
||||
describe("hello", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
describe("1", "2", "3", "4", "45", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
describe("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
context("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace itTests {
|
||||
it("should be here", () => {});
|
||||
|
||||
it("should be here", function () {
|
||||
this.timeout(100);
|
||||
this.skip();
|
||||
this.a;
|
||||
});
|
||||
|
||||
it("should be here", function (done: () => void) {
|
||||
this.timeout(1000);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
|
||||
it("hello", {}, () => {});
|
||||
|
||||
it("hello", {
|
||||
skip: true
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
skip: () => true
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
timeout: () => 1202
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
timeout: 1010
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
before() {}
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
before: ["hello", () => {}]
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
after() {}
|
||||
}, () => {});
|
||||
|
||||
it("hello", {
|
||||
after: ["hello", () => {}]
|
||||
}, () => {});
|
||||
|
||||
specify("hello", {
|
||||
after: ["hello", () => {}]
|
||||
}, () => {});
|
||||
}
|
||||
|
||||
namespace beforeTests {
|
||||
before(function() {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
before("description", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
before("description", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterTests {
|
||||
after(function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
after("description", function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
after("description", function (done) {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace beforeEachTests {
|
||||
beforeEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
beforeEach("hello", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
beforeEach("hello", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterEachTests {
|
||||
afterEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
afterEach("asd", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
afterEach("asd", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
expect(1).to.be.a("number");
|
||||
assert.equal(1, 1);
|
||||
fakeClock.install().tick(100);
|
||||
stub()(1, 2, 3);
|
||||
expect(spy()).to.have.been.calledOnce;
|
||||
match(2).and(match(2));
|
||||
mock().alwaysCalledOn({});
|
||||
request({}).expectBody("");
|
||||
}
|
||||
@@ -0,0 +1,544 @@
|
||||
namespace shaniTests {
|
||||
const { shani } = adone;
|
||||
|
||||
namespace engineOptionsTests {
|
||||
new shani.Engine();
|
||||
new shani.Engine({});
|
||||
new shani.Engine({ callGc: true });
|
||||
new shani.Engine({ defaultTimeout: 1000 });
|
||||
new shani.Engine({ defaultHookTimeout: 1000 });
|
||||
new shani.Engine({ transpilerOptions: {} });
|
||||
}
|
||||
|
||||
namespace contextTests {
|
||||
const e = new adone.shani.Engine();
|
||||
const c = e.context();
|
||||
|
||||
namespace describeTests {
|
||||
c.describe("hello", () => {});
|
||||
|
||||
c.describe("hello", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.describe("1", "2", "3", "4", "45", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.describe("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.context("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", function () {
|
||||
this.skip();
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace itTests {
|
||||
c.it("should be here", () => {});
|
||||
|
||||
c.it("should be here", function () {
|
||||
this.timeout(100);
|
||||
this.skip();
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.it("should be here", function (done) {
|
||||
this.timeout(100);
|
||||
this.skip();
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.it("hello", {}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
skip: true
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
skip: () => true
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
timeout: () => 1202
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
timeout: 1010
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
before() { }
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
before: ["hello", () => { }]
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
after() { }
|
||||
}, () => { });
|
||||
|
||||
c.it("hello", {
|
||||
after: ["hello", () => { }]
|
||||
}, () => { });
|
||||
|
||||
c.specify("hello", {
|
||||
after: ["hello", () => { }]
|
||||
}, () => { });
|
||||
}
|
||||
|
||||
namespace beforeTests {
|
||||
c.before(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.before("description", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.before("description", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterTests {
|
||||
c.after(function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.after("description", function () {
|
||||
this.timeout(10);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.after("description", function (done) {
|
||||
this.timeout(10);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace beforeEachTests {
|
||||
c.beforeEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.beforeEach("hello", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.beforeEach("hello", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace afterEachTests {
|
||||
c.afterEach(function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.afterEach("asd", function () {
|
||||
this.timeout(100);
|
||||
this.a;
|
||||
});
|
||||
|
||||
c.afterEach("asd", function (done) {
|
||||
this.timeout(100);
|
||||
done();
|
||||
this.a;
|
||||
});
|
||||
}
|
||||
|
||||
namespace rootTests {
|
||||
const { root } = c;
|
||||
root.children[0];
|
||||
root.prepare().then((x) => { });
|
||||
root.addChild(root);
|
||||
const check = (hook: adone.shani.I.Hook) => {
|
||||
hook.run().then((x) => x);
|
||||
hook.cause();
|
||||
hook.failed() === true;
|
||||
hook.timeout() + 2;
|
||||
hook.timeout(10).timeout(10).timeout() + 2;
|
||||
};
|
||||
for (const hook of root.beforeHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
for (const hook of root.afterHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
for (const hook of root.beforeEachHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
for (const hook of root.afterEachHooks()) {
|
||||
check(hook);
|
||||
}
|
||||
root.isInclusive() === true;
|
||||
root.isExclusive() === false;
|
||||
root.hasInclusive() === true;
|
||||
root.skip().only().skip();
|
||||
const a: number | null = root.timeout();
|
||||
root.timeout(100).timeout(100);
|
||||
root.level() + 2;
|
||||
root.level(2).level() + 2;
|
||||
root.chain().toLowerCase();
|
||||
root.blockChain()[0].blockChain()[0].addChild(root);
|
||||
}
|
||||
|
||||
namespace eventEmitterTests {
|
||||
const a = c.start();
|
||||
a.on("enter block", ({ block }) => {
|
||||
block.addChild(block);
|
||||
}).on("exit block", ({ block }) => {
|
||||
block.addChild(block);
|
||||
}).on("start test", ({ block, test }) => {
|
||||
block.addChild(test);
|
||||
test.chain();
|
||||
}).on("end test", ({ block, test, meta }) => {
|
||||
block.addChild(test);
|
||||
test.chain();
|
||||
meta.err;
|
||||
meta.elapsed + 2;
|
||||
}).on("start before hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end before hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start after hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end after hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start before each hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end before each hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start after each hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end after each hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start before test hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end before test hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("start after test hook", ({ block, hook }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
}).on("end after test hook", ({ block, hook, meta }) => {
|
||||
block.addChild(block);
|
||||
hook.desctiption;
|
||||
meta.err;
|
||||
meta.elapsed;
|
||||
}).on("error", (err) => {}).on("done", () => {}).stop();
|
||||
}
|
||||
}
|
||||
|
||||
namespace utilTests {
|
||||
const { util } = shani;
|
||||
|
||||
namespace spyCallTests {
|
||||
const call = util.spy().firstCall;
|
||||
call.calledBefore(call) === true;
|
||||
call.calledAfter(call) === true;
|
||||
call.calledWithNew(call) === true;
|
||||
call.thisValue;
|
||||
call.args[0];
|
||||
call.exception;
|
||||
call.returnValue;
|
||||
call.calledOn({}) === true;
|
||||
call.calledWith(1, 2, 3) === true;
|
||||
call.calledWithExactly(1, 2, 3) === true;
|
||||
call.calledWithMatch(1, 2, 3) === true;
|
||||
call.notCalledWith(1, 2, 3) === true;
|
||||
call.notCalledWithMatch(1, 2, 3) === true;
|
||||
call.returned(1) === true;
|
||||
call.threw() === true;
|
||||
call.threw("12") === true;
|
||||
call.threw({}) === true;
|
||||
call.callArg(1);
|
||||
call.callArgOn(1, {});
|
||||
call.callArgWith(1, 1, 2, 3);
|
||||
call.callArgOnWith(1, {}, 1, 2, 3);
|
||||
call.yield(1, 2, 3);
|
||||
call.yieldOn({}, 1, 2, 3);
|
||||
call.yieldToOn("a", {}, 1, 2, 3);
|
||||
}
|
||||
|
||||
namespace spyTests {
|
||||
util.spy().alwaysCalledOn({});
|
||||
util.spy(() => { }).alwaysCalledOn({});
|
||||
const a: number = util.spy().callCount;
|
||||
const s = util.spy();
|
||||
s.called === true;
|
||||
s.notCalled === true;
|
||||
s.calledOnce === true;
|
||||
s.calledTwice === true;
|
||||
s.calledThrice === true;
|
||||
s.firstCall.args;
|
||||
s.secondCall.args;
|
||||
s.thirdCall.args;
|
||||
s.lastCall.args;
|
||||
s.thisValues[0];
|
||||
s.args[0][0];
|
||||
s.exceptions[0];
|
||||
s.returnValues[0];
|
||||
s(1, 2, 3);
|
||||
s.calledBefore(s);
|
||||
s.calledAfter(s);
|
||||
s.calledImmediatelyAfter(s);
|
||||
s.calledImmediatelyBefore(s);
|
||||
s.calledWithNew() === true;
|
||||
s.withArgs(1, 2, 3).firstCall.args;
|
||||
s.alwaysCalledOn({}) === true;
|
||||
s.alwaysCalledWith(1, 2, 3) === true;
|
||||
s.alwaysCalledWithExactly(1, 2, 3) === true;
|
||||
s.alwaysCalledWithMatch(1, 2, 3) === true;
|
||||
s.neverCalledWith(1, 2, 3) === true;
|
||||
s.neverCalledWithMatch(1, 2, 3) === true;
|
||||
s.alwaysThrew() === true;
|
||||
s.alwaysThrew("a") === true;
|
||||
s.alwaysThrew({}) === true;
|
||||
s.alwaysReturned({}) === true;
|
||||
s.invokeCallback(1, 2, 3);
|
||||
s.getCall(0).args;
|
||||
s.getCalls()[0].args;
|
||||
s.reset();
|
||||
s.printf("%s", "1").toLowerCase();
|
||||
s.restore();
|
||||
}
|
||||
|
||||
namespace stubTests {
|
||||
util.stub({});
|
||||
class A {
|
||||
a() {}
|
||||
}
|
||||
util.stub(new A(), "a").resetHistory();
|
||||
const s = util.stub();
|
||||
s.resetBehavior();
|
||||
s.resetHistory();
|
||||
s.usingPromise({}).alwaysCalledOn(2);
|
||||
s.returns({}).resetBehavior();
|
||||
s.returnsArg(1).resetBehavior();
|
||||
s.returnsThis().resetBehavior();
|
||||
s.resolves().resetBehavior();
|
||||
s.resolves(1).resetBehavior();
|
||||
s.throws().resetBehavior();
|
||||
s.throws("1").resetBehavior();
|
||||
s.throwsArg(1).resetBehavior();
|
||||
s.throwsException().resetBehavior();
|
||||
s.throwsException("1").resetBehavior();
|
||||
s.throwsException({}).resetBehavior();
|
||||
s.rejects().resetBehavior();
|
||||
s.rejects("string").resetBehavior();
|
||||
s.rejects(1).resetBehavior();
|
||||
s.callsArg(1).resetBehavior();
|
||||
s.callThrough().resetBehavior();
|
||||
s.callsArgOn(1, {}).resetBehavior();
|
||||
s.callsArgOnWith(1, {}, 123).resetBehavior();
|
||||
s.callsArgAsync(1).resetBehavior();
|
||||
s.callsArgOnAsync(1, {}).resetBehavior();
|
||||
s.callsArgOnWithAsync(1, {}, 1, 2, 3).resetBehavior();
|
||||
s.callsFake(() => { }).resetBehavior();
|
||||
s.get(() => { }).resetBehavior();
|
||||
s.set((v) => 1).resetBehavior();
|
||||
s.onCall(1).resetBehavior();
|
||||
s.onFirstCall().resetBehavior();
|
||||
s.onSecondCall().resetBehavior();
|
||||
s.onThirdCall().resetBehavior();
|
||||
s.value(1).resetBehavior();
|
||||
s.yields(1, 2, 3).resetBehavior();
|
||||
s.yieldsOn({}, 1, 2).resetBehavior();
|
||||
s.yieldsRight(1, 2, 3).resetBehavior();
|
||||
s.yieldsTo("a", 1, 2, 3).resetBehavior();
|
||||
s.yieldsToOn("a", {}, 1, 2, 3).resetBehavior();
|
||||
s.yieldsAsync(1, 2, 3).resetBehavior();
|
||||
s.yieldsOnAsync({}, 1, 2, 3).resetBehavior();
|
||||
s.yieldsToAsync("a", 1, 2, 3).resetBehavior();
|
||||
s.yieldsToOnAsync("1", {}, 1, 2, 3).resetBehavior();
|
||||
s.withArgs(1, 2, 3).resetBehavior();
|
||||
}
|
||||
|
||||
namespace expectationTests {
|
||||
util.expectation.create("");
|
||||
const e = util.expectation.create();
|
||||
e.atLeast(1).never();
|
||||
e.atMost(2).never();
|
||||
e.never().never();
|
||||
e.once().never();
|
||||
e.twice().never();
|
||||
e.thrice().never();
|
||||
e.exactly(1).never();
|
||||
e.withArgs(1, 2, 3).never();
|
||||
e.withExactArgs(1, 2, 3).never();
|
||||
e.on({}).never();
|
||||
e.verify().never();
|
||||
e.restore();
|
||||
}
|
||||
|
||||
namespace mockTests {
|
||||
util.mock().never();
|
||||
util.mock({}).expects("").restore();
|
||||
util.mock({}).verify();
|
||||
}
|
||||
|
||||
namespace assertTests {
|
||||
util.assert.failException;
|
||||
util.assert.fail();
|
||||
util.assert.fail("1");
|
||||
util.assert.pass(1);
|
||||
const s = util.spy();
|
||||
util.assert.notCalled(s);
|
||||
util.assert.called(s);
|
||||
util.assert.calledOnce(s);
|
||||
util.assert.calledTwice(s);
|
||||
util.assert.calledThrice(s);
|
||||
util.assert.callCount(s, 10);
|
||||
util.assert.callOrder(s, s, s, s);
|
||||
util.assert.calledOn(s, {});
|
||||
util.assert.calledOn(s, {});
|
||||
util.assert.alwaysCalledOn(s, {});
|
||||
util.assert.calledWith(s, {});
|
||||
util.assert.neverCalledWith(s, {});
|
||||
util.assert.calledWithExactly(s, {});
|
||||
util.assert.alwaysCalledWithExactly(s, {});
|
||||
util.assert.calledWithMatch(s, {});
|
||||
util.assert.alwaysCalledWithMatch(s, {});
|
||||
util.assert.neverCalledWithMatch(s, {});
|
||||
util.assert.threw(s);
|
||||
util.assert.threw(s, "a");
|
||||
util.assert.threw(s, {});
|
||||
util.assert.alwaysThrew(s);
|
||||
util.assert.alwaysThrew(s, "");
|
||||
util.assert.alwaysThrew(s, {});
|
||||
util.assert.expose({});
|
||||
util.assert.expose({}, { includeFail: true });
|
||||
util.assert.expose({}, { prefix: "a" });
|
||||
}
|
||||
|
||||
namespace matchTests {
|
||||
util.match(1).and(util.match(1));
|
||||
util.match("1").and(util.match(1));
|
||||
util.match(/1/).and(util.match(1));
|
||||
util.match({}).and(util.match(1));
|
||||
util.match((v: any) => true).and(util.match(1));
|
||||
util.match((v: any) => true, "a").and(util.match(1));
|
||||
util.match.any.and;
|
||||
util.match.defined.and;
|
||||
util.match.truthy.and;
|
||||
util.match.falsy.and;
|
||||
util.match.bool.and;
|
||||
util.match.number.and;
|
||||
util.match.string.and;
|
||||
util.match.object.and;
|
||||
util.match.func.and;
|
||||
util.match.map.contains(new Map());
|
||||
util.match.map.deepEquals(new Map());
|
||||
util.match.set.contains(new Set());
|
||||
util.match.array.contains([]);
|
||||
util.match.array.deepEquals([]);
|
||||
util.match.array.endsWith([]);
|
||||
util.match.array.startsWith([]);
|
||||
util.match.regexp.and;
|
||||
util.match.date.and;
|
||||
util.match.symbol.and;
|
||||
util.match.same({}).and;
|
||||
util.match.typeOf("string").and;
|
||||
util.match.instanceOf({}).and;
|
||||
util.match.has("a").and;
|
||||
util.match.has("a", {}).and;
|
||||
util.match.hasOwn("a").and;
|
||||
util.match.hasOwn("a", {}).and;
|
||||
}
|
||||
|
||||
namespace sandboxTests {
|
||||
util.sandbox.create();
|
||||
util.sandbox.create({});
|
||||
util.sandbox.create({ injectInto: {} });
|
||||
util.sandbox.create({ properties: ["a"] });
|
||||
const s = util.sandbox.create();
|
||||
s.assert.alwaysCalledOn(s.spy(), {});
|
||||
s.spy().args;
|
||||
s.stub().args;
|
||||
s.mock().args;
|
||||
s.restore();
|
||||
s.reset();
|
||||
s.resetHistory();
|
||||
s.resetBehavior();
|
||||
s.usingPromise({}).reset();
|
||||
s.verify();
|
||||
s.verifyAndRestore();
|
||||
}
|
||||
}
|
||||
|
||||
namespace requestTests {
|
||||
const r = request({});
|
||||
r.get("/").head("/").post("/").put("/").options("/");
|
||||
r.attach("fname", "hello");
|
||||
r.attach("fname", "hello", {});
|
||||
r.attach("fname", "hello", { type: "application/javascript" });
|
||||
r.attach("fname", "hello", { filename: "a.js" });
|
||||
r.field("a", "basd");
|
||||
r.send("asd");
|
||||
r.setHeader("Cookie", "key=value");
|
||||
r.auth("user", "pass");
|
||||
r.expect(() => true);
|
||||
r.expect(async () => true);
|
||||
r.expect((response) => {
|
||||
assert.equal(response.statusCode, 200);
|
||||
return response.body.length === 0;
|
||||
});
|
||||
r.expectStatus(200);
|
||||
r.expectStatusMessage("OK");
|
||||
r.expectBody("body");
|
||||
r.expectBody(Buffer.from("body"));
|
||||
r.expectBody(/body/);
|
||||
r.expectBody({ a: 1 });
|
||||
r.expectBody("body", {});
|
||||
r.expectBody("body", { decompress: true });
|
||||
r.expectEmptyBody();
|
||||
r.expectHeader("Cookie", "key=value");
|
||||
r.expectHeaderExists("Cookie");
|
||||
r.then((x: adone.shani.util.I.Response) => {
|
||||
x.statusCode === 200;
|
||||
x.body.fill(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -580,6 +580,7 @@ namespace utilTests {
|
||||
}
|
||||
|
||||
namespace install {
|
||||
util.fakeClock.install();
|
||||
util.fakeClock.install(100);
|
||||
util.fakeClock.install(new Date());
|
||||
util.fakeClock.install({});
|
||||
|
||||
@@ -66,4 +66,6 @@ namespace AdoneRootTests {
|
||||
{ const a: Buffer | string = adone.loadAsset("asset"); }
|
||||
{ const a: object = adone.require("path"); }
|
||||
{ const a: object = adone.package; }
|
||||
{ const a: typeof adone.assertion.assert = adone.assert; }
|
||||
{ const a: typeof adone.assertion.expect = adone.expect; }
|
||||
}
|
||||
|
||||
@@ -23,12 +23,20 @@
|
||||
"glosses/math.d.ts",
|
||||
"glosses/std.d.ts",
|
||||
"glosses/utils.d.ts",
|
||||
"glosses/assertion.d.ts",
|
||||
"glosses/promise.d.ts",
|
||||
"glosses/shani.d.ts",
|
||||
"glosses/shani-global.d.ts",
|
||||
"adone-tests.ts",
|
||||
"test/index.ts",
|
||||
"test/index-import.ts",
|
||||
"test/glosses/common.ts",
|
||||
"test/glosses/math.ts",
|
||||
"test/glosses/std.ts",
|
||||
"test/glosses/utils.ts"
|
||||
"test/glosses/utils.ts",
|
||||
"test/glosses/assertion.ts",
|
||||
"test/glosses/promise.ts",
|
||||
"test/glosses/shani.ts",
|
||||
"test/glosses/shani-global.ts"
|
||||
]
|
||||
}
|
||||
|
||||
+10
-1
@@ -1,8 +1,17 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODOs
|
||||
"align": false,
|
||||
"no-namespace": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"no-single-declare-module": false
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"unified-signatures": false,
|
||||
"space-before-function-paren": false
|
||||
}
|
||||
}
|
||||
+20
-20
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.iterable",
|
||||
"es2015.promise"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"strictNullChecks": true,
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"typeRoots": [ "../" ],
|
||||
"types": [ ]
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.iterable",
|
||||
"es2015.promise"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aframe-tests.ts"
|
||||
"index.d.ts",
|
||||
"aframe-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ import * as Agenda from "agenda";
|
||||
var mongoConnectionString = "mongodb://127.0.0.1/agenda";
|
||||
|
||||
var agenda = new Agenda({ db: { address: mongoConnectionString } });
|
||||
|
||||
|
||||
|
||||
|
||||
agenda.define('delete old users', (job, done) => {
|
||||
|
||||
});
|
||||
|
||||
agenda.on('ready', () => {
|
||||
agenda.every('3 minutes', 'delete old users');
|
||||
|
||||
// Alternatively, you could also do:
|
||||
|
||||
// Alternatively, you could also do:
|
||||
agenda.every('*/3 * * * *', 'delete old users');
|
||||
|
||||
agenda.start();
|
||||
@@ -81,6 +81,8 @@ agenda.stop(function() {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
job.agenda.now('do the hokey pokey');
|
||||
|
||||
job.repeatEvery('10 minutes');
|
||||
|
||||
job.repeatAt('3:30pm');
|
||||
|
||||
Vendored
+6
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Agenda v0.8.9
|
||||
// Type definitions for Agenda v1.0.0
|
||||
// Project: https://github.com/rschmukler/agenda
|
||||
// Definitions by: Meir Gottlieb <https://github.com/meirgottlieb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -337,6 +337,11 @@ declare namespace Agenda {
|
||||
*/
|
||||
attrs: JobAttributes;
|
||||
|
||||
/**
|
||||
* The agenda that created the job.
|
||||
*/
|
||||
agenda: Agenda;
|
||||
|
||||
/**
|
||||
* Specifies an interval on which the job should repeat.
|
||||
* @param interval A human-readable format String, a cron format String, or a Number.
|
||||
|
||||
@@ -3,7 +3,7 @@ import AggregateError = require('aggregate-error');
|
||||
const err = new AggregateError([new Error('foo'), 'bar']);
|
||||
|
||||
for (const el of Array.from(err)) {
|
||||
let err: Error = el;
|
||||
const err: Error = el;
|
||||
}
|
||||
|
||||
throw err;
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for alertify 0.3.11
|
||||
// Project: http://fabien-d.github.io/alertify.js/
|
||||
// Definitions by: John Jeffery <http://github.com/jjeffery>
|
||||
// Definitions by: John Jeffery <https://github.com/jjeffery>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var alertify: alertify.IAlertifyStatic;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import * as Alexa from "alexa-sdk";
|
||||
|
||||
const handler = (event: Alexa.RequestBody<Alexa.Request>, context: Alexa.Context, callback: () => void) => {
|
||||
let alexa = Alexa.handler(event, context);
|
||||
const alexa = Alexa.handler(event, context);
|
||||
alexa.resources = {};
|
||||
alexa.registerHandlers(handlers);
|
||||
alexa.execute();
|
||||
};
|
||||
|
||||
let handlers: Alexa.Handlers<Alexa.Request> = {
|
||||
const handlers: Alexa.Handlers<Alexa.Request> = {
|
||||
'LaunchRequest': function() {
|
||||
this.emit('SayHello');
|
||||
},
|
||||
|
||||
Vendored
+25
-1
@@ -7,7 +7,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void ): AlexaObject<T>;
|
||||
export function handler<T>(event: RequestBody<T>, context: Context, callback?: (err: any, response: any) => void): AlexaObject<T>;
|
||||
export function CreateStateHandler(state: string, obj: any): any;
|
||||
export let StateString: string;
|
||||
|
||||
@@ -98,10 +98,34 @@ export interface Request {
|
||||
locale?: string;
|
||||
}
|
||||
|
||||
export interface ResolutionStatus {
|
||||
code: string;
|
||||
}
|
||||
|
||||
export interface ResolutionValue {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface ResolutionValueContainer {
|
||||
value: ResolutionValue;
|
||||
}
|
||||
|
||||
export interface Resolution {
|
||||
authority: string;
|
||||
status: ResolutionStatus;
|
||||
values: ResolutionValueContainer[];
|
||||
}
|
||||
|
||||
export interface Resolutions {
|
||||
resolutionsPerAuthority: Resolution[];
|
||||
}
|
||||
|
||||
export interface SlotValue {
|
||||
confirmationStatus?: ConfirmationStatuses;
|
||||
name: string;
|
||||
value?: any;
|
||||
resolutions?: Resolutions;
|
||||
}
|
||||
|
||||
export interface Intent {
|
||||
|
||||
@@ -5,9 +5,9 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
expr = expr.subtract(3);
|
||||
expr = expr.add("x");
|
||||
expr.toString();
|
||||
let eq = new Equation(expr, 4);
|
||||
const eq = new Equation(expr, 4);
|
||||
eq.toString();
|
||||
let x = eq.solveFor("x");
|
||||
const x = eq.solveFor("x");
|
||||
x.toString();
|
||||
}
|
||||
{
|
||||
@@ -29,14 +29,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
x.toString();
|
||||
x = x.add("y");
|
||||
x.toString();
|
||||
let otherExp = new Expression("x").add(6);
|
||||
const 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.toString()} - (${expr2.toString()}) = ${expr3.toString()}`;
|
||||
|
||||
expr1 = new Expression("x");
|
||||
expr1 = expr1.add(2);
|
||||
@@ -46,7 +46,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
expr2 = expr2.multiply(new Fraction(1, 3));
|
||||
expr2 = expr2.add(4);
|
||||
expr3 = expr1.multiply(expr2);
|
||||
"(" + expr1.toString() + ")(" + expr2.toString() + ") = " + expr3.toString();
|
||||
`(${expr1.toString()})(${expr2.toString()}) = ${expr3.toString()}`;
|
||||
|
||||
x = new Expression("x").divide(2).divide(new Fraction(1, 5));
|
||||
x.toString();
|
||||
@@ -54,11 +54,11 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
exp = exp.add("y");
|
||||
exp = exp.add(3);
|
||||
exp.toString();
|
||||
let sum = exp.summation("x", 3, 6);
|
||||
const sum = exp.summation("x", 3, 6);
|
||||
sum.toString();
|
||||
exp = new Expression("x").add(2);
|
||||
let exp3 = exp.pow(3);
|
||||
"(" + exp.toString() + ")^3 = " + exp3.toString();
|
||||
const exp3 = exp.pow(3);
|
||||
`(${exp.toString()})^3 = ${exp3.toString()}`;
|
||||
|
||||
let expr = new Expression("x");
|
||||
expr = expr.multiply(2);
|
||||
@@ -66,14 +66,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
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) });
|
||||
const answer1 = expr.eval({ x: 2 });
|
||||
const 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 });
|
||||
const sub = new Expression("y").add(4);
|
||||
const answer = expr.eval({ x: sub });
|
||||
answer.toString();
|
||||
exp = new Expression("x").add(2);
|
||||
exp.toString();
|
||||
@@ -91,23 +91,23 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
exp.toString();
|
||||
exp = exp.simplify();
|
||||
exp.toString();
|
||||
let z = new Expression("z");
|
||||
let eq1 = new Equation(z.subtract(4).divide(9), z.add(6));
|
||||
const z = new Expression("z");
|
||||
const eq1 = new Equation(z.subtract(4).divide(9), z.add(6));
|
||||
eq1.toString();
|
||||
let eq2 = new Equation(z.add(4).multiply(9), 6);
|
||||
const eq2 = new Equation(z.add(4).multiply(9), 6);
|
||||
eq2.toString();
|
||||
let eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4));
|
||||
const 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");
|
||||
const x1 = parse("1/5 * x + 2/15");
|
||||
const x2 = parse("1/7 * x + 4");
|
||||
let eq = new Equation(x1 as Expression, x2 as Expression);
|
||||
eq.toString();
|
||||
let answer = eq.solveFor("x");
|
||||
const answer = eq.solveFor("x");
|
||||
"x = " + answer.toString();
|
||||
let expr1 = parse("1/4 * x + 5/4");
|
||||
let expr2 = parse("3 * y - 12/5");
|
||||
const expr1 = parse("1/4 * x + 5/4");
|
||||
const expr2 = parse("3 * y - 12/5");
|
||||
eq = new Equation(expr1 as Expression, expr2 as Expression);
|
||||
eq.toString();
|
||||
let xAnswer = eq.solveFor("x");
|
||||
@@ -116,14 +116,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
"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);
|
||||
const 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);
|
||||
const n3 = parse("x + 4") as Expression;
|
||||
const cubic = new Equation(n1.multiply(n2).multiply(n3), 0);
|
||||
cubic.toString();
|
||||
answers = cubic.solveFor("x");
|
||||
"x = " + answers.toString();
|
||||
@@ -143,20 +143,20 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js';
|
||||
exp.toString();
|
||||
}
|
||||
{
|
||||
let eq = parse("x^2 + 4 * x + 4 = 0") as Equation;
|
||||
const eq = parse("x^2 + 4 * x + 4 = 0") as Equation;
|
||||
eq.toString();
|
||||
let ans = eq.solveFor("x");
|
||||
const 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);
|
||||
const a = new Expression("x").pow(2);
|
||||
const b = new Expression("x").multiply(new Fraction(5, 4));
|
||||
const c = new Fraction(-21, 4);
|
||||
const expr = a.add(b).add(c);
|
||||
const quad = new Equation(expr, 0);
|
||||
toTex(quad);
|
||||
let answers = quad.solveFor("x");
|
||||
const 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);
|
||||
const lambda = new Expression("lambda").add(3).divide(4);
|
||||
const Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda);
|
||||
toTex(lambda);
|
||||
toTex(Phi);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ let _algoliaSecuredApiOptions: AlgoliaSecuredApiOptions = {
|
||||
|
||||
let _algoliaIndexSettings: AlgoliaIndexSettings = {
|
||||
attributesToIndex: [""],
|
||||
attributesforFaceting: [""],
|
||||
attributesForFaceting: [""],
|
||||
unretrievableAttributes: [""],
|
||||
attributesToRetrieve: [""],
|
||||
ranking: [""],
|
||||
|
||||
Vendored
+1
-1
@@ -976,7 +976,7 @@ declare namespace algoliasearch {
|
||||
* default: null
|
||||
* https://github.com/algolia/algoliasearch-client-js#attributesforfaceting
|
||||
*/
|
||||
attributesforFaceting?: string[];
|
||||
attributesForFaceting?: string[];
|
||||
/**
|
||||
* The list of attributes that cannot be retrieved at query time
|
||||
* default: null
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for amazon-product-api
|
||||
// Project: https://github.com/t3chnoboy/amazon-product-api
|
||||
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen/>
|
||||
// Definitions by: Matti Lehtinen <https://github.com/MattiLehtinen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AmplifyJs (using JQuery Deferred) 1.1
|
||||
// Project: http://amplifyjs.com/
|
||||
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>, Laurentiu Stamate <https://github.com/laurentiustamate94>
|
||||
// Definitions by: Jonas Eriksson <https://github.com/joeriks>, Laurentiu Stamate <https://github.com/laurentiustamate94>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ amplify.request.define("twitter-search", "ajax", {
|
||||
}
|
||||
});
|
||||
|
||||
amplify.request("twitter-search", { term: "amplifyjs" } );
|
||||
amplify.request("twitter-search", { term: "amplifyjs" });
|
||||
|
||||
// Similarly, we can create a request that searches for mentions, by accepting a username:
|
||||
|
||||
@@ -168,19 +168,24 @@ amplify.request("twitter-mentions", { user: "amplifyjs" });
|
||||
// Example:
|
||||
|
||||
const appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => {
|
||||
if (data.status === "success") {
|
||||
success(data.data);
|
||||
} else if (data.status === "fail" || data.status === "error") {
|
||||
error(data.message, data.status);
|
||||
} else {
|
||||
error(data.message, "fatal");
|
||||
switch (data.status) {
|
||||
case "success":
|
||||
success(data.data);
|
||||
break;
|
||||
case "fail":
|
||||
case "error":
|
||||
error(data.message, data.status);
|
||||
break;
|
||||
default:
|
||||
error(data.message, "fatal");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// a new decoder can be added to the amplifyDecoders interface
|
||||
declare module "amplify" {
|
||||
interface Decoders {
|
||||
appEnvelope: amplify.Decoder;
|
||||
appEnvelope: Decoder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,12 +218,17 @@ amplify.request.define("decoderSingleExample", "ajax", {
|
||||
url: "/myAjaxUrl",
|
||||
type: "POST",
|
||||
decoder(data, status, xhr, success, error) {
|
||||
if (data.status === "success") {
|
||||
success(data.data);
|
||||
} else if (data.status === "fail" || data.status === "error") {
|
||||
error(data.message, data.status);
|
||||
} else {
|
||||
error(data.message, "fatal");
|
||||
switch (data.status) {
|
||||
case "success":
|
||||
success(data.data);
|
||||
break;
|
||||
case "fail":
|
||||
case "error":
|
||||
error(data.message, data.status);
|
||||
break;
|
||||
default:
|
||||
error(data.message, "fatal");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AmplifyJs 1.1
|
||||
// Project: http://amplifyjs.com/
|
||||
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>
|
||||
// Definitions by: Jonas Eriksson <https://github.com/joeriks>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for amqp-rpc v0.0.8
|
||||
// Project: https://github.com/demchenkoe/node-amqp-rpc/
|
||||
// Definitions by: Wonshik Kim <https://github.com/wokim/>
|
||||
// Definitions by: Wonshik Kim <https://github.com/wokim>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
Vendored
+1
@@ -49,6 +49,7 @@ export interface AMQPQueue extends events.EventEmitter {
|
||||
export interface AMQPExchange extends events.EventEmitter {
|
||||
on(event: 'open' | 'ack' | 'error' | 'exchangeBindOk' | 'exchangeUnbindOk', callback: Callback<void>): this;
|
||||
|
||||
publish(routingKey: string, message: Buffer | {}, callback: (err?: boolean, msg?: string) => void): void;
|
||||
publish(routingKey: string, message: Buffer | {}, options: ExchangePublishOptions, callback?: (err?: boolean, msg?: string) => void): void;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-empty-interface": false
|
||||
// All are TODOs
|
||||
"no-empty-interface": false,
|
||||
"prefer-const": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,5 +37,5 @@ app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIServi
|
||||
blockUI.reset();
|
||||
blockUI.message("Hello Types");
|
||||
blockUI.done();
|
||||
let b: boolean = blockUI.isBlocking();
|
||||
const b: boolean = blockUI.isBlocking();
|
||||
});
|
||||
|
||||
Vendored
+1
-1
@@ -70,7 +70,7 @@ declare module 'angular' {
|
||||
* @param {angular.IRequestConfig} config - the Angular request config object.
|
||||
*
|
||||
*/
|
||||
requestFilter?(config: angular.IRequestConfig): (string | boolean);
|
||||
requestFilter?(config: IRequestConfig): (string | boolean);
|
||||
|
||||
/**
|
||||
* When the module is started it will inject the main block element
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-clipboard v1.5
|
||||
// Project: https://github.com/omichelsen/angular-clipboard
|
||||
// Definitions by: Bradford Wagner <https://github.com/bradfordwagner/>
|
||||
// Definitions by: Bradford Wagner <https://github.com/bradfordwagner>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngCookies module) 1.4
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Anthony Ciccarello <http://github.com/aciccarello>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Anthony Ciccarello <https://github.com/aciccarello>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-deferred-bootstrap v0.1.9
|
||||
// Project: https://github.com/philippd/angular-deferred-bootstrap
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft/>
|
||||
// Definitions by: Markus Wagner <https://github.com/Ritzlgrmft>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-es v0.0.3
|
||||
// Project: https://github.com/mbutsykin/angular-es
|
||||
// Definitions by: mbutsykin <https://github.com/mbutsykin/>
|
||||
// Definitions by: mbutsykin <https://github.com/mbutsykin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'angular-es' {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as angular from "angular";
|
||||
import * as ng from 'angular';
|
||||
|
||||
let myApp = angular.module('myApp', ['feature-flags']);
|
||||
const myApp = ng.module('myApp', ['feature-flags']);
|
||||
|
||||
const flagsData: Array<angular.featureflags.FlagData> = [
|
||||
const flagsData: Array<ng.featureflags.FlagData> = [
|
||||
{
|
||||
key: '1',
|
||||
active: true,
|
||||
@@ -17,15 +17,16 @@ const flagsData: Array<angular.featureflags.FlagData> = [
|
||||
}
|
||||
];
|
||||
|
||||
myApp.config(function (featureFlagsProvider: angular.featureflags.FeatureFlagsProvider) {
|
||||
myApp.config(function(featureFlagsProvider: ng.featureflags.FeatureFlagsProvider) {
|
||||
featureFlagsProvider.setInitialFlags(flagsData);
|
||||
});
|
||||
|
||||
myApp.run(function ($q: angular.IQService, $http: angular.IHttpService, featureFlags: angular.featureflags.FeatureFlagsService) {
|
||||
let deferred = $q.defer();
|
||||
deferred.resolve(flagsData);
|
||||
|
||||
featureFlags.set(deferred.promise);
|
||||
|
||||
myApp.run(function(
|
||||
$q: ng.IQService,
|
||||
$http: ng.IHttpService,
|
||||
featureFlags: ng.featureflags.FeatureFlagsService
|
||||
) {
|
||||
featureFlags.set($q.resolve(flagsData));
|
||||
featureFlags.set($http.get('/data/flags.json'));
|
||||
});
|
||||
featureFlags.set($http.get<Array<ng.featureflags.FlagData>>('/data/flags.json'));
|
||||
});
|
||||
|
||||
+11
-6
@@ -1,14 +1,14 @@
|
||||
// Type definitions for angular-feature-flags 1.4.0
|
||||
// Project: https://github.com/mjt01/angular-feature-flags
|
||||
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov/>
|
||||
// Definitions by: Borislav Zhivkov <https://github.com/borislavjivkov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
import * as angular from "angular";
|
||||
import * as ng from 'angular';
|
||||
|
||||
declare module "angular" {
|
||||
declare module 'angular' {
|
||||
namespace featureflags {
|
||||
export interface FlagData {
|
||||
/**
|
||||
@@ -27,17 +27,22 @@ declare module "angular" {
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* A long description of the flag to further explain the feature being toggled (only visible in the list of flags)
|
||||
* A long description of the flag to further explain the feature being toggled
|
||||
* (only visible in the list of flags)
|
||||
*/
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface FeatureFlagsProvider {
|
||||
setInitialFlags(flags: Array<FlagData>): void;
|
||||
setInitialFlags(flags: ReadonlyArray<FlagData>): void;
|
||||
}
|
||||
|
||||
export interface FeatureFlagsService {
|
||||
set(flagsPromise: angular.IPromise<FlagData> | angular.IHttpPromise<FlagData>): void;
|
||||
set(
|
||||
flagsPromise:
|
||||
| ng.IPromise<ReadonlyArray<FlagData>>
|
||||
| ng.IHttpPromise<ReadonlyArray<FlagData>>
|
||||
): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-file-saver 1.1
|
||||
// Project: https://github.com/alferov/angular-file-saver
|
||||
// Definitions by: Donald Nairn <https://github.com/deenairn/>
|
||||
// Definitions by: Donald Nairn <https://github.com/deenairn>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import * as ng from "angular";
|
||||
import * as angular from "angular";
|
||||
|
||||
import gridster from "angular-gridster";
|
||||
|
||||
Vendored
+6
-6
@@ -89,13 +89,13 @@ declare module "angular" {
|
||||
handles?: string[];
|
||||
|
||||
// optional callback fired when drag is started
|
||||
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
start?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is resized
|
||||
resize?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
resize?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is finished dragging
|
||||
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
stop?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
};
|
||||
|
||||
// options to pass to draggable handler
|
||||
@@ -113,13 +113,13 @@ declare module "angular" {
|
||||
handle?: string;
|
||||
|
||||
// optional callback fired when drag is started
|
||||
start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
start?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is moved,
|
||||
drag?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
drag?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
|
||||
// optional callback fired when item is finished dragging
|
||||
stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void;
|
||||
stop?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@
|
||||
// Definitions by: Jason Zhao <https://github.com/jlz27>, Stefan Steinhart <https://github.com/reppners>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
//readme written by David Valentine <https://github.com/dvalenti314/>
|
||||
//readme written by David Valentine <https://github.com/dvalenti314>
|
||||
|
||||
|
||||
/// <reference types="angular" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"localforage": "^1.5.0"
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ myApp.config((
|
||||
return c * t * t + b;
|
||||
},
|
||||
easeFnIndeterminate(t, b, c, d) {
|
||||
return c * Math.pow(2, 10 * (t / d - 1)) + b;
|
||||
return c * Math.pow(2, (t / d - 1) * 10) + b;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+28
-28
@@ -18,7 +18,7 @@ declare module 'angular' {
|
||||
interface IBottomSheetOptions {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
scope?: IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
locals?: { [index: string]: any };
|
||||
@@ -28,12 +28,12 @@ declare module 'angular' {
|
||||
escapeToClose?: boolean;
|
||||
resolve?: ResolveObject;
|
||||
controllerAs?: string;
|
||||
parent?: ((scope: angular.IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node
|
||||
parent?: ((scope: IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node
|
||||
disableParentScroll?: boolean; // default: true
|
||||
}
|
||||
|
||||
interface IBottomSheetService {
|
||||
show(options: IBottomSheetOptions): angular.IPromise<any>;
|
||||
show(options: IBottomSheetOptions): IPromise<any>;
|
||||
hide(response?: any): void;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ declare module 'angular' {
|
||||
templateUrl(templateUrl?: string): T;
|
||||
template(template?: string): T;
|
||||
targetEvent(targetEvent?: MouseEvent): T;
|
||||
scope(scope?: angular.IScope): T; // default: new child scope
|
||||
scope(scope?: IScope): T; // default: new child scope
|
||||
preserveScope(preserveScope?: boolean): T; // default: false
|
||||
disableParentScroll(disableParentScroll?: boolean): T; // default: true
|
||||
hasBackdrop(hasBackdrop?: boolean): T; // default: true
|
||||
@@ -98,7 +98,7 @@ declare module 'angular' {
|
||||
targetEvent?: MouseEvent;
|
||||
openFrom?: any;
|
||||
closeTo?: any;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
scope?: IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
disableParentScroll?: boolean; // default: true
|
||||
hasBackdrop?: boolean; // default: true
|
||||
@@ -111,24 +111,24 @@ declare module 'angular' {
|
||||
resolve?: ResolveObject;
|
||||
controllerAs?: string;
|
||||
parent?: string | Element | JQuery; // default: root node
|
||||
onShowing?(scope: angular.IScope, element: JQuery): void;
|
||||
onComplete?(scope: angular.IScope, element: JQuery): void;
|
||||
onRemoving?(element: JQuery, removePromise: angular.IPromise<any>): void;
|
||||
onShowing?(scope: IScope, element: JQuery): void;
|
||||
onComplete?(scope: IScope, element: JQuery): void;
|
||||
onRemoving?(element: JQuery, removePromise: IPromise<any>): void;
|
||||
skipHide?: boolean;
|
||||
multiple?: boolean;
|
||||
fullscreen?: boolean; // default: false
|
||||
}
|
||||
|
||||
interface IDialogService {
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): angular.IPromise<any>;
|
||||
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): IPromise<any>;
|
||||
confirm(): IConfirmDialog;
|
||||
alert(): IAlertDialog;
|
||||
prompt(): IPromptDialog;
|
||||
hide(response?: any): angular.IPromise<any>;
|
||||
hide(response?: any): IPromise<any>;
|
||||
cancel(response?: any): void;
|
||||
}
|
||||
|
||||
type IIcon = (id: string) => angular.IPromise<Element>; // id is a unique ID or URL
|
||||
type IIcon = (id: string) => IPromise<Element>; // id is a unique ID or URL
|
||||
|
||||
interface IIconProvider {
|
||||
icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24
|
||||
@@ -141,16 +141,16 @@ declare module 'angular' {
|
||||
type IMedia = (media: string) => boolean;
|
||||
|
||||
interface ISidenavObject {
|
||||
toggle(): angular.IPromise<void>;
|
||||
open(): angular.IPromise<void>;
|
||||
close(): angular.IPromise<void>;
|
||||
toggle(): IPromise<void>;
|
||||
open(): IPromise<void>;
|
||||
close(): IPromise<void>;
|
||||
isOpen(): boolean;
|
||||
isLockedOpen(): boolean;
|
||||
onClose(onClose: () => void): void;
|
||||
}
|
||||
|
||||
interface ISidenavService {
|
||||
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
|
||||
(component: string, enableWait: boolean): IPromise<ISidenavObject>;
|
||||
(component: string): ISidenavObject;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ declare module 'angular' {
|
||||
templateUrl?: string;
|
||||
template?: string;
|
||||
autoWrap?: boolean;
|
||||
scope?: angular.IScope; // default: new child scope
|
||||
scope?: IScope; // default: new child scope
|
||||
preserveScope?: boolean; // default: false
|
||||
hideDelay?: number | false; // default (ms): 3000
|
||||
position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left'
|
||||
@@ -189,8 +189,8 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IToastService {
|
||||
show(optionsOrPreset: IToastOptions | IToastPreset<any>): angular.IPromise<any>;
|
||||
showSimple(content: string): angular.IPromise<any>;
|
||||
show(optionsOrPreset: IToastOptions | IToastPreset<any>): IPromise<any>;
|
||||
showSimple(content: string): IPromise<any>;
|
||||
simple(): ISimpleToastPreset;
|
||||
build(): IToastPreset<any>;
|
||||
updateContent(newContent: string): void;
|
||||
@@ -306,7 +306,7 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IMenuService {
|
||||
hide(response?: any, options?: any): angular.IPromise<any>;
|
||||
hide(response?: any, options?: any): IPromise<any>;
|
||||
}
|
||||
|
||||
interface IColorPalette {
|
||||
@@ -366,19 +366,19 @@ declare module 'angular' {
|
||||
isAttached: boolean;
|
||||
panelContainer: JQuery;
|
||||
panelEl: JQuery;
|
||||
open(): angular.IPromise<any>;
|
||||
close(): angular.IPromise<any>;
|
||||
attach(): angular.IPromise<any>;
|
||||
detach(): angular.IPromise<any>;
|
||||
show(): angular.IPromise<any>;
|
||||
hide(): angular.IPromise<any>;
|
||||
open(): IPromise<any>;
|
||||
close(): IPromise<any>;
|
||||
attach(): IPromise<any>;
|
||||
detach(): IPromise<any>;
|
||||
show(): IPromise<any>;
|
||||
hide(): IPromise<any>;
|
||||
destroy(): void;
|
||||
addClass(newClass: string): void;
|
||||
removeClass(oldClass: string): void;
|
||||
toggleClass(toggleClass: string): void;
|
||||
updatePosition(position: IPanelPosition): void;
|
||||
registerInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
|
||||
removeInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
|
||||
registerInterceptor(type: string, callback: () => IPromise<any>): IPanelRef;
|
||||
removeInterceptor(type: string, callback: () => IPromise<any>): IPanelRef;
|
||||
removeAllInterceptors(type?: string): IPanelRef;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ declare module 'angular' {
|
||||
|
||||
interface IPanelService {
|
||||
create(opt_config: IPanelConfig): IPanelRef;
|
||||
open(opt_config: IPanelConfig): angular.IPromise<IPanelRef>;
|
||||
open(opt_config: IPanelConfig): IPromise<IPanelRef>;
|
||||
newPanelPosition(): IPanelPosition;
|
||||
newPanelAnimation(): IPanelAnimation;
|
||||
xPosition: {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODOs
|
||||
"interface-name": false,
|
||||
"max-line-length": false
|
||||
"max-line-length": false,
|
||||
"no-void-expression": false
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Tony Curtis <https://github.com/daltin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -27,9 +27,9 @@ declare module 'angular' {
|
||||
|
||||
interface OAuth {
|
||||
isAuthenticated(): boolean;
|
||||
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
|
||||
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
|
||||
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
|
||||
getAccessToken(data: Data, options?: any): IPromise<string>;
|
||||
getRefreshToken(data?: Data, options?: any): IPromise<string>;
|
||||
revokeToken(data?: Data, options?: any): IPromise<string>;
|
||||
}
|
||||
|
||||
interface OAuthTokenConfig {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
namespace pdfjsViewer {
|
||||
interface ConfigProvider extends angular.IServiceProvider {
|
||||
interface ConfigProvider extends IServiceProvider {
|
||||
setWorkerSrc(src: string): void;
|
||||
setCmapDir(dir: string): void;
|
||||
setImageDir(dir: string): void;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-promise-tracker 2.2.2
|
||||
// Project: https://github.com/ajoslin/angular-promise-tracker
|
||||
// Definitions by: Rufus Linke <https://github.com/rufusl/>
|
||||
// Definitions by: Rufus Linke <https://github.com/rufusl>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResou
|
||||
function MainController($resource: ng.resource.IResourceService): void {
|
||||
// IntelliSense will provide IActionDescriptor interface and will validate
|
||||
// your assignment against it
|
||||
let publishDescriptor: ng.resource.IActionDescriptor = {
|
||||
const publishDescriptor: ng.resource.IActionDescriptor = {
|
||||
method: 'GET',
|
||||
isArray: false
|
||||
};
|
||||
@@ -40,7 +40,7 @@ function MainController($resource: ng.resource.IResourceService): void {
|
||||
// A call to the $resource service returns a IResourceClass. Since
|
||||
// our own IArticleResourceClass defines 2 more actions, we cast the return
|
||||
// value to make the compiler aware of that
|
||||
let articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
const articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
|
||||
publish : publishDescriptor,
|
||||
unpublish : {
|
||||
method: 'POST'
|
||||
@@ -51,7 +51,7 @@ function MainController($resource: ng.resource.IResourceService): void {
|
||||
articleResource.unpublish({ id: 1 });
|
||||
|
||||
// IResourceClass.get() will be automatically available here
|
||||
let article: IArticleResource = articleResource.get({id: 1}, function success(): void {
|
||||
const article: IArticleResource = articleResource.get({id: 1}, function success(): void {
|
||||
// Again, default + custom action here...
|
||||
article.title = 'New Title';
|
||||
article.$save();
|
||||
@@ -59,10 +59,9 @@ function MainController($resource: ng.resource.IResourceService): void {
|
||||
});
|
||||
}
|
||||
|
||||
import IHttpPromiseCallbackArg = angular.IHttpPromiseCallbackArg;
|
||||
import IHttpResponse = angular.IHttpResponse;
|
||||
|
||||
interface IMyData {}
|
||||
interface IMyHttpPromiseCallbackArg extends IHttpPromiseCallbackArg<IMyData> {}
|
||||
interface IMyResource extends angular.resource.IResource<IMyResource> {}
|
||||
interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource> {}
|
||||
|
||||
@@ -87,7 +86,7 @@ angular.injector(['ng']).invoke(function ($cacheFactory: angular.ICacheFactorySe
|
||||
actionDescriptor.withCredentials = true;
|
||||
actionDescriptor.responseType = 'response type';
|
||||
actionDescriptor.interceptor = {
|
||||
response() { return {} as IMyHttpPromiseCallbackArg; },
|
||||
response() { return {} as IHttpResponse<IMyData>; },
|
||||
responseError() {}
|
||||
};
|
||||
actionDescriptor.cancellable = true;
|
||||
|
||||
Vendored
+31
-31
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngResource module) 1.5
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Michael Jess <http://github.com/miffels>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Michael Jess <https://github.com/miffels>
|
||||
// Definitions: https://github.com/daptiv/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -74,10 +74,10 @@ declare module 'angular' {
|
||||
params?: any;
|
||||
url?: string;
|
||||
isArray?: boolean;
|
||||
transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[];
|
||||
transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[];
|
||||
transformRequest?: IHttpRequestTransformer | IHttpRequestTransformer[];
|
||||
transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[];
|
||||
headers?: any;
|
||||
cache?: boolean | angular.ICacheObject;
|
||||
cache?: boolean | ICacheObject;
|
||||
/**
|
||||
* Note: In contrast to $http.config, promises are not supported in $resource, because the same value
|
||||
* would be used for multiple requests. If you are looking for a way to cancel requests, you should
|
||||
@@ -118,15 +118,15 @@ declare module 'angular' {
|
||||
// it's gonna be considered data if the action method is POST, PUT or
|
||||
// PATCH (in other words, methods with body). Otherwise, it's going
|
||||
// to be considered as parameters to the request.
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L461-L465
|
||||
//
|
||||
// Only those methods with an HTTP body do have 'data' as first parameter:
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L463
|
||||
// More specifically, those methods are POST, PUT and PATCH:
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L432
|
||||
//
|
||||
// Also, static calls always return the IResource (or IResourceArray) retrieved
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L538-L549
|
||||
interface IResourceClass<T> {
|
||||
new(dataOrParams?: any): T & IResource<T>;
|
||||
get: IResourceMethod<T>;
|
||||
@@ -141,32 +141,32 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
// Instance calls always return the the promise of the request which retrieved the object
|
||||
// https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
|
||||
// https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L538-L546
|
||||
interface IResource<T> {
|
||||
$get(): angular.IPromise<T>;
|
||||
$get(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$get(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$get(): IPromise<T>;
|
||||
$get(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$get(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$query(): angular.IPromise<IResourceArray<T>>;
|
||||
$query(params?: Object, success?: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
|
||||
$query(success: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
|
||||
$query(): IPromise<IResourceArray<T>>;
|
||||
$query(params?: Object, success?: Function, error?: Function): IPromise<IResourceArray<T>>;
|
||||
$query(success: Function, error?: Function): IPromise<IResourceArray<T>>;
|
||||
|
||||
$save(): angular.IPromise<T>;
|
||||
$save(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$save(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$save(): IPromise<T>;
|
||||
$save(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$save(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$remove(): angular.IPromise<T>;
|
||||
$remove(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$remove(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$remove(): IPromise<T>;
|
||||
$remove(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$remove(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$delete(): angular.IPromise<T>;
|
||||
$delete(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
|
||||
$delete(success: Function, error?: Function): angular.IPromise<T>;
|
||||
$delete(): IPromise<T>;
|
||||
$delete(params?: Object, success?: Function, error?: Function): IPromise<T>;
|
||||
$delete(success: Function, error?: Function): IPromise<T>;
|
||||
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** The promise of the original server interaction that created this instance. */
|
||||
$promise: angular.IPromise<T>;
|
||||
$promise: IPromise<T>;
|
||||
$resolved: boolean;
|
||||
toJSON(): T;
|
||||
}
|
||||
@@ -178,18 +178,18 @@ declare module 'angular' {
|
||||
$cancelRequest(): void;
|
||||
|
||||
/** The promise of the original server interaction that created this collection. */
|
||||
$promise: angular.IPromise<IResourceArray<T>>;
|
||||
$promise: IPromise<IResourceArray<T>>;
|
||||
$resolved: boolean;
|
||||
}
|
||||
|
||||
/** when creating a resource factory via IModule.factory */
|
||||
interface IResourceServiceFactoryFunction<T> {
|
||||
($resource: angular.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
|
||||
($resource: IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: IResourceService): U;
|
||||
}
|
||||
|
||||
// IResourceServiceProvider used to configure global settings
|
||||
interface IResourceServiceProvider extends angular.IServiceProvider {
|
||||
interface IResourceServiceProvider extends IServiceProvider {
|
||||
defaults: IResourceOptions;
|
||||
}
|
||||
}
|
||||
@@ -197,12 +197,12 @@ declare module 'angular' {
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
interface IModule {
|
||||
/** creating a resource service factory */
|
||||
factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
factory(name: string, resourceServiceFactoryFunction: resource.IResourceServiceFactoryFunction<any>): IModule;
|
||||
}
|
||||
|
||||
namespace auto {
|
||||
interface IInjectorService {
|
||||
get(name: '$resource'): ng.resource.IResourceService;
|
||||
get(name: '$resource'): resource.IResourceService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
"interface-name": false,
|
||||
"only-arrow-functions": false,
|
||||
"no-empty-interface": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"ban-types": false,
|
||||
"space-before-function-paren": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for Angular JS (ngSanitize module) 1.3
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Diego Vilar <http://github.com/diegovilar>
|
||||
// Definitions by: Diego Vilar <https://github.com/diegovilar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace angularStrapTests {
|
||||
myOtherModalOptions.scope = $scope;
|
||||
myOtherModalOptions.template = 'modal/docs/modal.demo.tpl.html';
|
||||
myOtherModalOptions.show = false;
|
||||
myOtherModalOptions.controller = demoCtrl;
|
||||
myOtherModalOptions.controllerAs = "ctrl";
|
||||
|
||||
var myOtherModal = $modal(myOtherModalOptions);
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for angular-strap v2.2.x
|
||||
// Type definitions for angular-strap v2.3.x
|
||||
// Project: http://mgcrea.github.io/angular-strap/
|
||||
// Definitions by: Sam Herrmann <https://github.com/samherrmann>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -42,6 +42,8 @@ declare namespace mgcrea.ngStrap {
|
||||
keyboard?: boolean;
|
||||
show?: boolean;
|
||||
container?: string | boolean;
|
||||
controller?: any;
|
||||
controllerAs?: string;
|
||||
template?: string;
|
||||
templateUrl?: string;
|
||||
contentTemplate?: string;
|
||||
|
||||
+2
-2
@@ -312,7 +312,7 @@ declare module 'angular' {
|
||||
openClass?: string;
|
||||
}
|
||||
|
||||
interface IModalProvider extends IServiceProvider {
|
||||
interface IModalProvider extends angular.IServiceProvider {
|
||||
/**
|
||||
* Default options all modals will use.
|
||||
*/
|
||||
@@ -876,7 +876,7 @@ declare module 'angular' {
|
||||
useContentExp?: boolean;
|
||||
}
|
||||
|
||||
interface ITooltipProvider extends IServiceProvider {
|
||||
interface ITooltipProvider extends angular.IServiceProvider {
|
||||
/**
|
||||
* Provide a set of defaults for certain tooltip and popover attributes.
|
||||
*/
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
angular.module("test", [
|
||||
"ui.bootstrap",
|
||||
"ui.router",
|
||||
"ui.router.default"
|
||||
])
|
||||
.config(function($stateProvider: angular.ui.IStateProvider) {
|
||||
$stateProvider
|
||||
.state('contacts', {
|
||||
// no modal
|
||||
resolve: {
|
||||
a: function() {
|
||||
return "a";
|
||||
},
|
||||
b: function() {
|
||||
return ["a", "b"];
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('contacts.contact', {
|
||||
// boolean modal
|
||||
modal: true
|
||||
})
|
||||
.state('contacts.contact.edit', {
|
||||
// string[] modal
|
||||
modal: ["a", "b"]
|
||||
})
|
||||
;
|
||||
});
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
// Type definitions for angular-ui-uib-modal (ui.router module) 0.11
|
||||
// Project: https://github.com/nonplus/angular-ui-router-uib-modal
|
||||
// Definitions by: Stepan Riha <https://github.com/nonplus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as auir from "angular-ui-router";
|
||||
|
||||
declare module "angular" {
|
||||
namespace ui {
|
||||
interface IState {
|
||||
modal?: boolean | string[];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
|
||||
// Note that we do not concern ourselves with what to do if this request fails,
|
||||
// because if it fails, the web page will be redirected away to the login screen.
|
||||
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpPromiseCallbackArg<any>) => {
|
||||
this.$http({ url: "/api/me", method: "GET" }).then((response: ng.IHttpResponse<any>) => {
|
||||
this.currentUser = response.data;
|
||||
|
||||
// sync the ui-state with the location in the browser, which effectively
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/* tslint:disable:dt-header variable-name */
|
||||
// Type definitions for Angular JS 1.5 component router
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: David Reher <http://github.com/davidreher>
|
||||
// Definitions by: David Reher <https://github.com/davidreher>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace angular {
|
||||
|
||||
@@ -61,31 +61,38 @@ angular.module('http-auth-interceptor', [])
|
||||
* $http 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';
|
||||
.config([
|
||||
'$httpProvider', 'authServiceProvider',
|
||||
($httpProvider: ng.IHttpProvider, authServiceProvider: AuthService) => {
|
||||
$httpProvider.defaults.headers.common = { Authorization: 'Bearer token' };
|
||||
$httpProvider.defaults.headers.get.Authorization = 'Bearer token';
|
||||
$httpProvider.defaults.headers.post['Authorization'] = (config: ng.IRequestConfig) =>
|
||||
'Bearer token';
|
||||
|
||||
const interceptor = ['$rootScope', '$q', ($rootScope: ng.IScope, $q: ng.IQService) => {
|
||||
function success(response: ng.IHttpPromiseCallbackArg<any>) {
|
||||
return response;
|
||||
}
|
||||
|
||||
function error(response: ng.IHttpPromiseCallbackArg<any>) {
|
||||
if (response.status === 401) {
|
||||
const deferred = $q.defer<void>();
|
||||
authServiceProvider.pushToBuffer(response.config, deferred);
|
||||
$rootScope.$broadcast('event:auth-loginRequired');
|
||||
return deferred.promise;
|
||||
const interceptor = [
|
||||
'$rootScope', '$q',
|
||||
($rootScope: ng.IScope, $q: ng.IQService) => {
|
||||
return {
|
||||
request(config: ng.IRequestConfig) {
|
||||
if (!config.params) config.params = {};
|
||||
config.params.rnd = Math.random();
|
||||
return config;
|
||||
},
|
||||
responseError(rejection: any) {
|
||||
if (rejection.status === 401) {
|
||||
const deferred = $q.defer<ng.IHttpResponse<any>>();
|
||||
authServiceProvider.pushToBuffer(rejection.config, deferred);
|
||||
$rootScope.$broadcast('event:auth-loginRequired');
|
||||
return deferred.promise;
|
||||
}
|
||||
return $q.reject(rejection);
|
||||
}
|
||||
};
|
||||
}
|
||||
// otherwise
|
||||
return $q.reject(response);
|
||||
}
|
||||
|
||||
return (promise: ng.IHttpPromise<any>) => promise.then(success, error);
|
||||
}];
|
||||
$httpProvider.interceptors.push(interceptor);
|
||||
}]);
|
||||
];
|
||||
$httpProvider.interceptors.push(interceptor);
|
||||
}
|
||||
]);
|
||||
|
||||
namespace HttpAndRegularPromiseTests {
|
||||
interface Person {
|
||||
@@ -105,7 +112,7 @@ namespace HttpAndRegularPromiseTests {
|
||||
|
||||
function someController($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) {
|
||||
$http.get<ExpectedResponse>('http://somewhere/some/resource')
|
||||
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
|
||||
.then((response: ng.IHttpResponse<ExpectedResponse>) => {
|
||||
// typing lost, so something like
|
||||
// const i: number = response.data
|
||||
// would type check
|
||||
@@ -113,7 +120,7 @@ namespace HttpAndRegularPromiseTests {
|
||||
});
|
||||
|
||||
$http.get<ExpectedResponse>('http://somewhere/some/resource')
|
||||
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
|
||||
.then((response: ng.IHttpResponse<ExpectedResponse>) => {
|
||||
// typing lost, so something like
|
||||
// const i: number = response.data
|
||||
// would NOT type check
|
||||
@@ -339,12 +346,12 @@ namespace TestQ {
|
||||
result = $q.all<{a: number; b: string; }>({a: promiseAny, b: promiseAny});
|
||||
}
|
||||
{
|
||||
let result = $q.all({ num: $q.when(2), str: $q.when('test') });
|
||||
const result = $q.all({ num: $q.when(2), str: $q.when('test') });
|
||||
// TS should infer that num is a number and str is a string
|
||||
result.then(r => (r.num * 2) + r.str.indexOf('s'));
|
||||
}
|
||||
{
|
||||
let result = $q.all({ num: $q.when(2), str: 'test' });
|
||||
const result = $q.all({ num: $q.when(2), str: 'test' });
|
||||
// TS should infer that num is a number and str is a string
|
||||
result.then(r => (r.num * 2) + r.str.indexOf('s'));
|
||||
}
|
||||
@@ -378,7 +385,7 @@ namespace TestQ {
|
||||
let result: angular.IPromise<TResult>;
|
||||
result = $q.resolve<TResult>(tResult);
|
||||
result = $q.resolve<TResult>(promiseTResult);
|
||||
let result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
|
||||
const result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
|
||||
}
|
||||
|
||||
// $q.when
|
||||
@@ -388,7 +395,6 @@ namespace TestQ {
|
||||
}
|
||||
{
|
||||
let result: angular.IPromise<TResult>;
|
||||
let other: angular.IPromise<TOther>;
|
||||
let resultOther: angular.IPromise<TResult | TOther>;
|
||||
|
||||
result = $q.when<TResult>(tResult);
|
||||
@@ -427,7 +433,7 @@ httpFoo.then((x) => {
|
||||
x.toFixed();
|
||||
});
|
||||
|
||||
httpFoo.then((response: ng.IHttpPromiseCallbackArg<any>) => {
|
||||
httpFoo.then((response: ng.IHttpResponse<any>) => {
|
||||
const h = response.headers('test');
|
||||
h.charAt(0);
|
||||
const hs = response.headers();
|
||||
@@ -450,8 +456,8 @@ namespace TestDeferred {
|
||||
// deferred.resolve
|
||||
{
|
||||
let result: void;
|
||||
result = deferred.resolve() as void;
|
||||
result = deferred.resolve(tResult) as void;
|
||||
result = deferred.resolve();
|
||||
result = deferred.resolve(tResult);
|
||||
}
|
||||
|
||||
// deferred.reject
|
||||
@@ -488,7 +494,7 @@ namespace TestInjector {
|
||||
class Foobar {
|
||||
constructor($q) {}
|
||||
}
|
||||
let result: Foobar = $injector.instantiate(Foobar);
|
||||
const result: Foobar = $injector.instantiate(Foobar);
|
||||
}
|
||||
|
||||
// $injector.invoke
|
||||
@@ -496,14 +502,14 @@ namespace TestInjector {
|
||||
function foobar(v: boolean): number {
|
||||
return 7;
|
||||
}
|
||||
let result = $injector.invoke(foobar);
|
||||
const result = $injector.invoke(foobar);
|
||||
if (!(typeof result === 'number')) {
|
||||
// This fails to compile if 'result' is not exactly a number.
|
||||
let expectNever: never = result;
|
||||
const expectNever: never = result;
|
||||
}
|
||||
|
||||
let anyFunction: Function = foobar;
|
||||
let anyResult: string = $injector.invoke(anyFunction);
|
||||
const anyFunction: Function = foobar;
|
||||
const anyResult: string = $injector.invoke(anyFunction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +572,7 @@ namespace TestPromise {
|
||||
(reason) => anyOf3(reject, tresult, tresultPromise)
|
||||
));
|
||||
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult>>(promise.then((result) => tresultHttpPromise));
|
||||
assertPromiseType<ng.IHttpResponse<TResult>>(promise.then((result) => tresultHttpPromise));
|
||||
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother));
|
||||
assertPromiseType<TResult | angular.IPromise<TResult> | angular.IPromise<never> | TOther | angular.IPromise<TOther>>(promise.then(
|
||||
@@ -581,8 +587,8 @@ namespace TestPromise {
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => result, (any) => tother, (any) => any));
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise));
|
||||
assertPromiseType<TResult | TOther>(promise.then((result) => tresultPromise, (any) => totherPromise, (any) => any));
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise));
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any));
|
||||
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise));
|
||||
assertPromiseType<ng.IHttpResponse<TResult | TOther>>(promise.then((result) => tresultHttpPromise, (any) => totherHttpPromise, (any) => any));
|
||||
|
||||
assertPromiseType<TOther>(promise.then((result) => tother));
|
||||
assertPromiseType<TOther>(promise.then((result) => tother, (any) => any));
|
||||
@@ -590,9 +596,9 @@ namespace TestPromise {
|
||||
assertPromiseType<TOther>(promise.then((result) => totherPromise));
|
||||
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any));
|
||||
assertPromiseType<TOther>(promise.then((result) => totherPromise, (any) => any, (any) => any));
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TOther>>(promise.then((result) => totherHttpPromise));
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TOther>>(promise.then((result) => totherHttpPromise, (any) => any));
|
||||
assertPromiseType<ng.IHttpPromiseCallbackArg<TOther>>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any));
|
||||
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise));
|
||||
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any));
|
||||
assertPromiseType<ng.IHttpResponse<TOther>>(promise.then((result) => totherHttpPromise, (any) => any, (any) => any));
|
||||
|
||||
assertPromiseType<boolean>(promise.then((result) => tresult, (any) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
|
||||
|
||||
@@ -603,10 +609,10 @@ namespace TestPromise {
|
||||
assertPromiseType<TResult | angular.IPromise<never>>(promise.catch((err) => anyOf2(tresult, reject)));
|
||||
assertPromiseType<TResult>(promise.catch((err) => anyOf3(tresult, tresultPromise, reject)));
|
||||
assertPromiseType<TResult>(promise.catch((err) => tresultPromise));
|
||||
assertPromiseType<TResult | ng.IHttpPromiseCallbackArg<TResult>>(promise.catch((err) => tresultHttpPromise));
|
||||
assertPromiseType<TResult | ng.IHttpResponse<TResult>>(promise.catch((err) => tresultHttpPromise));
|
||||
assertPromiseType<TResult | TOther>(promise.catch((err) => tother));
|
||||
assertPromiseType<TResult | TOther>(promise.catch((err) => totherPromise));
|
||||
assertPromiseType<TResult | ng.IHttpPromiseCallbackArg<TOther>>(promise.catch((err) => totherHttpPromise));
|
||||
assertPromiseType<TResult | ng.IHttpResponse<TOther>>(promise.catch((err) => totherHttpPromise));
|
||||
|
||||
assertPromiseType<boolean>(promise.catch((err) => tother).then(ambiguous => isTResult(ambiguous) ? ambiguous.c : ambiguous.f));
|
||||
|
||||
@@ -621,7 +627,7 @@ function test_angular_forEach() {
|
||||
const log: string[] = [];
|
||||
angular.forEach(values, (value, key, obj) => {
|
||||
obj[key] = value;
|
||||
this.push(key + ': ' + value);
|
||||
this.push(`${key}: ${value}`);
|
||||
}, log);
|
||||
// expect(log).toEqual(['name: misko', 'gender: male']);
|
||||
}
|
||||
@@ -1160,11 +1166,7 @@ function NgModelControllerTyping() {
|
||||
ngModel.$asyncValidators['uniqueUsername'] = (modelValue, viewValue) => {
|
||||
const value = modelValue || viewValue;
|
||||
return $http.get('/api/users/' + value).
|
||||
then(function resolved() {
|
||||
return $q.reject('exists');
|
||||
}, function rejected() {
|
||||
return true;
|
||||
});
|
||||
then(() => $q.reject('exists'), () => true);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+33
-26
@@ -1,7 +1,7 @@
|
||||
// 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 <https://github.com/diegovilar>
|
||||
// Georgii Dolzhykov <https://github.com/thorn0>
|
||||
// Caleb St-Denis <https://github.com/calebstdenis>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -9,6 +9,9 @@
|
||||
|
||||
/// <reference path="jqlite.d.ts" />
|
||||
|
||||
// NOTE: @types/angular technically doesn't require TypeScript 2.3, only TypeScript 2.1.
|
||||
// It has a TypeScript 2.3 header so that merging tests with @types/jquery v3 will work.
|
||||
|
||||
declare var angular: angular.IAngularStatic;
|
||||
|
||||
// Support for painless dependency injection
|
||||
@@ -974,7 +977,7 @@ declare namespace angular {
|
||||
// DocumentService
|
||||
// see http://docs.angularjs.org/api/ng.$document
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IDocumentService extends JQuery {
|
||||
interface IDocumentService extends JQLite {
|
||||
// Must return intersection type for index signature compatibility with JQuery
|
||||
[index: number]: HTMLElement & Document;
|
||||
}
|
||||
@@ -991,7 +994,7 @@ declare namespace angular {
|
||||
// RootElementService
|
||||
// see http://docs.angularjs.org/api/ng.$rootElement
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRootElementService extends JQuery {}
|
||||
interface IRootElementService extends JQLite {}
|
||||
|
||||
interface IQResolveReject<T> {
|
||||
(): void;
|
||||
@@ -1302,12 +1305,12 @@ declare namespace angular {
|
||||
|
||||
interface ICloneAttachFunction {
|
||||
// Let's hint but not force cloneAttachFn's signature
|
||||
(clonedElement?: JQuery, scope?: IScope): any;
|
||||
(clonedElement?: JQLite, scope?: IScope): any;
|
||||
}
|
||||
|
||||
// This corresponds to the "publicLinkFn" returned by $compile.
|
||||
interface ITemplateLinkingFunction {
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ITemplateLinkingFunctionOptions): JQuery;
|
||||
(scope: IScope, cloneAttachFn?: ICloneAttachFunction, options?: ITemplateLinkingFunctionOptions): JQLite;
|
||||
}
|
||||
|
||||
interface ITemplateLinkingFunctionOptions {
|
||||
@@ -1325,9 +1328,9 @@ declare namespace angular {
|
||||
*/
|
||||
interface ITranscludeFunction {
|
||||
// If the scope is provided, then the cloneAttachFn must be as well.
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite;
|
||||
// If one argument is provided, then it's assumed to be the cloneAttachFn.
|
||||
(cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
(cloneAttachFn?: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQLite;
|
||||
|
||||
/**
|
||||
* Returns true if the specified slot contains content (i.e. one or more DOM nodes)
|
||||
@@ -1520,23 +1523,27 @@ declare namespace angular {
|
||||
(data: T, status: number, headers: IHttpHeadersGetter, config: IRequestConfig): void;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallbackArg<T> {
|
||||
data?: T;
|
||||
status?: number;
|
||||
headers?: IHttpHeadersGetter;
|
||||
config?: IRequestConfig;
|
||||
statusText?: string;
|
||||
interface IHttpResponse<T> {
|
||||
data: T;
|
||||
status: number;
|
||||
headers: IHttpHeadersGetter;
|
||||
config: IRequestConfig;
|
||||
statusText: string;
|
||||
/** Added in AngularJS 1.6.6 */
|
||||
xhrStatus: 'complete' | 'error' | 'timeout' | 'abort';
|
||||
}
|
||||
|
||||
interface IHttpPromise<T> extends IPromise<IHttpPromiseCallbackArg<T>> {
|
||||
}
|
||||
/** @deprecated The old name of IHttpResponse. Kept for compatibility. */
|
||||
type IHttpPromiseCallbackArg<T> = IHttpResponse<T>;
|
||||
|
||||
type IHttpPromise<T> = IPromise<IHttpResponse<T>>;
|
||||
|
||||
// See the jsdoc for transformData() at https://github.com/angular/angular.js/blob/master/src/ng/http.js#L228
|
||||
interface IHttpRequestTransformer {
|
||||
(data: any, headersGetter: IHttpHeadersGetter): any;
|
||||
}
|
||||
|
||||
// The definition of fields are the same as IHttpPromiseCallbackArg
|
||||
// The definition of fields are the same as IHttpResponse
|
||||
interface IHttpResponseTransformer {
|
||||
(data: any, headersGetter: IHttpHeadersGetter, status: number): any;
|
||||
}
|
||||
@@ -1609,10 +1616,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): IRequestConfig | IPromise<IRequestConfig>;
|
||||
response?<T>(response: IHttpResponse<T>): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
|
||||
responseError?<T>(rejection: any): IPromise<IHttpResponse<T>> | IHttpResponse<T>;
|
||||
}
|
||||
|
||||
interface IHttpInterceptorFactory {
|
||||
@@ -1962,7 +1969,7 @@ declare namespace angular {
|
||||
interface IDirectiveLinkFn {
|
||||
(
|
||||
scope: IScope,
|
||||
instanceElement: JQuery,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: IAttributes,
|
||||
controller?: IController | IController[] | {[key: string]: IController},
|
||||
transclude?: ITranscludeFunction
|
||||
@@ -1976,7 +1983,7 @@ declare namespace angular {
|
||||
|
||||
interface IDirectiveCompileFn {
|
||||
(
|
||||
templateElement: JQuery,
|
||||
templateElement: JQLite,
|
||||
templateAttributes: IAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
@@ -2008,9 +2015,9 @@ declare namespace angular {
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
restrict?: string;
|
||||
scope?: boolean | {[boundProperty: string]: string};
|
||||
template?: string | ((tElement: JQuery, tAttrs: IAttributes) => string);
|
||||
template?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
templateNamespace?: string;
|
||||
templateUrl?: string | ((tElement: JQuery, tAttrs: IAttributes) => string);
|
||||
templateUrl?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
terminal?: boolean;
|
||||
transclude?: boolean | 'element' | {[slot: string]: string};
|
||||
}
|
||||
@@ -2023,7 +2030,7 @@ declare namespace angular {
|
||||
* See: http://docs.angularjs.org/api/angular.element
|
||||
*/
|
||||
interface IAugmentedJQueryStatic extends JQueryStatic {}
|
||||
interface IAugmentedJQuery extends JQuery {}
|
||||
interface IAugmentedJQuery extends JQLite {}
|
||||
|
||||
/**
|
||||
* Same as IController. Keeping it for compatibility with older versions of these type definitions.
|
||||
|
||||
Vendored
+91
-74
@@ -25,6 +25,10 @@
|
||||
|
||||
// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts
|
||||
|
||||
interface JQLite extends JQuery {
|
||||
[index: number]: HTMLElement;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Adds the specified class(es) to each of the set of matched elements.
|
||||
@@ -32,7 +36,7 @@ interface JQuery {
|
||||
* @param className One or more space-separated classes to be added to the class attribute of each matched element.
|
||||
* @see {@link https://api.jquery.com/addClass/#addClass-className}
|
||||
*/
|
||||
addClass(className: string): JQuery;
|
||||
addClass(className: string): this;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, after each element in the set of matched elements.
|
||||
@@ -41,14 +45,14 @@ interface JQuery {
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/after/#after-content-content}
|
||||
*/
|
||||
after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
|
||||
/**
|
||||
* Insert content, specified by the parameter, after each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/after/#after-function}
|
||||
*/
|
||||
after(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
after(func: (index: number, html: string) => string | Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
|
||||
@@ -57,14 +61,14 @@ interface JQuery {
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/append/#append-content-content}
|
||||
*/
|
||||
append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/append/#append-function}
|
||||
*/
|
||||
append(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
append(func: (index: number, html: string) => string | Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Get the value of an attribute for the first element in the set of matched elements.
|
||||
@@ -80,14 +84,14 @@ interface JQuery {
|
||||
* @param value A value to set for the attribute. If this is `null`, the attribute will be deleted.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributeName-value}
|
||||
*/
|
||||
attr(attributeName: string, value: string | number | null): JQuery;
|
||||
attr(attributeName: string, value: string | number | null): this;
|
||||
/**
|
||||
* Set one or more attributes for the set of matched elements.
|
||||
*
|
||||
* @param attributes An object of attribute-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributes}
|
||||
*/
|
||||
attr(attributes: Object): JQuery;
|
||||
attr(attributes: Object): this;
|
||||
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
@@ -96,7 +100,7 @@ interface JQuery {
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
|
||||
*/
|
||||
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
@@ -104,21 +108,21 @@ interface JQuery {
|
||||
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble}
|
||||
*/
|
||||
bind(eventType: string, preventBubble: boolean): JQuery;
|
||||
bind(eventType: string, preventBubble: boolean): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param events An object containing one or more DOM event types and functions to execute for them.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-events}
|
||||
*/
|
||||
bind(events: any): JQuery;
|
||||
bind(events: any): this;
|
||||
|
||||
/**
|
||||
* Get the children of each element in the set of matched elements, optionally filtered by a selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/children/}
|
||||
*/
|
||||
children(): JQuery;
|
||||
children(): this;
|
||||
|
||||
/**
|
||||
* Create a deep copy of the set of matched elements.
|
||||
@@ -127,13 +131,13 @@ interface JQuery {
|
||||
* @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).
|
||||
* @see {@link https://api.jquery.com/clone/}
|
||||
*/
|
||||
clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery;
|
||||
clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this;
|
||||
|
||||
/**
|
||||
* Get the children of each element in the set of matched elements, including text and comment nodes.
|
||||
* @see {@link https://api.jquery.com/contents/}
|
||||
*/
|
||||
contents(): JQuery;
|
||||
contents(): this;
|
||||
|
||||
/**
|
||||
* Get the value of style properties for the first element in the set of matched elements.
|
||||
@@ -157,7 +161,7 @@ interface JQuery {
|
||||
* @param value A value to set for the property.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName-value}
|
||||
*/
|
||||
css(propertyName: string, value: string | number): JQuery;
|
||||
css(propertyName: string, value: string | number): this;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
@@ -165,14 +169,14 @@ interface JQuery {
|
||||
* @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName-function}
|
||||
*/
|
||||
css(propertyName: string, value: (index: number, value: string) => string | number): JQuery;
|
||||
css(propertyName: string, value: (index: number, value: string) => string | number): this;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/css/#css-properties}
|
||||
*/
|
||||
css(properties: JQLiteCssProperties): JQuery;
|
||||
css(properties: JQLiteCssProperties): this;
|
||||
|
||||
/**
|
||||
* Store arbitrary data associated with the matched elements.
|
||||
@@ -181,7 +185,7 @@ interface JQuery {
|
||||
* @param value The new data value; it can be any JavaScript type including Array or Object.
|
||||
* @see {@link https://api.jquery.com/data/#data-key-value}
|
||||
*/
|
||||
data(key: string, value: any): JQuery;
|
||||
data(key: string, value: any): this;
|
||||
/**
|
||||
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
|
||||
*
|
||||
@@ -195,7 +199,7 @@ interface JQuery {
|
||||
* @param obj An object of key-value pairs of data to update.
|
||||
* @see {@link https://api.jquery.com/data/#data-obj}
|
||||
*/
|
||||
data(obj: { [key: string]: any; }): JQuery;
|
||||
data(obj: { [key: string]: any; }): this;
|
||||
/**
|
||||
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
|
||||
* @see {@link https://api.jquery.com/data/#data}
|
||||
@@ -208,13 +212,13 @@ interface JQuery {
|
||||
* @param selector A selector expression that filters the set of matched elements to be removed.
|
||||
* @see {@link https://api.jquery.com/detach/}
|
||||
*/
|
||||
detach(selector?: string): JQuery;
|
||||
detach(selector?: string): this;
|
||||
|
||||
/**
|
||||
* Remove all child nodes of the set of matched elements from the DOM.
|
||||
* @see {@link https://api.jquery.com/empty/}
|
||||
*/
|
||||
empty(): JQuery;
|
||||
empty(): this;
|
||||
|
||||
/**
|
||||
* Reduce the set of matched elements to the one at the specified index.
|
||||
@@ -222,7 +226,7 @@ interface JQuery {
|
||||
* @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set.
|
||||
* @see {@link https://api.jquery.com/eq/}
|
||||
*/
|
||||
eq(index: number): JQuery;
|
||||
eq(index: number): this;
|
||||
|
||||
/**
|
||||
* Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
|
||||
@@ -230,9 +234,9 @@ interface JQuery {
|
||||
* @param selector A string containing a selector expression to match elements against.
|
||||
* @see {@link https://api.jquery.com/find/#find-selector}
|
||||
*/
|
||||
find(selector: string): JQuery;
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
find(selector: string): this;
|
||||
find(element: any): this;
|
||||
find(obj: JQuery): this;
|
||||
|
||||
/**
|
||||
* Determine whether any of the matched elements are assigned the given class.
|
||||
@@ -253,21 +257,21 @@ interface JQuery {
|
||||
* @param htmlString A string of HTML to set as the content of each matched element.
|
||||
* @see {@link https://api.jquery.com/html/#html-htmlString}
|
||||
*/
|
||||
html(htmlString: string): JQuery;
|
||||
html(htmlString: string): this;
|
||||
/**
|
||||
* Set the HTML contents of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/html/#html-function}
|
||||
*/
|
||||
html(func: (index: number, oldhtml: string) => string): JQuery;
|
||||
html(func: (index: number, oldhtml: string) => string): this;
|
||||
|
||||
/**
|
||||
* Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/next/}
|
||||
*/
|
||||
next(): JQuery;
|
||||
next(): this;
|
||||
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
@@ -276,7 +280,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -285,7 +289,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -294,7 +298,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
|
||||
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -304,7 +308,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
|
||||
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -313,7 +317,7 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data}
|
||||
*/
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): JQuery;
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): this;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
@@ -321,13 +325,13 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data}
|
||||
*/
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): JQuery;
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): this;
|
||||
|
||||
/**
|
||||
* Remove an event handler.
|
||||
* @see {@link https://api.jquery.com/off/#off}
|
||||
*/
|
||||
off(): JQuery;
|
||||
off(): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -336,7 +340,7 @@ interface JQuery {
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -344,7 +348,7 @@ interface JQuery {
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on().
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -352,7 +356,7 @@ interface JQuery {
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
off(events: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
@@ -360,7 +364,7 @@ interface JQuery {
|
||||
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector}
|
||||
*/
|
||||
off(events: { [key: string]: any; }, selector?: string): JQuery;
|
||||
off(events: { [key: string]: any; }, selector?: string): this;
|
||||
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
@@ -369,7 +373,7 @@ interface JQuery {
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-data-handler}
|
||||
*/
|
||||
one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -378,7 +382,7 @@ interface JQuery {
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-data-handler}
|
||||
*/
|
||||
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -387,7 +391,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
|
||||
*/
|
||||
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -397,7 +401,7 @@ interface JQuery {
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
|
||||
*/
|
||||
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -406,7 +410,7 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data}
|
||||
*/
|
||||
one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
|
||||
one(events: { [key: string]: any; }, selector?: string, data?: any): this;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
@@ -414,14 +418,14 @@ interface JQuery {
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data}
|
||||
*/
|
||||
one(events: { [key: string]: any; }, data?: any): JQuery;
|
||||
one(events: { [key: string]: any; }, data?: any): this;
|
||||
|
||||
/**
|
||||
* Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/parent/}
|
||||
*/
|
||||
parent(): JQuery;
|
||||
parent(): this;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
|
||||
@@ -430,14 +434,14 @@ interface JQuery {
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/prepend/#prepend-content-content}
|
||||
*/
|
||||
prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): this;
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/prepend/#prepend-function}
|
||||
*/
|
||||
prepend(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
prepend(func: (index: number, html: string) => string | Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Get the value of a property for the first element in the set of matched elements.
|
||||
@@ -453,14 +457,14 @@ interface JQuery {
|
||||
* @param value A value to set for the property.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName-value}
|
||||
*/
|
||||
prop(propertyName: string, value: string | number | boolean): JQuery;
|
||||
prop(propertyName: string, value: string | number | boolean): this;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-properties}
|
||||
*/
|
||||
prop(properties: Object): JQuery;
|
||||
prop(properties: Object): this;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
@@ -468,7 +472,7 @@ interface JQuery {
|
||||
* @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName-function}
|
||||
*/
|
||||
prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery;
|
||||
prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): this;
|
||||
|
||||
/**
|
||||
* Specify a function to execute when the DOM is fully loaded.
|
||||
@@ -476,7 +480,7 @@ interface JQuery {
|
||||
* @param handler A function to execute after the DOM is ready.
|
||||
* @see {@link https://api.jquery.com/ready/}
|
||||
*/
|
||||
ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery;
|
||||
ready(handler: (jQueryAlias?: JQueryStatic) => any): this;
|
||||
|
||||
/**
|
||||
* Remove the set of matched elements from the DOM.
|
||||
@@ -484,7 +488,7 @@ interface JQuery {
|
||||
* @param selector A selector expression that filters the set of matched elements to be removed.
|
||||
* @see {@link https://api.jquery.com/remove/}
|
||||
*/
|
||||
remove(selector?: string): JQuery;
|
||||
remove(selector?: string): this;
|
||||
|
||||
/**
|
||||
* Remove an attribute from each element in the set of matched elements.
|
||||
@@ -492,7 +496,7 @@ interface JQuery {
|
||||
* @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
|
||||
* @see {@link https://api.jquery.com/removeAttr/}
|
||||
*/
|
||||
removeAttr(attributeName: string): JQuery;
|
||||
removeAttr(attributeName: string): this;
|
||||
|
||||
/**
|
||||
* Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
|
||||
@@ -500,7 +504,7 @@ interface JQuery {
|
||||
* @param className One or more space-separated classes to be removed from the class attribute of each matched element.
|
||||
* @see {@link https://api.jquery.com/removeClass/#removeClass-className}
|
||||
*/
|
||||
removeClass(className?: string): JQuery;
|
||||
removeClass(className?: string): this;
|
||||
|
||||
/**
|
||||
* Remove a previously-stored piece of data.
|
||||
@@ -508,19 +512,19 @@ interface JQuery {
|
||||
* @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
|
||||
* @see {@link https://api.jquery.com/removeData/#removeData-name}
|
||||
*/
|
||||
removeData(name: string): JQuery;
|
||||
removeData(name: string): this;
|
||||
/**
|
||||
* Remove a previously-stored piece of data.
|
||||
*
|
||||
* @param list An array of strings naming the pieces of data to delete.
|
||||
* @see {@link https://api.jquery.com/removeData/#removeData-list}
|
||||
*/
|
||||
removeData(list: string[]): JQuery;
|
||||
removeData(list: string[]): this;
|
||||
/**
|
||||
* Remove all previously-stored piece of data.
|
||||
* @see {@link https://api.jquery.com/removeData/}
|
||||
*/
|
||||
removeData(): JQuery;
|
||||
removeData(): this;
|
||||
|
||||
/**
|
||||
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
|
||||
@@ -528,14 +532,14 @@ interface JQuery {
|
||||
* @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object.
|
||||
* @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent}
|
||||
*/
|
||||
replaceWith(newContent: JQuery | any[] | Element | Text | string): JQuery;
|
||||
replaceWith(newContent: JQuery | any[] | Element | Text | string): this;
|
||||
/**
|
||||
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
|
||||
*
|
||||
* @param func A function that returns content with which to replace the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/replaceWith/#replaceWith-function}
|
||||
*/
|
||||
replaceWith(func: () => Element | JQuery): JQuery;
|
||||
replaceWith(func: () => Element | JQuery): this;
|
||||
|
||||
/**
|
||||
* Get the combined text contents of each element in the set of matched elements, including their descendants.
|
||||
@@ -548,14 +552,14 @@ interface JQuery {
|
||||
* @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation.
|
||||
* @see {@link https://api.jquery.com/text/#text-text}
|
||||
*/
|
||||
text(text: string | number | boolean): JQuery;
|
||||
text(text: string | number | boolean): this;
|
||||
/**
|
||||
* Set the content of each element in the set of matched elements to the specified text.
|
||||
*
|
||||
* @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.
|
||||
* @see {@link https://api.jquery.com/text/#text-function}
|
||||
*/
|
||||
text(func: (index: number, text: string) => string): JQuery;
|
||||
text(func: (index: number, text: string) => string): this;
|
||||
|
||||
/**
|
||||
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
|
||||
@@ -564,14 +568,14 @@ interface JQuery {
|
||||
* @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
|
||||
* @see {@link https://api.jquery.com/toggleClass/#toggleClass-className}
|
||||
*/
|
||||
toggleClass(className: string, swtch?: boolean): JQuery;
|
||||
toggleClass(className: string, swtch?: boolean): this;
|
||||
/**
|
||||
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
|
||||
*
|
||||
* @param swtch A boolean value to determine whether the class should be added or removed.
|
||||
* @see {@link https://api.jquery.com/toggleClass/#toggleClass-state}
|
||||
*/
|
||||
toggleClass(swtch?: boolean): JQuery;
|
||||
toggleClass(swtch?: boolean): this;
|
||||
|
||||
/**
|
||||
* Execute all handlers attached to an element for an event.
|
||||
@@ -597,7 +601,7 @@ interface JQuery {
|
||||
* @param handler The function that is to be no longer executed.
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler}
|
||||
*/
|
||||
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): this;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
@@ -605,14 +609,14 @@ interface JQuery {
|
||||
* @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-eventType-false}
|
||||
*/
|
||||
unbind(eventType: string, fls: boolean): JQuery;
|
||||
unbind(eventType: string, fls: boolean): this;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param evt A JavaScript event object as passed to an event handler.
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-event}
|
||||
*/
|
||||
unbind(evt: any): JQuery;
|
||||
unbind(evt: any): this;
|
||||
|
||||
/**
|
||||
* Get the current value of the first element in the set of matched elements.
|
||||
@@ -625,14 +629,14 @@ interface JQuery {
|
||||
* @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked.
|
||||
* @see {@link https://api.jquery.com/val/#val-value}
|
||||
*/
|
||||
val(value: string | string[] | number): JQuery;
|
||||
val(value: string | string[] | number): this;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
* @see {@link https://api.jquery.com/val/#val-function}
|
||||
*/
|
||||
val(func: (index: number, value: string) => string): JQuery;
|
||||
val(func: (index: number, value: string) => string): this;
|
||||
|
||||
/**
|
||||
* Wrap an HTML structure around each element in the set of matched elements.
|
||||
@@ -640,14 +644,14 @@ interface JQuery {
|
||||
* @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
|
||||
* @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement}
|
||||
*/
|
||||
wrap(wrappingElement: JQuery | Element | string): JQuery;
|
||||
wrap(wrappingElement: JQuery | Element | string): this;
|
||||
/**
|
||||
* Wrap an HTML structure around each element in the set of matched elements.
|
||||
*
|
||||
* @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/wrap/#wrap-function}
|
||||
*/
|
||||
wrap(func: (index: number) => string | JQuery): JQuery;
|
||||
wrap(func: (index: number) => string | JQuery): this;
|
||||
|
||||
// Undocumented
|
||||
length: number;
|
||||
@@ -657,17 +661,30 @@ interface JQuery {
|
||||
|
||||
controller(name?: string): any;
|
||||
injector(): ng.auto.IInjectorService;
|
||||
/** It's declared generic for custom scope interfaces */
|
||||
/**
|
||||
* Returns the `$scope` of the element.
|
||||
*
|
||||
* **IMPORTANT**: Requires `debugInfoEnabled` to be true.
|
||||
*
|
||||
* See https://docs.angularjs.org/guide/production#disabling-debug-data for more information.
|
||||
*/
|
||||
scope<T extends ng.IScope>(): T;
|
||||
/**
|
||||
* Returns the `$scope` of the element.
|
||||
*
|
||||
* **IMPORTANT**: Requires `debugInfoEnabled` to be true.
|
||||
*
|
||||
* See https://docs.angularjs.org/guide/production#disabling-debug-data for more information.
|
||||
*/
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key: string, value: any): this;
|
||||
inheritedData(obj: { [key: string]: any; }): this;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQuery;
|
||||
(element: string | Element | Document | JQuery | ArrayLike<Element>): JQLite;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import * as angular from 'angular';
|
||||
|
||||
function JQLite() {
|
||||
function indexSignature() {
|
||||
angular.element('p')[0]; // $ExpectType HTMLElement
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,10 @@ import $ = require('jquery');
|
||||
import * as angular from 'angular';
|
||||
|
||||
function JQuery() {
|
||||
function indexSignature() {
|
||||
$('p')[0]; // $ExpectType HTMLElement
|
||||
}
|
||||
|
||||
function addClass() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').addClass('className');
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"index.d.ts",
|
||||
"jqlite.d.ts",
|
||||
"angular-tests.ts",
|
||||
"test/jqlite-tests.ts",
|
||||
"test/jquery3-merging-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
"max-line-length": false,
|
||||
"no-empty-interface": false,
|
||||
"no-namespace": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-void-expression": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AngularFire 0.8.2
|
||||
// Project: http://angularfire.com
|
||||
// Definitions by: Dénes Harmath <http://github.com/thSoft>
|
||||
// Definitions by: Dénes Harmath <https://github.com/thSoft>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user