mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge branch 'master' into react-smooth-scrollbar
This commit is contained in:
@@ -206,7 +206,7 @@ Here are the [currently requested definitions](https://github.com/DefinitelyType
|
||||
|
||||
If types are part of a web standard, they should be contributed to [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) so that they can become part of the default `lib.dom.d.ts`.
|
||||
|
||||
### A package uses `export =`, but I prefer to use default imports. Can I change `export =` to `export default`?
|
||||
#### A package uses `export =`, but I prefer to use default imports. Can I change `export =` to `export default`?
|
||||
|
||||
If default imports work in your environment, consider turning on the [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html) compiler option.
|
||||
Do not change the type definition if it is accurate.
|
||||
@@ -214,8 +214,7 @@ For an NPM package, `export =` is accurate if `node -p 'require("foo")'` is the
|
||||
|
||||
#### I want to use features from TypeScript 2.1.
|
||||
|
||||
Then you will have to add a comment to your definition header: `// TypeScript Version: 2.1`.
|
||||
If it is merged before January 7, it will be published as a prerelease version, such as `4.3.0-next.0`.
|
||||
Then you will have to add a comment to the last line of your definition header (after `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`.
|
||||
|
||||
#### I want to add a DOM API not present in TypeScript by default.
|
||||
|
||||
|
||||
+17
-17
@@ -15,22 +15,22 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"tests/ace-anchor-tests.ts",
|
||||
"tests/ace-background_tokenizer-tests.ts",
|
||||
"tests/ace-default-tests.ts",
|
||||
"tests/ace-document-tests.ts",
|
||||
"tests/ace-edit_session-tests.ts",
|
||||
"tests/ace-editor1-tests.ts",
|
||||
"tests/ace-editor_highlight_selected_word-tests.ts",
|
||||
"tests/ace-editor_navigation-tests.ts",
|
||||
"tests/ace-editor_text_edit-tests.ts",
|
||||
"tests/ace-multi_select-tests.ts",
|
||||
"tests/ace-placeholder-tests.ts",
|
||||
"tests/ace-range-tests.ts",
|
||||
"tests/ace-range_list-tests.ts",
|
||||
"tests/ace-search-tests.ts",
|
||||
"tests/ace-selection-tests.ts",
|
||||
"tests/ace-token_iterator-tests.ts",
|
||||
"tests/ace-virtual_renderer-tests.ts"
|
||||
"test/anchor.ts",
|
||||
"test/background_tokenizer.ts",
|
||||
"test/default.ts",
|
||||
"test/document.ts",
|
||||
"test/edit_session.ts",
|
||||
"test/editor1.ts",
|
||||
"test/editor_highlight_selected_word.ts",
|
||||
"test/editor_navigation.ts",
|
||||
"test/editor_text_edit.ts",
|
||||
"test/multi_select.ts",
|
||||
"test/placeholder.ts",
|
||||
"test/range.ts",
|
||||
"test/range_list.ts",
|
||||
"test/search.ts",
|
||||
"test/selection.ts",
|
||||
"test/token_iterator.ts",
|
||||
"test/virtual_renderer.ts"
|
||||
]
|
||||
}
|
||||
+3
-3
@@ -15,8 +15,8 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"acl-tests.ts",
|
||||
"acl-mongodbBackend-tests.ts",
|
||||
"acl-redisBackend-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/mongodbBackend.ts",
|
||||
"test/redisBackend.ts"
|
||||
]
|
||||
}
|
||||
+2
-2
@@ -15,8 +15,8 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"adal-tests.ts",
|
||||
"adal-angular.d.ts",
|
||||
"adal-angular-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/angular.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"amplifyjs-tests.ts"
|
||||
"amplify-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-localForage-tests.ts"
|
||||
"angular-localforage-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"match-media-tests.ts"
|
||||
"angular-media-queries-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angularLocalStorage-tests.ts"
|
||||
"angularlocalstorage-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"index-tests.ts"
|
||||
"array-uniq-tests.ts"
|
||||
]
|
||||
}
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"async-tests.ts",
|
||||
"async-explicit-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/explicit.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"auth0.lock-tests.ts"
|
||||
"auth0-lock-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"AzureMobileServicesClient-tests.ts"
|
||||
"azure-mobile-services-client-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"babylon-tests.ts"
|
||||
"babylonjs-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"marionette-tests.ts"
|
||||
"backbone.marionette-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,404 +0,0 @@
|
||||
import * as Backbone from "backbone";
|
||||
import * as _ from "lodash";
|
||||
|
||||
function test_events() {
|
||||
|
||||
var object = new Backbone.Events();
|
||||
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
|
||||
|
||||
object.trigger("alert", "an event");
|
||||
|
||||
var onChange = () => alert('whatever');
|
||||
var context: any;
|
||||
|
||||
object.off("change", onChange);
|
||||
object.off("change");
|
||||
object.off(null, onChange);
|
||||
object.off(null, null, context);
|
||||
object.off();
|
||||
}
|
||||
|
||||
class SettingDefaults extends Backbone.Model {
|
||||
|
||||
// 'defaults' could be set in one of the following ways:
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
name: "Joe"
|
||||
}
|
||||
}
|
||||
|
||||
constructor(attributes?: any, options?: any) {
|
||||
super(attributes, options); // TODO error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
|
||||
this.defaults = <any>{
|
||||
name: "Joe"
|
||||
}
|
||||
// super has to come last
|
||||
}
|
||||
|
||||
// or set it like this
|
||||
initialize() {
|
||||
this.defaults = <any>{
|
||||
name: "Joe"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// same patterns could be used for setting 'Router.routes' and 'View.events'
|
||||
}
|
||||
|
||||
class Sidebar extends Backbone.Model {
|
||||
|
||||
promptColor() {
|
||||
var cssColor = prompt("Please enter a CSS color:");
|
||||
this.set({ color: cssColor });
|
||||
}
|
||||
}
|
||||
|
||||
class Note extends Backbone.Model {
|
||||
initialize() { }
|
||||
author() { }
|
||||
coordinates() { }
|
||||
allowedToEdit(account: any) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class PrivateNote extends Note {
|
||||
allowedToEdit(account: any) {
|
||||
return account.owns(this);
|
||||
}
|
||||
|
||||
set(attributes: any, options?: any): Backbone.Model {
|
||||
return Backbone.Model.prototype.set.call(this, attributes, options);
|
||||
}
|
||||
}
|
||||
|
||||
function test_models() {
|
||||
|
||||
var sidebar = new Sidebar();
|
||||
sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color }));
|
||||
sidebar.set({ color: 'white' });
|
||||
sidebar.promptColor();
|
||||
|
||||
//////////
|
||||
|
||||
var note = new PrivateNote();
|
||||
|
||||
note.get("title");
|
||||
|
||||
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
|
||||
|
||||
note.set("title", "A Scandal in Bohemia");
|
||||
|
||||
let strings: string[]
|
||||
let value: any;
|
||||
let values: any[];
|
||||
let bool: boolean;
|
||||
|
||||
// underscore methods
|
||||
strings = note.keys();
|
||||
values = note.values();
|
||||
values = note.pairs();
|
||||
values = note.invert();
|
||||
value = note.pick("foo");
|
||||
value = note.pick("foo", "bar");
|
||||
value = note.pick((value: any, key: any, object: any) => true);
|
||||
value = note.omit("foo");
|
||||
value = note.omit("foo", "bar");
|
||||
value = note.omit((value: any, key: any, object: any) => true);
|
||||
value = note.chain().pick().omit().value();
|
||||
bool = note.isEmpty();
|
||||
}
|
||||
|
||||
class Employee extends Backbone.Model {
|
||||
reports: EmployeeCollection;
|
||||
|
||||
constructor(attributes?: any, options?: any) {
|
||||
super(options);
|
||||
this.reports = new EmployeeCollection();
|
||||
this.reports.url = '../api/employees/' + this.id + '/reports';
|
||||
}
|
||||
|
||||
more() {
|
||||
this.reports.reset();
|
||||
}
|
||||
}
|
||||
|
||||
class EmployeeCollection extends Backbone.Collection<Employee> {
|
||||
findByName(key: any) { }
|
||||
}
|
||||
|
||||
class Book extends Backbone.Model {
|
||||
title: string;
|
||||
author: string;
|
||||
published: boolean;
|
||||
}
|
||||
|
||||
class Library extends Backbone.Collection<Book> {
|
||||
// This model definition is here only to test type compatibility of the model, but it
|
||||
// is not necessary in working code as it is automatically inferred through generics.
|
||||
model: typeof Book;
|
||||
}
|
||||
|
||||
class Books extends Backbone.Collection<Book> { }
|
||||
|
||||
function test_collection() {
|
||||
|
||||
var books = new Books();
|
||||
|
||||
var book1: Book = new Book({ title: "Title 1", author: "Mike" });
|
||||
books.add(book1);
|
||||
|
||||
// Objects can be added to collection by casting to model type.
|
||||
// Compiler will check if object properties are valid for the cast.
|
||||
// This gives better type checking than declaring an `any` overload.
|
||||
books.add(<Book>{ title: "Title 2", author: "Mikey" });
|
||||
|
||||
var model: Book = book1.collection.first();
|
||||
if (model !== book1) {
|
||||
throw new Error("Error");
|
||||
}
|
||||
|
||||
books.each(book =>
|
||||
book.get("title"));
|
||||
|
||||
var titles = books.map(book =>
|
||||
book.get("title"));
|
||||
|
||||
var publishedBooks = books.filter(book =>
|
||||
book.get("published") === true);
|
||||
|
||||
var alphabetical = books.sortBy((book: Book): number => null);
|
||||
|
||||
let one: Book;
|
||||
let models: Book[];
|
||||
let bool: boolean;
|
||||
let numDict: _.Dictionary<number>;
|
||||
let modelDict: _.Dictionary<Book>;
|
||||
let modelsDict: _.Dictionary<Book[]>;
|
||||
let num: number;
|
||||
|
||||
models = books.slice(1);
|
||||
models = books.slice(1, 3);
|
||||
|
||||
// underscore methods
|
||||
bool = books.all((value: Book, index: number, list: Book[]) => true);
|
||||
bool = books.any((value: Book, index: number, list: Book[]) => true);
|
||||
bool = books.chain().any((value: Book, index: number, list: Book[]) => true).value();
|
||||
models = books.collect((value: Book, index: number, list: Book[]) => value);
|
||||
bool = books.contains(book1);
|
||||
numDict = books.countBy((value: Book, index: number, list: Book[]) => true);
|
||||
numDict = books.countBy("foo");
|
||||
one = books.detect((value: Book, index: number, list: Book[]) => true);
|
||||
models = books.difference([book1]);
|
||||
models = books.drop();
|
||||
models = books.each((value: Book, index: number, list: Book[]) => true);
|
||||
bool = books.every((value: Book, index: number, list: Book[]) => true);
|
||||
models = books.filter((value: Book, index: number, list: Book[]) => true);
|
||||
one = books.find((value: Book, index: number, list: Book[]) => true);
|
||||
num = books.findIndex((value: Book, index: number, list: Book[]) => true);
|
||||
num = books.findLastIndex((value: Book, index: number, list: Book[]) => true);
|
||||
one = books.first();
|
||||
models = books.first(3);
|
||||
models = books.foldl((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
|
||||
models = books.foldr((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
|
||||
models = books.forEach((value: Book, index: number, list: Book[]) => true);
|
||||
modelsDict = books.groupBy((value: Book, index: number, list: Book[]) => true);
|
||||
modelsDict = books.groupBy("foo");
|
||||
one = books.head();
|
||||
models = books.head(3);
|
||||
bool = books.include(book1);
|
||||
bool = books.includes(book1);
|
||||
modelDict = books.indexBy((value: Book, index: number, list: Book[]) => true);
|
||||
modelDict = books.indexBy("foo");
|
||||
num = books.indexOf(book1, true);
|
||||
one = books.initial();
|
||||
models = books.initial(3);
|
||||
models = books.inject((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
|
||||
one = books.invoke("at", 3);
|
||||
bool = books.isEmpty();
|
||||
one = books.last();
|
||||
models = books.last(3);
|
||||
num = books.lastIndexOf(book1, 3);
|
||||
models = books.map((value: Book, index: number, list: Book[]) => value);
|
||||
one = books.max((value: Book, index: number, list: Book[]) => value);
|
||||
one = books.min((value: Book, index: number, list: Book[]) => value);
|
||||
[models] = books.partition((value: Book, index: number, list: Book[]) => true);
|
||||
models = books.reduce((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
|
||||
models = books.reduceRight((prev: Book[], curr: Book, index: number, list: Book[]) => prev, []);
|
||||
models = books.reject((value: Book, index: number, list: Book[]) => true);
|
||||
models = books.rest(3);
|
||||
one = books.sample();
|
||||
models = books.sample(3);
|
||||
models = books.select((value: Book, index: number, list: Book[]) => true);
|
||||
models = books.shuffle();
|
||||
num = books.size();
|
||||
bool = books.some((value: Book, index: number, list: Book[]) => true);
|
||||
models = books.sortBy((value: Book, index: number, list: Book[]) => value);
|
||||
models = books.sortBy("foo");
|
||||
models = books.tail(3);
|
||||
one = books.take();
|
||||
models = books.take(3);
|
||||
models = books.toArray();
|
||||
models = books.without(book1, book1);
|
||||
}
|
||||
|
||||
//////////
|
||||
|
||||
Backbone.history.start();
|
||||
|
||||
namespace v1Changes {
|
||||
namespace events {
|
||||
function test_once() {
|
||||
var model = new Employee;
|
||||
model.once('invalid', () => { }, this);
|
||||
model.once('invalid', () => { });
|
||||
}
|
||||
|
||||
function test_listenTo() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.listenTo(model, 'invalid', () => { });
|
||||
}
|
||||
|
||||
function test_listenToOnce() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.listenToOnce(model, 'invalid', () => { });
|
||||
}
|
||||
|
||||
function test_stopListening() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.stopListening(model, 'invalid', () => { });
|
||||
view.stopListening(model, 'invalid');
|
||||
view.stopListening(model);
|
||||
}
|
||||
}
|
||||
|
||||
namespace ModelAndCollection {
|
||||
function test_url() {
|
||||
Employee.prototype.url = () => '/employees';
|
||||
EmployeeCollection.prototype.url = () => '/employees';
|
||||
}
|
||||
|
||||
function test_parse() {
|
||||
var model = new Employee();
|
||||
model.parse('{}', {});
|
||||
var collection = new EmployeeCollection;
|
||||
collection.parse('{}', {});
|
||||
}
|
||||
|
||||
function test_toJSON() {
|
||||
var model = new Employee();
|
||||
model.toJSON({});
|
||||
var collection = new EmployeeCollection;
|
||||
collection.toJSON({});
|
||||
}
|
||||
|
||||
function test_sync() {
|
||||
var model = new Employee();
|
||||
model.sync();
|
||||
var collection = new EmployeeCollection;
|
||||
collection.sync();
|
||||
}
|
||||
}
|
||||
|
||||
namespace Model {
|
||||
function test_validationError() {
|
||||
var model = new Employee;
|
||||
if (model.validationError) {
|
||||
console.log('has validation errors');
|
||||
}
|
||||
}
|
||||
|
||||
function test_fetch() {
|
||||
var model = new Employee({ id: 1 });
|
||||
model.fetch({
|
||||
success: () => { },
|
||||
error: () => { }
|
||||
});
|
||||
}
|
||||
|
||||
function test_set() {
|
||||
var model = new Employee;
|
||||
model.set({ name: 'JoeDoe', age: 21 }, { validate: false });
|
||||
model.set('name', 'JoeDoes', { validate: false });
|
||||
}
|
||||
|
||||
function test_destroy() {
|
||||
var model = new Employee;
|
||||
model.destroy({
|
||||
wait: true,
|
||||
success: (m?, response?, options?) => { },
|
||||
error: (m?, jqxhr?, options?) => { }
|
||||
});
|
||||
|
||||
model.destroy({
|
||||
success: (m?, response?, options?) => { },
|
||||
error: (m?, jqxhr?) => { }
|
||||
});
|
||||
|
||||
model.destroy({
|
||||
success: () => { },
|
||||
error: (m?, jqxhr?) => { }
|
||||
});
|
||||
}
|
||||
|
||||
function test_save() {
|
||||
var model = new Employee;
|
||||
|
||||
model.save({
|
||||
name: 'Joe Doe',
|
||||
age: 21
|
||||
},
|
||||
{
|
||||
wait: true,
|
||||
validate: false,
|
||||
success: (m?, response?, options?) => { },
|
||||
error: (m?, jqxhr?, options?) => { }
|
||||
});
|
||||
|
||||
model.save({
|
||||
name: 'Joe Doe',
|
||||
age: 21
|
||||
},
|
||||
{
|
||||
success: () => { },
|
||||
error: (m?, jqxhr?) => { }
|
||||
});
|
||||
}
|
||||
|
||||
function test_validate() {
|
||||
var model = new Employee;
|
||||
|
||||
model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false })
|
||||
}
|
||||
}
|
||||
|
||||
namespace Collection {
|
||||
function test_fetch() {
|
||||
var collection = new EmployeeCollection;
|
||||
collection.fetch({ reset: true });
|
||||
}
|
||||
|
||||
function test_create() {
|
||||
var collection = new EmployeeCollection;
|
||||
var model = new Employee;
|
||||
|
||||
collection.create(model, {
|
||||
validate: false
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
namespace Router {
|
||||
function test_navigate() {
|
||||
var router = new Backbone.Router;
|
||||
|
||||
router.navigate('/employees', { trigger: true });
|
||||
router.navigate('/employees', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"backbone-tests.ts",
|
||||
"backbone-with-lodash-tests.ts"
|
||||
"backbone-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import bcryptjs = require("bcryptjs");
|
||||
let str: string;
|
||||
let num: number;
|
||||
let bool: boolean;
|
||||
let error: Error;
|
||||
|
||||
str = bcryptjs.genSaltSync();
|
||||
str = bcryptjs.genSaltSync(10);
|
||||
@@ -13,6 +14,12 @@ bcryptjs.genSalt((err: Error, salt: string) => {
|
||||
bcryptjs.genSalt(10, (err: Error, salt: string) => {
|
||||
str = salt;
|
||||
});
|
||||
bcryptjs.genSalt()
|
||||
.then(salt => str = salt)
|
||||
.catch(err => error = err);
|
||||
bcryptjs.genSalt(10)
|
||||
.then(salt => str = salt)
|
||||
.catch(err => error = err);
|
||||
|
||||
str = bcryptjs.hashSync("string");
|
||||
str = bcryptjs.hashSync("string", 10);
|
||||
@@ -26,6 +33,9 @@ bcryptjs.hash("string", 10, (err: Error, hash: string) => {
|
||||
}, (percent: number) => {
|
||||
num = percent;
|
||||
});
|
||||
bcryptjs.hash("string", 10)
|
||||
.then(salt => str = salt)
|
||||
.catch(err => error = err);
|
||||
|
||||
bcryptjs.hash("string", "salt", (err: Error, hash: string) => {
|
||||
str = hash;
|
||||
@@ -46,6 +56,9 @@ bcryptjs.compare("string1", "string2", (err: Error, success: boolean) => {
|
||||
}, (percent: number) => {
|
||||
num = percent;
|
||||
});
|
||||
bcryptjs.compare("string1", "string2")
|
||||
.then(success => bool = success)
|
||||
.catch(err => error = err);
|
||||
|
||||
num = bcryptjs.getRounds("string");
|
||||
|
||||
|
||||
Vendored
+28
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for bcryptjs v2.3.0
|
||||
// Type definitions for bcryptjs v2.4.0
|
||||
// Project: https://github.com/dcodeIO/bcrypt.js
|
||||
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>
|
||||
// Definitions by: Joshua Filby <https://github.com/Joshua-F/>, Rafael Kraut <https://github.com/RafaelKr/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -16,9 +16,17 @@ export declare function setRandomFallback(random: (random: number) => number[]):
|
||||
* Synchronously generates a salt.
|
||||
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
||||
* @return Resulting salt
|
||||
* @throws If a random fallback is required but not set
|
||||
*/
|
||||
export declare function genSaltSync(rounds?: number): string;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a salt.
|
||||
* @param rounds Number of rounds to use, defaults to 10 if omitted
|
||||
* @return Promise with resulting salt, if callback has been omitted
|
||||
*/
|
||||
export declare function genSalt(rounds?: number): Promise<string>;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a salt.
|
||||
* @param callback Callback receiving the error, if any, and the resulting salt
|
||||
@@ -40,6 +48,14 @@ export declare function genSalt(rounds: number, callback: (err: Error, salt: str
|
||||
*/
|
||||
export declare function hashSync(s: string, salt?: number | string): string;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a hash for the given string.
|
||||
* @param s String to hash
|
||||
* @param salt Salt length to generate or salt to use
|
||||
* @return Promise with resulting hash, if callback has been omitted
|
||||
*/
|
||||
export declare function hash(s: string, salt: number | string): Promise<string>;
|
||||
|
||||
/**
|
||||
* Asynchronously generates a hash for the given string.
|
||||
* @param s String to hash
|
||||
@@ -47,7 +63,7 @@ export declare function hashSync(s: string, salt?: number | string): string;
|
||||
* @param callback Callback receiving the error, if any, and the resulting hash
|
||||
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
||||
*/
|
||||
export declare function hash(s: string, salt: number | string, callback: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void;
|
||||
export declare function hash(s: string, salt: number | string, callback?: (err: Error, hash: string) => void, progressCallback?: (percent: number) => void): void;
|
||||
|
||||
/**
|
||||
* Synchronously tests a string against a hash.
|
||||
@@ -57,6 +73,14 @@ export declare function hash(s: string, salt: number | string, callback: (err: E
|
||||
*/
|
||||
export declare function compareSync(s: string, hash: string): boolean;
|
||||
|
||||
/**
|
||||
* Asynchronously compares the given data against the given hash.
|
||||
* @param s Data to compare
|
||||
* @param hash Data to be compared to
|
||||
* @return Promise, if callback has been omitted
|
||||
*/
|
||||
export declare function compare(s: string, hash: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Asynchronously compares the given data against the given hash.
|
||||
* @param s Data to compare
|
||||
@@ -64,7 +88,7 @@ export declare function compareSync(s: string, hash: string): boolean;
|
||||
* @param callback Callback receiving the error, if any, otherwise the result
|
||||
* @param progressCallback Callback successively called with the percentage of rounds completed (0.0 - 1.0), maximally once per MAX_EXECUTION_TIME = 100 ms.
|
||||
*/
|
||||
export declare function compare(s: string, hash: string, callback: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void;
|
||||
export declare function compare(s: string, hash: string, callback?: (err: Error, success: boolean) => void, progressCallback?: (percent: number) => void): void;
|
||||
|
||||
/**
|
||||
* Gets the number of rounds used to encrypt the specified hash.
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bounce-tests.ts"
|
||||
"bounce.js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
import Bowser = require('bowser');
|
||||
|
||||
Bowser.msedge === true;
|
||||
Bowser.test(['msie']) === true;
|
||||
Bowser.a === Bowser.c;
|
||||
Bowser.osversion > 10;
|
||||
Bowser.osversion === '10.1A';
|
||||
@@ -15,7 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bowser-module-tests.ts",
|
||||
"bowser-global-tests.ts"
|
||||
"bowser-tests.ts"
|
||||
]
|
||||
}
|
||||
+1
-1
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"box2dweb-tests.ts"
|
||||
"box2d-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
-1
@@ -62,7 +62,7 @@ declare namespace Chart {
|
||||
afterBody?: (item?: ChartTooltipItem[], data?: any) => void;
|
||||
beforeFooter?: (item?: ChartTooltipItem[], data?: any) => void;
|
||||
footer?: (item?: ChartTooltipItem[], data?: any) => void;
|
||||
afterfooter?: (item?: ChartTooltipItem[], data?: any) => void;
|
||||
afterFooter?: (item?: ChartTooltipItem[], data?: any) => void;
|
||||
}
|
||||
|
||||
export interface ChartAnimationParameter {
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chart-tests.ts"
|
||||
"chartjs-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -16,8 +16,8 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chrome-app.d.ts",
|
||||
"chrome-app-tests.ts",
|
||||
"chrome-cast.d.ts",
|
||||
"chrome-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/chrome-app.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
/// <reference path="cldr.js-event.d.ts" />
|
||||
|
||||
Cldr.on("get", (path, value) => {
|
||||
console.log(path);
|
||||
console.log(value);
|
||||
@@ -16,8 +16,8 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cldr.js-supplemental.d.ts",
|
||||
"cldr.js-tests.ts",
|
||||
"cldr.js-event-tests.ts",
|
||||
"cldr.js-supplemental-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/event.ts",
|
||||
"test/supplemental.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,14 +15,14 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"codemirror-tests.ts",
|
||||
"codemirror-matchbrackets.d.ts",
|
||||
"codemirror-matchbrackets-tests.ts",
|
||||
"codemirror-runmode.d.ts",
|
||||
"codemirror-runmode-tests.ts",
|
||||
"codemirror-showhint.d.ts",
|
||||
"codemirror-showhint-tests.ts",
|
||||
"searchcursor.d.ts",
|
||||
"searchcursor-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/matchbrackets.ts",
|
||||
"test/runmode.ts",
|
||||
"test/searchcursor.ts",
|
||||
"test/showhint.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import concat = require("concat-stream")
|
||||
|
||||
import { Readable } from "stream";
|
||||
|
||||
class MyReadable extends Readable {
|
||||
i: number = 1;
|
||||
_read() {
|
||||
if (this.i <= 100) {
|
||||
this.push(this.i.toString());
|
||||
this.i++;
|
||||
} else {
|
||||
this.push(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let myReadable = new MyReadable();
|
||||
|
||||
myReadable.pipe(concat((buf) => console.log(buf.toString())));
|
||||
myReadable.pipe(concat({}, (buf) => console.log(buf.toString())));
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for concat-stream 1.6
|
||||
// Project: https://github.com/maxogden/concat-stream
|
||||
// Definitions by: Joey Marianer <https://github.com/jmarianer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Writable } from "stream";
|
||||
|
||||
interface ConcatOpts {
|
||||
encoding?: string;
|
||||
}
|
||||
|
||||
declare function concat(cb: (buf: Buffer) => void): Writable;
|
||||
declare function concat(opts: ConcatOpts, cb: (buf: Buffer) => void): Writable;
|
||||
|
||||
export = concat;
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"concat-stream-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"CybozuLabs-md5-tests.ts"
|
||||
"cybozulabs-md5-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"date.format-tests.ts"
|
||||
"date.format.js-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"deployJava-tests.ts"
|
||||
"deployjava-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"docCookies-tests.ts"
|
||||
"doccookies-tests.ts"
|
||||
]
|
||||
}
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ declare namespace dragula {
|
||||
accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean;
|
||||
invalid?: (el?: Element, target?: Element) => boolean;
|
||||
direction?: string;
|
||||
copy?: boolean;
|
||||
copy?: ((el: Element, source: Element) => boolean) | boolean;
|
||||
revertOnSpill?: boolean;
|
||||
removeOnSpill?: boolean;
|
||||
delay?: boolean | number;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import stream = require("stream");
|
||||
import duplexer2 = require("duplexer2");
|
||||
|
||||
let writable = new stream.Writable({ objectMode: true }),
|
||||
readable = new stream.Readable({ objectMode: true });
|
||||
|
||||
writable.once("finish", () => {
|
||||
setTimeout(() => {
|
||||
readable.push(null);
|
||||
}, 500);
|
||||
});
|
||||
|
||||
let duplex = duplexer2(writable, readable);
|
||||
|
||||
duplex.on("data", (e: any) => {
|
||||
console.log("got data", JSON.stringify(e));
|
||||
});
|
||||
|
||||
duplex.on("finish", () => {
|
||||
console.log("got finish event");
|
||||
});
|
||||
|
||||
duplex.on("end", () => {
|
||||
console.log("got end event");
|
||||
});
|
||||
|
||||
duplex.write("oh, hi there", () => {
|
||||
console.log("finished writing");
|
||||
});
|
||||
|
||||
duplex.end("", () => {
|
||||
console.log("finished ending");
|
||||
});
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for duplexer2 0.1
|
||||
// Project: https://github.com/deoxxa/duplexer2
|
||||
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// Definition file started by dts-gen
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare function duplexer2(options: {bubbleErrors: boolean}, writable: NodeJS.WritableStream, readable: NodeJS.ReadableStream): NodeJS.ReadWriteStream;
|
||||
declare function duplexer2(writable: NodeJS.WritableStream, readable: NodeJS.ReadableStream): NodeJS.ReadWriteStream;
|
||||
|
||||
export = duplexer2;
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"duplexer2-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitThis": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -32,6 +32,11 @@ client.indices.delete({
|
||||
}, function (error) {
|
||||
});
|
||||
|
||||
client.create({
|
||||
index: 'index',
|
||||
type: 'type'
|
||||
});
|
||||
|
||||
client.create({
|
||||
id: '123',
|
||||
index: 'index',
|
||||
|
||||
Vendored
+1
-1
@@ -195,7 +195,7 @@ declare module Elasticsearch {
|
||||
version?: number;
|
||||
versionType?: VersionType;
|
||||
pipeline?: string;
|
||||
id: string;
|
||||
id?: string;
|
||||
index: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"electron-tests.ts",
|
||||
"github-electron-renderer-tests.ts",
|
||||
"github-electron-main-tests.ts"
|
||||
"test/index.ts",
|
||||
"test/main.ts",
|
||||
"test/renderer.ts"
|
||||
]
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
],
|
||||
"types": [],
|
||||
"paths": {
|
||||
"ember": ["ember/v0"]
|
||||
"ember": ["ember/v1"]
|
||||
},
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user