Merge: upstream/master into update/jest-each-templatize

This commit is contained in:
Stephen Niedzielski
2019-03-07 17:15:01 -07:00
491 changed files with 23754 additions and 3903 deletions
+248 -158
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -6,3 +6,7 @@ sudo: false
notifications:
email: false
script:
- npm run test
- if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate 1; fi
+42 -1
View File
@@ -240,6 +240,12 @@
"sourceRepoURL": "https://github.com/mapbox/cheap-ruler",
"asOfVersion": "2.5.0"
},
{
"libraryName": "chokidar",
"typingsPackageName": "chokidar",
"sourceRepoURL": "https://github.com/paulmillr/chokidar",
"asOfVersion": "2.1.3"
},
{
"libraryName": "chunked-dc",
"typingsPackageName": "chunked-dc",
@@ -414,6 +420,12 @@
"sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git",
"asOfVersion": "2.2.0"
},
{
"libraryName": "del",
"typingsPackageName": "del",
"sourceRepoURL": "https://github.com/sindresorhus/del",
"asOfVersion": "4.0.0"
},
{
"libraryName": "delay",
"typingsPackageName": "delay",
@@ -714,6 +726,12 @@
"sourceRepoURL": "https://github.com/ivogabe/gulp-typescript",
"asOfVersion": "2.13.0"
},
{
"libraryName": "handlebars",
"typingsPackageName": "handlebars",
"sourceRepoURL": "https://github.com/wycats/handlebars.js",
"asOfVersion": "4.1.0"
},
{
"libraryName": "handsontable",
"typingsPackageName": "handsontable",
@@ -1116,6 +1134,12 @@
"sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme",
"asOfVersion": "2.15.0"
},
{
"libraryName": "png-async",
"typingsPackageName": "png-async",
"sourceRepoURL": "https://github.com/kanreisa/node-png-async",
"asOfVersion": "0.9.4"
},
{
"libraryName": "node-waves",
"typingsPackageName": "node-waves",
@@ -1152,6 +1176,12 @@
"sourceRepoURL": "http://onsen.io",
"asOfVersion": "2.0.0"
},
{
"libraryName": "ora",
"typingsPackageName": "ora",
"sourceRepoURL": "https://github.com/sindresorhus/ora",
"asOfVersion": "3.2.0"
},
{
"libraryName": "p-event",
"typingsPackageName": "p-event",
@@ -1163,7 +1193,6 @@
"typingsPackageName": "p-limit",
"sourceRepoURL": "https://github.com/sindresorhus/p-limit",
"asOfVersion": "2.2.0"
},
{
"libraryName": "p-map",
@@ -1255,6 +1284,12 @@
"sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js",
"asOfVersion": "1.0.4"
},
{
"libraryName": "pkg-conf",
"typingsPackageName": "pkg-conf",
"sourceRepoURL": "https://github.com/sindresorhus/pkg-conf",
"asOfVersion": "3.0.0"
},
{
"libraryName": "plottable",
"typingsPackageName": "plottable",
@@ -1711,6 +1746,12 @@
"sourceRepoURL": "http://tabrisjs.com",
"asOfVersion": "1.8.0"
},
{
"libraryName": "tabris-plugin-firebase",
"typingsPackageName": "tabris-plugin-firebase",
"sourceRepoURL": "https://github.com/eclipsesource/tabris-plugin-firebase",
"asOfVersion": "2.1.0"
},
{
"libraryName": "tcomb",
"typingsPackageName": "tcomb",
+1
View File
@@ -17,6 +17,7 @@
"scripts": {
"compile-scripts": "tsc -p scripts",
"not-needed": "node scripts/not-needed.js",
"update-codeowners": "node scripts/update-codeowners.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed",
"lint": "dtslint types"
},
+4 -7
View File
@@ -1,13 +1,10 @@
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": true,
"baseUrl": "../types",
"typeRoots": [
"../types"
@@ -15,4 +12,4 @@
"types": [],
"forceConsistentCasingInFileNames": true
}
}
}
+126
View File
@@ -0,0 +1,126 @@
/// <reference lib="esnext.asynciterable" />
// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally
const cp = require("child_process");
const Octokit = require("@octokit/rest");
const { AllPackages, getDefinitelyTyped, loggerWithErrors,
parseDefinitions, parseNProcesses, clean } = require("types-publisher");
const { writeFile } = require("fs-extra");
async function main() {
const options = { definitelyTypedPath: ".", progress: false, parseInParallel: true };
const log = loggerWithErrors()[0];
clean();
const dt = await getDefinitelyTyped(options, log);
await parseDefinitions(dt, { nProcesses: parseNProcesses(), definitelyTypedPath: "." }, log);
const allPackages = await AllPackages.read(dt);
const typings = allPackages.allTypings();
const maxPathLen = Math.max(...typings.map(t => t.subDirectoryPath.length));
const entries = mapDefined(typings, t => getEntry(t, maxPathLen));
await writeFile([options.definitelyTypedPath, ".github", "CODEOWNERS"].join("/"), `${header}\n\n${entries.join("\n")}\n`, { encoding: "utf-8" });
}
const token = /** @type {string} */(process.env.GH_TOKEN);
const gh = new Octokit();
const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"]
const now = new Date();
const branchName = `codeowner-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`;
const remoteUrl = `https://${token}@github.com/DefinitelyTyped/DefinitelyTyped.git`;
runSequence([
["git", ["checkout", "."]], // reset any changes
]);
main().then(() => {
runSequence([
["git", ["checkout", "-b", branchName]], // create a branch
["git", ["add", ".github/CODEOWNERS"]], // Add CODEOWNERS
["git", ["commit", "-m", `"Update CODEOWNERS"`]], // Commit all changes
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
]);
gh.authenticate({
type: "token",
token,
});
return gh.pulls.create({
owner: "DefinitelyTyped",
repo: "DefinitelyTyped",
maintainer_can_modify: true,
title: `🤖 CODEOWNERS has changed`,
head: `DefinitelyTyped:${branchName}`,
base: "master",
body:
`Please review the diff and merge if no changes are unexpected.
cc ${reviewers.map(r => "@" + r).join(" ")}`,
})
}).then(r => {
const num = r.data.number;
console.log(`Pull request ${num} created.`);
return gh.pulls.createReviewRequest({
owner: "DefinitelyTyped",
repo: "DefinitelyTyped",
number: num,
reviewers,
});
}).then(() => {
console.log(`Reviewers requested, done.`);
}).catch(e => {
console.error(e);
process.exit(1);
});
/** @param {[string, string[]][]} tasks */
function runSequence(tasks) {
for (const task of tasks) {
console.log(`${task[0]} ${task[1].join(" ")}`);
const result = cp.spawnSync(task[0], task[1], { timeout: 100000, shell: true, stdio: "inherit" });
if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`);
}
}
/** @param {number} number */
function padNum(number) {
const str = "" + number;
return str.length >= 2 ? str : "0" + str;
}
const header =
`# This file is generated.
# Add yourself to the "Definitions by:" list instead.
# See https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package`;
/**
* @param { { contributors: ReadonlyArray<{githubUsername?: string }>, subDirectoryPath: string} } pkg
* @param {number} maxPathLen
* @return {string | undefined}
*/
function getEntry(pkg, maxPathLen) {
const users = mapDefined(pkg.contributors, c => c.githubUsername);
if (!users.length) {
return undefined;
}
const path = `${pkg.subDirectoryPath}/`.padEnd(maxPathLen);
return `/types/${path} ${users.map(u => `@${u}`).join(" ")}`;
}
/**
* @template T,U
* @param {ReadonlyArray<T>} arr
* @param {(t: T) => U | undefined} mapper
* @return U[]
*/
function mapDefined(arr, mapper) {
const out = [];
for (const a of arr) {
const res = mapper(a);
if (res !== undefined) {
out.push(res);
}
}
return out;
}
+16
View File
@@ -14,6 +14,14 @@ amqp.connect('amqp://localhost')
amqp.connect('amqp://localhost')
.then(connection => {
connection.serverProperties.copyright; // $ExpectType string | undefined
connection.serverProperties.platform; // $ExpectType string
connection.serverProperties.information; // $ExpectType string
connection.serverProperties.host; // $ExpectType string
connection.serverProperties.product; // $ExpectType string
connection.serverProperties.version; // $ExpectType string
connection.serverProperties.customField; // $ExpectType string | undefined
return connection.createChannel()
.tap(channel => channel.checkQueue('myQueue'))
.then(channel => {
@@ -37,6 +45,14 @@ import amqpcb = require('amqplib/callback_api');
amqpcb.connect('amqp://localhost', (err, connection) => {
if (!err) {
connection.serverProperties.copyright; // $ExpectType string | undefined
connection.serverProperties.platform; // $ExpectType string
connection.serverProperties.information; // $ExpectType string
connection.serverProperties.host; // $ExpectType string
connection.serverProperties.product; // $ExpectType string
connection.serverProperties.version; // $ExpectType string
connection.serverProperties.customField; // $ExpectType string | undefined
connection.createChannel((err, channel) => {
if (!err) {
channel.assertQueue('myQueue', {}, (err, ok) => {
+2 -1
View File
@@ -1,11 +1,12 @@
import events = require('events');
import { Replies, Options, Message } from './properties';
import { Replies, Options, Message, ServerProperties } from './properties';
export * from './properties';
export interface Connection extends events.EventEmitter {
close(callback?: (err: any) => void): void;
createChannel(callback: (err: any, channel: Channel) => void): void;
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
serverProperties: ServerProperties;
}
export interface Channel extends events.EventEmitter {
+2 -1
View File
@@ -8,13 +8,14 @@
import * as Promise from 'bluebird';
import * as events from 'events';
import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties';
import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties';
export * from './properties';
export interface Connection extends events.EventEmitter {
close(): Promise<void>;
createChannel(): Promise<Channel>;
createConfirmChannel(): Promise<ConfirmChannel>;
serverProperties: ServerProperties;
}
export interface Channel extends events.EventEmitter {
+10
View File
@@ -210,3 +210,13 @@ export interface XDeath {
"original-expiration"?: any;
"routing-keys": string[];
}
export interface ServerProperties {
host: string;
product: string;
version: string;
platform: string;
copyright?: string;
information: string;
[key: string]: string | undefined;
}
+10 -4
View File
@@ -1,4 +1,4 @@
import * as anime from 'animejs';
import anime from 'animejs';
const test1 = anime({
targets: 'div',
@@ -17,9 +17,9 @@ const test2 = anime({
},
translateY: '40px',
color: [
{value: '#FF0000', duration: 2000},
{value: '#00FF00', duration: 2000},
{value: '#0000FF', duration: 2000},
{ value: '#FF0000', duration: 2000 },
{ value: '#00FF00', duration: 2000 },
{ value: '#0000FF', duration: 2000 },
],
duration: () => {
return 1000000000000;
@@ -69,3 +69,9 @@ const bezier = anime.bezier(0, 0, 100, 100);
anime.easings['hello'] = anime.bezier(0, 0, 1900, 3020);
const runningAnims = anime.running;
anime.remove(".tiny-divvy-div");
anime.timeline().add({
targets: [],
duration: 1000,
easing: "linear",
}, 0);
+3 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for animejs 2.0
// Project: http://animejs.com
// Definitions by: Andrew Babin <https://github.com/A-Babin>
// Definitions by: Andrew Babin <https://github.com/A-Babin>
// supaiku0 <https://github.com/supaiku0>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -110,7 +111,7 @@ declare namespace anime {
}
interface AnimeTimelineInstance extends AnimeInstance {
add(params: AnimeAnimParams): AnimeTimelineInstance;
add(params: AnimeAnimParams, timelineOffset?: string | number): AnimeTimelineInstance;
}
// Helpers
+1
View File
@@ -14,6 +14,7 @@
"../"
],
"types": [],
"allowSyntheticDefaultImports": true,
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
+4 -4
View File
@@ -19,10 +19,10 @@ declare namespace Ansi {
interface AnsiEscapes {
cursorTo(x: number, y?: number): string;
cursorMove(x: number, y?: number): string;
cursorUp(count: number): string;
cursorDown(count: number): string;
cursorForward(count: number): string;
cursorBackward(count: number): string;
cursorUp(count?: number): string;
cursorDown(count?: number): string;
cursorForward(count?: number): string;
cursorBackward(count?: number): string;
cursorLeft: string;
cursorSavePosition: string;
+3 -2
View File
@@ -27,6 +27,7 @@
// Erik Dalén <https://github.com/dalen>
// Loïk Gaonac'h <https://github.com/loikg>
// Roberto Zen <https://github.com/skyzenr>
// Richard Cornelissen <https://github.com/richardcornelissen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -536,10 +537,10 @@ export type StatementResource = MaybeStatementPrincipal & ({ Resource: string |
export type StatementPrincipal = MaybeStatementResource & ({ Principal: PrincipalValue } | { NotPrincipal: PrincipalValue });
/**
* API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement.
* http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output
* https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html
*/
export interface AuthResponseContext {
[name: string]: any;
[name: string]: boolean | number | string;
}
/**
@@ -20,6 +20,10 @@ keyPair3.toWIF();
bitcoin.payments.p2pkh({ pubkey: keyPair3.publicKey });
const network = keyPair3.network;
const keyPair4 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.regtest, rng});
keyPair4.toWIF();
bitcoin.payments.p2pkh({ pubkey: keyPair4.publicKey });
// Test TransactionBuilder and Transaction
const txb = new bitcoin.TransactionBuilder();
txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
+1
View File
@@ -191,6 +191,7 @@ export class TransactionBuilder {
export const networks: {
bitcoin: Network;
testnet: Network;
regtest: Network;
};
export const opcodes: {
@@ -46,4 +46,21 @@ $.notify({
'</div>' +
'<a href="{3}" target="{4}" data-notify="url"></a>' +
'</div>'
});
});
const notifyResult = $.notify({
message: 'Callbacks have the popup element as an argument',
},{
onShow: function($ele) {
notifyResult.$ele === $ele;
},
onShown: function($ele) {
notifyResult.$ele === $ele;
},
onClose: function($ele) {
notifyResult.$ele === $ele;
},
onClosed: function($ele) {
notifyResult.$ele === $ele;
},
});
+5 -5
View File
@@ -48,16 +48,16 @@ interface NotifySettings {
enter?: string;
exit?: string;
};
onShow?: () => void;
onShown?: () => void;
onClose?: () => void;
onClosed?: () => void;
onShow?: ($ele: JQuery) => void;
onShown?: ($ele: JQuery) => void;
onClose?: ($ele: JQuery) => void;
onClosed?: ($ele: JQuery) => void;
icon_type?: string;
template?: string;
}
interface NotifyReturn {
$ele: JQueryStatic;
$ele: JQuery;
close: () => void;
update: (command: string, update: any) => void;
}
+1
View File
@@ -25,6 +25,7 @@ declare namespace BPMNModdle {
interface TypeDerived {
$type: ElementType;
$parent: TypeDerived;
}
interface BaseElement extends TypeDerived {
/**
-1
View File
@@ -7,7 +7,6 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="chokidar"/>
/// <reference types="node" />
/// <reference types="serve-static" />
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"chokidar": "^2.1.2"
}
}
+74
View File
@@ -0,0 +1,74 @@
import cassanknex = require('cassanknex');
const knex = cassanknex({
connection: {
contactPoints: ['127.0.0.1']
}
});
knex.on('ready', (err) => {
});
interface BirdRow {
type: string;
canFly: boolean;
}
const qb = knex("animals")
.insert<BirdRow>({
type: 'Stork',
canFly: true
})
.into('birds');
qb.exec((err, res) => {
});
qb.eachRow((n, row) => {
}, (err) => {
});
interface FooRow {
id: string;
foo: string;
bar: number;
baz: string[];
}
const query2 = knex("keyspace")
.select<FooRow>("id", "foo", "bar", "baz")
.ttl('foo')
.where("id", "=", "1")
.orWhere("id", "in", ["2", "3"])
.orWhere("baz", "=", ["bar"])
.andWhere("foo", "IN", ["baz", "bar"])
.limit(10)
.from("table");
query2.stream({
readable() {
const row = this.read();
},
end() {},
error() {}
});
const values = {
id: "foo",
bar: 13,
baz: ["foo", "bar"]
};
const query3 = knex("cassanKnexy")
.insert<FooRow>(values)
.usingTimestamp(250000)
.usingTTL(50000)
.into("columnFamily");
const [cql, params] = [query3.cql(), query3.bindings()];
const query4 = knex("cassanKnexy")
.update("columnFamily")
.add("bar", { foo: "baz" }) // "bar" is a map
.remove("foo", ["bar"]) // "foo" is a set
.where("id", "=", 1);
+204
View File
@@ -0,0 +1,204 @@
// Type definitions for cassanknex 1.19
// Project: https://github.com/azuqua/cassanknex
// Definitions by: Daniel Chao <https://github.com/bioball>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="node" />
import { EventEmitter } from "events";
import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver";
import * as Long from "long";
import { Readable } from "stream";
declare function CassanKnex(options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex;
export = CassanKnex;
declare namespace CassanKnex {
interface DriverOptions {
debug?: boolean;
connection?: Client | ClientOptions;
}
/**
* Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`.
*/
type TypeMatchedValue<T, K extends keyof T, Type, This> = T[K] extends Type ? This : never;
interface MappedDict<B> {
[key: string]: B;
}
type InRestriction = 'in' | 'IN';
type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>=';
type SelectAsClause<T> = {
[P in keyof T]: string;
};
interface CassanKnex extends EventEmitter {
(keyspace?: string): QueryBuilderRoot;
}
interface StreamParams {
readable: (this: Readable) => any;
end: (this: Readable) => any;
error: (err: Error) => any;
}
interface QueryBuilderRoot {
insert <T = any>(values: Partial<T> | T): InsertQueryBuilder;
select <T = any>(...columns: Array<keyof T>): SelectQueryBuilder<T>;
select <T = any>(values: SelectAsClause<T>): SelectQueryBuilder<T>;
update <T = any>(table: string): UpdateQueryBuilder<T>;
delete <T = any>(): DeleteQueryBuilder<T>;
alterColumnFamily <T = any>(columnFamily: string): AlterColumnFamilyQueryBuilder<T>;
createColumnFamily <T = any>(columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createColumnFamilyIfNotExists <T = any>(columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createIndex <T = any>(columnFamily: string, indexName: string, column: keyof T): QueryBuilder;
createIndexCustom <T = any>(columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder;
createType <T = any>(typeName: string): CreateTypeQueryBuilder<T>;
createTypeIfNotExists <T = any>(typeName: string): CreateTypeQueryBuilder<T>;
dropColumnFamily(columnFamily: string): QueryBuilder;
dropColumnFamilyIfExists(columnFamily: string): QueryBuilder;
dropType(): QueryBuilder;
dropTypeIfExists(): QueryBuilder;
truncate(columnFamily: string): QueryBuilder;
alterKeyspace(keyspace: string): KeyspaceQueryBuilder;
createKeyspace(keyspace: string): KeyspaceQueryBuilder;
createKeyspaceIfNotExists(keyspace: string): KeyspaceQueryBuilder;
dropKeyspace(): QueryBuilder;
dropKeyspaceIfExists(): QueryBuilder;
}
interface QueryBuilder {
cql(): string;
bindings(): any[];
exec(cb: ResultCallback): undefined;
eachRow(onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined;
stream(params: StreamParams): undefined;
}
interface FieldValueQueryBuilder<T> {
decimal <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.BigDecimal, this>;
boolean <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, boolean, this>;
blob <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Buffer, this>;
timestamp <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Date, this>;
date <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.LocalDate, this>;
inet <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.InetAddress, this>;
bigint <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
counter <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
double <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
int <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, number, this>;
float <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, number, this>;
map <K extends keyof T, A extends string, B>(columnName: K, a: A, b: B): TypeMatchedValue<T, K, Map<A, B>, this>;
ascii <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
text <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
timeuuid <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.TimeUuid, this>;
uuid <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.Uuid, this>;
varchar <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
list <K extends keyof T>(columnName: K, typeName: string): TypeMatchedValue<T, K, any[], this>;
primary(primaryKey: string): this;
set <K extends keyof T, A extends string>(columnName: K, a: A): TypeMatchedValue<T, K, Set<T[K]>, this>;
}
interface CreateableColumnFamilyBuilder<T> {
withCaching(): this;
withCompression(): this;
withCompaction(): this;
withClusteringOrderBy <K extends keyof T>(value: K, direction: 'desc' | 'asc'): this;
}
interface CreateableIndexBuilder {
withOptions(opts: MappedDict<string>): this;
}
interface KeyspaceableQueryBuilder {
withNetworkTopologyStrategy(strategy: MappedDict<number>): this;
withSimpleStrategy(replicas: number): this;
withDurableWrites(durableWrites: boolean): this;
}
interface InsertableQueryBuilder {
into(table: string): this;
ifNotExists(): this;
}
interface TtlableQueryBuilder {
usingTimestamp(timestamp: number): this;
usingTTL(ttl: number): this;
}
interface WhereableQueryBuilder<T> {
where <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
where <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
orWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
orWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
andWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
andWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
tokenWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
tokenWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
ttl <K extends keyof T>(columnName: K): this;
}
interface IfableQueryBuilder<T> {
if <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this;
}
interface LimitableQueryBuilder {
limit(limit: number): this;
limitPerPartition(limit: number): this;
}
interface FromableQueryBuilder {
from(table: string): this;
}
interface UpdateableQueryBuilder<T> {
set <K extends keyof T>(key: K, value: T[K]): this;
set(object: Partial<T>): this;
add <K extends keyof T>(key: K, value: { [str: string]: T[K] }): TypeMatchedValue<T, K, Map<string, T[K]>, this>;
add <K extends keyof T>(key: K, value: Array<T[K]>): TypeMatchedValue<T, K, any[] | Set<any>, this>;
add(object: Partial<T>): this;
remove <K extends keyof T>(key: K, value: Array<T[K]>): this;
remove(object: Partial<T>): this;
increment(column: keyof T, amount: number): this;
increment(object: Partial<T>): this;
decrement(column: keyof T, amount: number): this;
decrement(object: Partial<T>): this;
}
interface AlterableQueryBuilder<T> {
drop <K extends keyof T>(...columns: K[]): this;
rename <K extends keyof T>(column: K, newColumn: K): this;
alter <K extends keyof T>(column: K, newType: string): this;
}
type InsertQueryBuilder = QueryBuilder
& InsertableQueryBuilder
& TtlableQueryBuilder;
type SelectQueryBuilder<T> = QueryBuilder
& WhereableQueryBuilder<T>
& LimitableQueryBuilder
& FromableQueryBuilder;
type UpdateQueryBuilder<T> = QueryBuilder
& WhereableQueryBuilder<T>
& UpdateableQueryBuilder<T>
& IfableQueryBuilder<T>
& TtlableQueryBuilder;
type DeleteQueryBuilder<T> = QueryBuilder
& WhereableQueryBuilder<T>
& FromableQueryBuilder;
type CreateColumnFamilyQueryBuilder<T> = QueryBuilder
& FieldValueQueryBuilder<T>
& CreateableColumnFamilyBuilder<T>;
type KeyspaceQueryBuilder = QueryBuilder
& KeyspaceableQueryBuilder;
type CreateTypeQueryBuilder<T> = QueryBuilder
& FieldValueQueryBuilder<T>;
type AlterColumnFamilyQueryBuilder<T> = QueryBuilder
& AlterableQueryBuilder<T>
& FieldValueQueryBuilder<T>;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cassanknex-tests.ts"
]
}
+7
View File
@@ -0,0 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false,
"strict-export-declare-modifiers": false
}
}
+11 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for cesium 1.47
// Type definitions for cesium 1.54
// Project: http://cesiumjs.org
// Definitions by: Aigars Zeiza <https://github.com/Zuzon>
// Harry Nicholls <https://github.com/hnipps>
@@ -1393,7 +1393,7 @@ declare namespace Cesium {
class ScreenSpaceEventHandler {
constructor(element?: HTMLCanvasElement);
setInputAction(action: () => void, type: number, modifier?: number): void;
setInputAction(action: (click: { position: Cartesian2 }) => void, type: number, modifier?: number): void;
getInputAction(type: number, modifier?: number): () => void;
removeInputAction(type: number, modifier?: number): void;
isDestroyed(): boolean;
@@ -3134,6 +3134,15 @@ declare namespace Cesium {
static clone(hpr: HeadingPitchRange, result?: HeadingPitchRange): HeadingPitchRange;
}
// tslint:disable-next-line:no-unnecessary-class
class Cesium3DTileset {
constructor(Cesium3DTilesetItem: {
url: string;
maximumScreenSpaceError: number;
maximumNumberOfLoadedTiles: number;
})
}
class ImageryLayer {
alpha: number;
brightness: number;
+2 -2
View File
@@ -1,5 +1,5 @@
// Type definitions for Chart.js 2.7
// Project: https://github.com/nnnick/Chart.js, http://www.chartjs.org
// Project: https://github.com/nnnick/Chart.js, https://www.chartjs.org
// Definitions by: Alberto Nuti <https://github.com/anuti>
// Fabien Lavocat <https://github.com/FabienLavocat>
// KentarouTakeda <https://github.com/KentarouTakeda>
@@ -357,7 +357,7 @@ declare namespace Chart {
cornerRadius?: number;
multiKeyBackground?: string;
callbacks?: ChartTooltipCallback;
filter?(item: ChartTooltipItem): boolean;
filter?(item: ChartTooltipItem, data: ChartData): boolean;
itemSort?(itemA: ChartTooltipItem, itemB: ChartTooltipItem): number;
position?: string;
caretPadding?: number;
+2
View File
@@ -24,6 +24,8 @@ if ($fromElement("ul > li").length !== 3) {
throw new Error("Expecting 3 elements when passing `CheerioElement` to `load()`");
}
$ = cheerio.load(Buffer.from(html));
$ = cheerio.load(html, {
normalizeWhitespace: true,
xmlMode: true
+4 -2
View File
@@ -1,8 +1,10 @@
// Type definitions for Cheerio v0.22.0
// Project: https://github.com/cheeriojs/cheerio
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>, Ryo Ota <https://github.com/nwtgck>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
interface Cheerio {
// Document References
// Cheerio https://github.com/cheeriojs/cheerio
@@ -266,7 +268,7 @@ interface CheerioElement {
}
interface CheerioAPI extends CheerioSelector, CheerioStatic {
load(html: string, options?: CheerioOptionsInterface): CheerioStatic;
load(html: string | Buffer, options?: CheerioOptionsInterface): CheerioStatic;
load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic;
}
-57
View File
@@ -1,57 +0,0 @@
import * as fs from 'fs';
import chokidar = require('chokidar');
const watcher = chokidar.watch('file, dir, or glob', {
ignored: /[\/\\]\./, persistent: true
});
const log = console.log.bind(console);
watcher
.on('add', (path: string) => {
log('File', path, 'has been added');
})
.on('addDir', (path: string) => {
log('Directory', path, 'has been added');
})
.on('change', (path: string) => {
log('File', path, 'has been changed');
})
.on('unlink', (path: string) => {
log('File', path, 'has been removed');
})
.on('unlinkDir', (path: string) => {
log('Directory', path, 'has been removed');
})
.on('error', (error: any) => {
log('Error happened', error);
})
.on('ready', () => {
log('Initial scan complete. Ready for changes.');
})
.on('raw', (event: string, path: string, details: any) => {
log('Raw event info:', event, path, details);
});
// 'add', 'addDir' and 'change' events also receive stat() results as second
// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats
watcher.on('change', (path: string, stats: fs.Stats) => {
if (stats) {
console.log('File', path, 'changed size to', stats.size);
}
});
// Watch new files.
watcher.add('new-file');
watcher.add(['new-file-2', 'new-file-3', '**/other-file*']);
// Un-watch some files.
watcher.unwatch('new-file*');
// Only needed if watching is `persistent: true`.
watcher.close();
// One-liner
chokidar.watch('.', { ignored: /[\/\\]\./ }).on('all', (event: string, path: string) => {
console.log(event, path);
});
-170
View File
@@ -1,170 +0,0 @@
// Type definitions for chokidar 1.7
// Project: https://github.com/paulmillr/chokidar
// Definitions by: Stefan Steinhart <https://github.com/reppners>
// Felix Becker <https://github.com/felixfbecker>
// Zach Cardoza <https://github.com/bayssmekanique>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as fs from 'fs';
import { EventEmitter } from 'events';
/**
* The object's keys are all the directories (using absolute paths unless the `cwd` option was
* used), and the values are arrays of the names of the items contained in each directory.
*/
export interface WatchedPaths {
[directory: string]: string[];
}
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
/**
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
constructor(options?: WatchOptions);
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | string[]): void;
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | string[]): void;
/**
* Returns an object representing all the paths on the file system being watched by this
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
* the `cwd` option was used), and the values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): WatchedPaths;
/**
* Removes all listeners from watched files.
*/
close(): void;
}
export interface WatchOptions {
/**
* Indicates whether the process should continue to run as long as files are being watched. If
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
* even if the process continues to run.
*/
persistent?: boolean;
/**
* ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
* with two arguments is provided, it gets called twice per path - once with a single argument
* (the path), second time with two arguments (the path and the
* [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
*/
ignored?: any;
/**
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
*/
ignoreInitial?: boolean;
/**
* When `false`, only the symlinks themselves will be watched for changes instead of following
* the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
* be relative to this.
*/
cwd?: string;
/**
* If set to true then the strings passed to .watch() and .add() are treated as literal path
* names, even if they look like globs. Default: false.
*/
disableGlobbing?: boolean;
/**
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
* utilization, consider setting this to `false`. It is typically necessary to **set this to
* `true` to successfully watch files over a network**, and it may be necessary to successfully
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
* the `useFsEvents` default.
*/
usePolling?: boolean;
/**
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
* OS X, `usePolling: true` becomes the default.
*/
useFsEvents?: boolean;
/**
* If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
* provided even in cases where it wasn't already available from the underlying watch events.
*/
alwaysStat?: boolean;
/**
* If set, limits how many levels of subdirectories will be traversed.
*/
depth?: number;
/**
* Interval of file system polling.
*/
interval?: number;
/**
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
*/
binaryInterval?: number;
/**
* Indicates whether to watch files that don't have read permissions if possible. If watching
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
* silently.
*/
ignorePermissionErrors?: boolean;
/**
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
* that occur when using editors that use "atomic writes" instead of writing directly to the
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
* you can override it by setting `atomic` to a custom value, in milliseconds.
*/
atomic?: boolean | number;
/**
* can be set to an object in order to adjust timing params:
*/
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
}
export interface AwaitWriteFinishOptions {
/**
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
*/
stabilityThreshold?: number;
/**
* File size polling interval.
*/
pollInterval?: number;
}
/**
* produces an instance of `FSWatcher`.
*/
export function watch(paths: string | string[], options?: WatchOptions): FSWatcher;
+17
View File
@@ -0,0 +1,17 @@
import CipherBase = require("cipher-base");
const buf = new Buffer(1);
class CipherTest extends CipherBase {
constructor() {
super();
}
final() {
return buf;
}
update(testBuffer: Buffer) {
return testBuffer;
}
}
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for cipher-base 1.0
// Project: https://github.com/crypto-browserify/cipher-base
// Definitions by: Adam Zerella <https://github.com/adamzerella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare abstract class CipherBase {
constructor(hashMode?: string);
abstract final(): Buffer;
abstract update(value: Buffer, inputEnc?: string, outputEnc?: string): Buffer;
}
export = CipherBase;
+25
View File
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [
],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cipher-base-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+9
View File
@@ -70,6 +70,15 @@ export interface Configuration {
* CometD may fail to remain within the max URI length when encoded in JSON.
*/
maxURILength?: number;
/**
* Uses the scheduler service available in Web Workers via Worker.setTimeout(fn, delay) rather
* than using that available via Window.setTimeout(fn, delay). Browsers are now throttling the
* Window scheduler in background tabs to save battery in mobile devices, so the Window scheduler
* events are delayed by possibly several seconds, causing CometD sessions to timeout on the
* server. The Worker scheduler is not throttled and guarantees that scheduler events happen
* on time.
*/
useWorkerScheduler?: boolean;
}
export interface Message {
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for connect-datadog 0.0
// Project: https://github.com/datadog/node-connect-datadog
// Definitions by: Moshe Good <https://github.com/moshegood>
// Michael Mifsud <https://github.com/xzyfer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -19,6 +20,6 @@ declare namespace Factory {
method?: boolean;
protocol?: boolean;
response_code?: boolean;
dogstatsd?: dogstatsd.StatsD;
dogstatsd?: dogstatsd.StatsDClient;
}
}
+2 -2
View File
@@ -45,8 +45,8 @@ app.use(session({
// NativeMongoPromiseOptions
var Client = mongodb.MongoClient;
var mongoDbPromise = Client.connect('mongodb://localhost/test');
var mongoDbPromise = Client.connect('mongodb://localhost/test').then(client => client.db())
app.use(session({
secret: 'secret',
store: new MongoStore({ dbPromise: mongoDbPromise})
store: new MongoStore({ dbPromise: mongoDbPromise })
}));
-8
View File
@@ -4,14 +4,6 @@
"lib": [
"es6"
],
"paths": {
"mongodb": [
"mongodb/v2"
],
"mongoose": [
"mongoose/v4"
]
},
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
+3
View File
@@ -27,8 +27,11 @@ d3.layout.cloud().size([300, 300])
.font("Impact")
.fontSize(function(d:ICompTextSize) { return d.size; })
.on("end", draw)
.random()
.canvas()
.start();
function draw(words:ICompTextSize[]) {
d3.select("body").append("svg")
.attr("width", 300)
+20 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.2
// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.5
// Project: https://github.com/jasondavies/d3-cloud
// Definitions by: hans windhoff <https://github.com/hansrwindhoff>
// Definitions by: hans windhoff <https://github.com/hansrwindhoff>, locknono <https://github.com/locknono>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as d3 from 'd3';
@@ -71,6 +71,24 @@ declare module 'd3' {
padding(padding: number): Cloud<T>;
padding(padding: (datum: T, index: number) => number): Cloud<T>;
/**
* If specified, sets the internal random number generator,used for selecting the initial position of each word,
* and the clockwise/counterclockwise direction of the spiral for each word.
*
* @param randomFunction should return a number in the range [0, 1).The default is Math.random.
*/
random(): Cloud<T>;
random(randomFunction: () => number): Cloud<T>;
/**
* If specified, sets the canvas generator function, which is used internally to draw text.
* When using Node.js, you will almost definitely override the default, e.g. using the canvas module.
* @param canvasGenerator should return a HTMLCanvasElement.The default is: ()=>{document.createElement("canvas");}
*
*/
canvas():Cloud<T>;
canvas(canvasGenerator: () => HTMLCanvasElement): Cloud<T>;
on(type: "word", listener: (word: T) => void): Cloud<T>;
on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud<T>;
on(type: string, listener: (...args: any[]) => void): Cloud<T>;
@@ -0,0 +1,43 @@
import datadog = require('node-dogstatsd');
import Collector = require('datadog-statsd-metrics-collector');
const client = new datadog.StatsD('localhost');
// constructors
let collector = new Collector(client);
collector = new Collector(client, 1000);
// interface
const key = 'key';
const timeValue = 99;
const sampleRate = 0.85;
const incrementBy = 7;
const decrementBy = 5;
const gaugeValue = 199;
const tags: string[] = ['tag1', 'tag2'];
collector.timing(key, timeValue);
collector.timing(key, timeValue, sampleRate);
collector.timing(key, timeValue, sampleRate, tags);
collector.increment(key);
collector.increment(key, sampleRate);
collector.increment(key, sampleRate, tags);
collector.incrementBy(key, incrementBy);
collector.incrementBy(key, incrementBy, tags);
collector.decrement(key);
collector.decrement(key, sampleRate);
collector.decrement(key, sampleRate, tags);
collector.decrementBy(key, decrementBy);
collector.decrementBy(key, decrementBy, tags);
collector.gauge(key, gaugeValue);
collector.gauge(key, gaugeValue, sampleRate);
collector.gauge(key, gaugeValue, sampleRate, tags);
collector.histogram(key, timeValue);
collector.histogram(key, timeValue, sampleRate);
collector.histogram(key, timeValue, sampleRate, tags);
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for datadog-statsd-metrics-collector 1.1
// Project: https://github.com/xzyfer/datadog-statsd-metrics-collector#readme
// Definitions by: Michael Mifsud <https://github.com/xzyfer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import dogstatsd = require('node-dogstatsd');
declare class Collector implements dogstatsd.StatsDClient {
constructor(client: dogstatsd.StatsDClient, delayMilliseconds?: number);
timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void;
increment(stat: string, sample_rate?: number, tags?: string[]): void;
incrementBy(stat: string, value: number, tags?: string[]): void;
decrement(stat: string, sample_rate?: number, tags?: string[]): void;
decrementBy(stat: string, value: number, tags?: string[]): void;
gauge(stat: string, value: number, sample_rate?: number, tags?: string[]): void;
histogram(stat: string, time: number, sample_rate?: number, tags?: string[]): void;
}
export = Collector;
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datadog-statsd-metrics-collector-tests.ts"
]
}
-47
View File
@@ -1,47 +0,0 @@
import del = require('del');
let paths = ['build', 'dist/**/*.js'];
del(['tmp/*.js', '!tmp/unicorn.js']);
del(['tmp/*.js', '!tmp/unicorn.js'], { force: true });
del(['tmp/*.js', '!tmp/unicorn.js'], { dryRun: true });
del(['tmp/*.js', '!tmp/unicorn.js'], { concurrency: 20 });
del(['tmp/*.js', '!tmp/unicorn.js'], { cwd: '' });
del(['tmp/*.js', '!tmp/unicorn.js']).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del(['tmp/*.js', '!tmp/unicorn.js'], { force: true }).then(
(paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
}
);
del('tmp/*.js');
del('tmp/*.js', { force: true });
del('tmp/*.js', { dryRun: true });
del('tmp/*.js', { concurrency: 20 });
del('tmp/*.js', { cwd: '' });
del('tmp/*.js').then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del('tmp/*.js', { force: true }).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
paths = del.sync(['tmp/*.js', '!tmp/unicorn.js']);
paths = del.sync(['tmp/*.js', '!tmp/unicorn.js'], { force: true });
paths = del.sync('tmp/*.js');
paths = del.sync('tmp/*.js', { force: true });
paths = del.sync('tmp/*.js', { dryRun: true });
paths = del.sync('tmp/*.js', { concurrency: 20 });
paths = del.sync('tmp/*.js', { cwd: '' });
const immutable: ReadonlyArray<string> = ['tmp/*.js', '!tmp/unicorn.js'];
const mutable = del(immutable);
const mutablePaths = del.sync(immutable);
mutable.then(paths => paths.push('test'));
mutablePaths.push('test');
-29
View File
@@ -1,29 +0,0 @@
// Type definitions for del 3.0
// Project: https://github.com/sindresorhus/del
// Definitions by: Asana <https://asana.com>
// Aya Morisawa <https://github.com/AyaMorisawa>
// BendingBender <https://github.com/BendingBender>
// Jason Dreyzehner <https://github.com/bitjson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import glob = require('glob');
declare function del(
patterns: string | ReadonlyArray<string>,
options?: del.Options
): Promise<string[]>;
declare namespace del {
function sync(
patterns: string | ReadonlyArray<string>,
options?: Options
): string[];
interface Options extends glob.IOptions {
force?: boolean;
dryRun?: boolean;
concurrency?: number;
}
}
export = del;
-37
View File
@@ -1,37 +0,0 @@
import del = require("del");
let paths = ["build", "dist/**/*.js"];
del(["tmp/*.js", "!tmp/unicorn.js"]);
del(["tmp/*.js", "!tmp/unicorn.js"], {force: true});
del(["tmp/*.js", "!tmp/unicorn.js"]).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del(["tmp/*.js", "!tmp/unicorn.js"], {force: true}).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del("tmp/*.js");
del("tmp/*.js", {force: true});
del("tmp/*.js").then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
del("tmp/*.js", {force: true}).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"]);
paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true});
paths = del.sync("tmp/*.js");
paths = del.sync("tmp/*.js", {force: true});
paths = del.sync("tmp/*.js", {dryRun: true});
-19
View File
@@ -1,19 +0,0 @@
// Type definitions for del 2.2
// Project: https://github.com/sindresorhus/del
// Definitions by: Asana <https://asana.com>, Aya Morisawa <https://github.com/AyaMorisawa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import glob = require("glob");
declare function del(patterns: string | string[], options?: del.Options): Promise<string[]>;
declare namespace del {
function sync(patterns: string | string[], options?: Options): string[];
interface Options extends glob.IOptions {
force?: boolean;
dryRun?: boolean;
}
}
export = del;
-28
View File
@@ -1,28 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"del": [
"del/v2"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"del-tests.ts"
]
}
-6
View File
@@ -1,6 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
"dt-header": false
}
}
+12 -6
View File
@@ -42,6 +42,16 @@ declare global {
*/
cleanup(): Promise<void>;
}
// Detox exports all methods from detox global and all of the global constants.
interface DetoxExport extends Detox {
device: Device;
element: Element;
waitFor: WaitFor;
expect: Expect<Expect<any>>;
by: Matchers;
}
interface Device {
/**
* Launch the app
@@ -434,10 +444,6 @@ declare global {
}
}
export { by, detox, device, element, waitFor };
declare const detoxExport: Detox.DetoxExport;
// Not exporting the global `expect` from the top of the file here
// because `expect` conflicts with the global `expect` of jest and
// therefore exporting it doesn't work. The global `expect` is kept
// for backwards compatibility though.
export const expect: Detox.Expect<Detox.Expect<any>>;
export = detoxExport;
+1 -1
View File
@@ -9,4 +9,4 @@ interface DetoxJestAdapter {
declare const adapter: DetoxJestAdapter;
export default adapter;
export = adapter;
+1 -1
View File
@@ -6,4 +6,4 @@ interface DetoxMochaAdapter {
declare const adapter: DetoxMochaAdapter;
export default adapter;
export = adapter;
+2 -1
View File
@@ -2,7 +2,8 @@ declare var beforeAll: (callback: () => void) => void;
declare var beforeEach: (callback: () => void) => void;
declare var afterAll: (callback: () => void) => void;
import adapter from "detox/runners/jest/adapter";
import detox = require("detox");
import adapter = require("detox/runners/jest/adapter");
// Normally the Detox configuration from the project's package.json like so:
// const config = require("./package.json").detox;
+2 -1
View File
@@ -5,7 +5,8 @@ declare var beforeEach: (callback: () => void) => void;
declare var after: (callback: () => void) => void;
declare var afterEach: (callback: () => void) => void;
import adapter from "detox/runners/mocha/adapter";
import * as detox from "detox";
import * as adapter from "detox/runners/mocha/adapter";
// Normally the Detox configuration from the project's package.json like so:
// const config = require("./package.json").detox;
+1 -1
View File
@@ -623,7 +623,7 @@ declare namespace Draft {
interface DraftBlockRenderConfig {
element: string;
wrapper?: React.ReactElement;
wrapper?: React.ReactNode;
}
class EditorState extends Record {
+18
View File
@@ -0,0 +1,18 @@
import dv = require('dv');
import fs = require('fs');
const image = new dv.Image('png', fs.readFileSync('textpage300.png'));
const tesseract = new dv.Tesseract('eng', image);
console.log(tesseract.findText('plain'));
const barcodes = new dv.Image('png', fs.readFileSync('form2.png'));
const open = barcodes.thin('bg', 8, 5).dilate(3, 3);
const openMap = open.distanceFunction(8);
const openMask = openMap.threshold(10).erode(22, 22);
const boxes = openMask.invert().connectedComponents(8);
boxes.forEach((box) => {
const boxImage = barcodes.crop(
// Do something useful with our image.
box.x, box.y,
box.width, box.height);
});
+477
View File
@@ -0,0 +1,477 @@
// Type definitions for dv 2.1
// Project: https://github.com/creatale/node-dv
// Definitions by: taoqf <https://github.com/taoqf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
/// <reference types="node" />
export interface Box {
x: number;
y: number;
width: number;
height: number;
}
export interface Point {
x: number;
y: number;
}
export interface Segment {
p1: Point;
p2: Point;
error: number;
}
export interface Skew {
angle: number;
confidence: number;
}
export interface Component {
x: number;
y: number;
width: number;
height: number;
}
export class Image {
/**
* Creates a copy of otherImage.
*/
constructor(otherImage: Image);
/**
* Creates a 32 bit imagen from three 8 bit images, where each image represents one channel of RGB or HSV.
*/
constructor(image1: Image, image2: Image, image3: Image);
/**
* Creates an empty image with the specified dimensions (!!! note: this constructor is experimental and likely to change).
*/
constructor(width: number, height: number, depth: number);
/**
* Creates an image from a Buffer object, that contains the PNG/JPG encoded image.
*/
constructor(type: 'png' | 'jpg', buffer: Buffer);
constructor(type: 'rgba' | 'rgb' | 'gray', buffer: Buffer, width: number, height: number);
readonly width: number;
readonly height: number;
/**
* The depth of the image in bits per pixel, i.e. one of 32 (color), 8 (grayscale) or 1 (monochrome).
*/
readonly depth: number;
/**
* Returns the (boolean) inverse of this image.
*/
invert(): Image;
/**
* Returns the (boolean) union of two images with equal depth, aligning them to the upper left corner.
*/
or(otherImage: Image): Image;
/**
* Returns the (boolean) difference of two images with equal depth, aligning them to the upper left corner.
*/
and(otherImage: Image): Image;
/**
* Returns the (boolean) exclusive disjunction of two images with equal depth, aligning them to the upper left corner.
*/
xor(otherImage: Image): Image;
/**
* If the images are monochrome, dispatches to Leptonica's pixOr. Otherwise, returns the channelwise addition of b to a, clipped at 255.
*/
add(otherImage: Image): Image;
/**
* If the images are monochrome, dispatches to Leptonica's pixSubtract and is equivalent to a.and(b.invert()).
* For grayscale images, returns the pixelwise subtraction of b from a, clipped at zero.
* For color, the entire RGB value is subtracted instead of doing channelwise subtraction (ask Leptonica why).
* @example:
* redness = colorImage.toGray(1, 0, 0).subtract(colorImage.toGray(0, 0.5, 0.5))
*/
subtract(otherImage: Image): Image;
/**
* Applies a convoltuion kernel with the specified dimensions. Image convolution is an operation where each destination pixel is computed based on a weighted sum of a set of nearby source pixels.
*/
convolve(halfWidth: number, halfHeight: number): Image;
/**
* Unsharp Masking creates an unsharp mask using halfWidth.
* The fraction determines how much of the edge is added back into image.
* The resulting image appears clearer, but it is generally less accurate.
*/
unsharp(halfWidth: number, fraction: number): Image;
/**
* Rotates the image around its center by the specified angle in degrees.
*/
rotate(angle: number): Image;
/**
* Scales an image proportionally by scale (1.0 = 100%).
*/
scale(scale: number): Image;
/**
* Scales an image by scaleX and scaleY (1.0 = 100%).
*/
scale(scaleX: number, scaleY: number): Image;
/**
* Crops an image from this image by the specified rectangle and returns the resulting image.
*/
crop(box: Box): Image;
crop(x: number, y: number, width: number, height: number): Image;
/**
* Creates a mask by testing if pixels (RGB, HSV, ...) are between lower and upper. Formally speaking:
* lower1 ≤ pixel1 ≤ upper1
* ∧ lower2 ≤ pixel2 ≤ upper2
* ∧ lower3 ≤ pixel3 ≤ upper3
*/
inRange(lower1: number, lower2: number, lower3: number, upper1: number, upper2: number, upper3: number): Image;
/**
* Only available for grayscale images. Returns the histogram in an array of length 256, where each entry represents the fraction (0.0 to 1.0) of that color in the image.
* The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be counted.
*/
histogram(mask?: Image): Image;
/**
* Computes the horizontal or vertical projection of an 1bpp or 8bpp image.
*/
projection(mode: 'horizontal' | 'vertical'): number[];
/**
* Sets the specified value to each pixel set in the mask.
*/
setMasked(mask: Image, value: number): Image;
/**
* Available for grayscale and color images. Channelwise maps each pixel of image using mapping, which must be an array of length 256 with integer values between 0 and 255.
* !!! !!! Note: this function actually changes the image!
* The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be modified.
*/
applyCurve(mapping: number[], mask?: Image): this;
/**
* Applies a rank (0.0 ... 1.0) filter of the specified width
* and height (think of it as radius) to this image
* and returns the result.
* If you set rank to 0.5 you'll get a Median Filter.
* Note that this type of filter works best with odd sizes like 3 or 5.
*/
rankFilter(width: number, height: number, rank: number): Image;
/**
* Color image quantization using an octree based algorithm.
* colors must be between 2 and 256.
* Note that support for the resulting palette image is highly experimental at this point;
* only toGray() and toBuffer('png') are guaranteed to work.
*/
octreeColorQuant(colors: number): Image;
/**
* Color image quantization using median cut algorithm.
* colors must be between 2 and 256.
* Note that support for the resulting palette image is highly experimental at this point;
* only toGray() and toBuffer('png') are guaranteed to work.
*/
medianCutQuant(colors: number): Image;
/**
* Converts a grayscale image to monochrome using a global threshold. value must be between 0 and 255.
*/
threshold(value: number): Image;
/**
* Converts an image to grayscale using default settings. Can be used to convert monochrome images back to grayscale.
*/
toGray(): Image;
/**
* Converts an RGB image to grayscale using the specified widths for each channel.
*/
toGray(redWeight: number, greenWeight: number, blueWeight: number): Image;
/**
* Converts an RGB image to grayscale by selecting either the 'min' or 'max' channel.
* This can act as a simple color filter: 'max' maps colored pixels towards white,
* while 'min' maps colored pixels towards black.
*/
toGray(selector: 'min' | 'max'): Image;
/**
* Converts a grayscale image to a color image.
*/
toColor(): Image;
/**
* Converts from RGB to HSV color space. HSV has the following ranges:
* Hue: [0 .. 239]
* Saturation: [0 .. 255]
* Value: [0 .. 255]
*/
toHSV(): Image;
/**
* Converts from HSV to RGB color space.
*/
toRGB(): Image;
/**
* Applies an Erode Filter and returns the result.
*/
erode(width: number, height: number): Image;
/**
* Applies a Dilate Filter and returns the result.
*/
dilate(width: number, height: number): Image;
/**
* Applies an Open Filter and returns the result.
*/
open(width: number, height: number): Image;
/**
* Applies a Close Filter and returns the result.
*/
close(width: number, height: number): Image;
/**
* Applies morphological thinning of type (fg or bg) with the specified connectivitiy (4 or 8) and maxIterations (0 to iterate until complete).
*/
thin(type: 'fg' | 'bg', connectivity: number, maxIterations: number): Image;
/**
* Scales an 8bpp image for maximum dynamic range. scale must be either log or linear.
*/
maxDynamicRange(scale: 'log' | 'linear'): Image;
/**
* Applies Otsu's Method for computing the threshold of a grayscale image.
* It computes a threshold for each tile of the specified size and performs the threshold operation,
* resulting in a binary image for each tile. These are stitched into the final result.
* The smooth size controls the a convolution kernel applied to threshold array (use 0 for no smoothing).
* The score factor controls the fraction of the max. Otsu score (typically 0.1; use 0.0 for standard Otsu).
*/
otsuAdaptiveThreshold(tileWidth: number, tileHeight: number, smoothWidth: number, smoothHeight: number, scoreFactor: number): Image;
/**
* Detects Line Segments with the specified accuracy (3 is a good start). The number of found line segments can be limited using maxLineSegments (0 is unlimited).
*/
lineSegments(accuracy: number, maxLineSegments: number, useWeightedMeanShift: boolean): Segment[];
/**
* Only available for monochrome images. Tries to find the skew of this image. The resulting angle is in degree. The confidence is between 0.0 and 1.0.
*/
findSkew(): Skew;
/**
* Only available for monochrome images. Tries to extract connected components (think of flood fill). The connectivity can be specified as 4 or 8 directions.
*/
connectedComponents(connectivity: 4 | 8): Component[];
/**
* The Distance Function works on 1bpp images. It labels each pixel with the largest distance between this and any other pixel in its connected component. The connectivity is either 4 or 8.
*/
distanceFunction(connectivity: 4 | 8): Image;
/**
* !!! Note: this function actually changes the image!
* Fills a specified rectangle with white.
*/
clearBox(box: Box): this;
clearBox(x: number, y: number, width: number, height: number): this;
/**
* !!! Note: this function actually changes the image!
* Draws a filled rectangle to this image with the specified value. Works for 8bpp and 1bpp images.
*/
fillBox(box: Box, value: number): this;
fillBox(x: number, y: number, width: number, height: number, value: number): this;
/**
* !!! Note: this function actually changes the image!
* Draws a filled rectangle to this image in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency).
*/
fillBox(box: Box, r: number, g: number, b: number, fraction?: number): this;
fillBox(x: number, y: number, width: number, height: number, r: number, g: number, b: number, fraction?: number): this;
/**
* !!! Note: this function actually changes the image!
* Draws a rectangle to this image with the specified border. The possible pixel manipulating operations are set, clear and flip.
*/
drawBox(box: Box, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this;
drawBox(x: number, y: number, width: number, height: number, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this;
/**
* !!! Note: this function actually changes the image!
* Draws a rectangle to this image with the specified border in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency).
*/
drawBox(box: Box, borderWidth: number, red: number, green: number, blue: number, frac?: number): this;
drawBox(x: number, y: number, width: number, height: number, borderWidth: number, red: number, green: number, blue: number, frac?: number): this;
/**
* !!! Note: this function actually changes the image!
* Draws a line between p1 and p2 to this image with the specified line width. The possible pixel manipulating operations are set, clear and flip.
*/
drawLine(p1: Point, p2: Point, width: number, operation: 'set' | 'clear' | 'flip'): this;
/**
* !!! Note: this function actually changes the image!
* Draws a line between p1 and p2 to this image with the specified line width in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency).
*/
drawLine(p1: Point, p2: Point, width: number, red: number, green: number, blue: number, frac?: number): this;
/**
* !!! Note: this function actually changes the image!
* Draws an image to this image with the specified destination box.
*/
drawImage(image: Image, box: Box): this;
drawImage(image: Image, x: number, y: number, width: number, height: number): this;
/**
* Converts the Image in the specified format to a buffer.
* Specifying raw returns the raw image data as buffer.
* For color images, the result contains three bytes per pixel in the order R, G, B;
* for grayscale and monochrome images, it contains one byte per pixel.
* Specifying png returns a PNG encoded image as buffer.
* Specifying jpg returns a JPG encoded image as buffer.
*/
toBuffer(format?: 'raw' | 'png' | 'jpg'): Buffer;
}
export interface Rect {
x: number;
y: number;
width: number;
height: number;
}
export interface Region {
box: Box;
text: string;
confidence: number;
}
export type Paragaph = Region;
export interface Textline {
box: Box;
}
export type Word = Region;
export interface Choice {
text: string;
confidence: number;
}
export interface Symbol extends Region {
choices: Choice[];
}
export type Text = Choice;
/**
* A Tesseract object represents an optical character recognition engine, that reads text using Tesseract from an image.
* Tesseract supports many langauges and fonts (see Tesseract/Downloads).
* New language files have to be installed in node-dv/tessdata.
*/
export class Tesseract {
/**
* Creates a Tesseract engine with language set to english.
*/
constructor();
constructor(datapath: string);
/**
* Creates a Tesseract engine with the specified language.
*/
constructor(lang: string, image: Image);
/**
* Creates a Tesseract engine with the specified language and image.
*/
constructor(datapath: string, lang: string, image: Image);
/**
* Accessor for the input image.
*/
image: Image;
/**
* Accessor for the rectangle that specifies a "visible" area on the image.
*/
rectangle: Rect;
/**
* Accessor for the page segmentation mode.
*/
pageSegMode: 'osd_only' | 'auto_osd' | 'auto_only' | 'auto'
| 'single_column' | 'single_block_vert_text' | 'single_block'
| 'single_line' | 'single_word' | 'circle_word' | 'single_char'
| 'sparse_text' | 'sparse_text_osd';
[key: string]: unknown;
/**
* Clears the tesseract image and its last results.
*/
clear(): void;
/**
* Clears all adaptive classifiers (use this when results vary during scanning).
*/
clearAdaptiveClassifier(): void;
/**
* Returns the binarized image Tesseract uses for its recognition.
*/
thresholdImage(): Image;
/**
* Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster.
*/
findRegions(recognize: boolean): Region[];
/**
* Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster.
*/
findParagraphs(recognize: boolean): Paragaph[];
/**
* Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster.
*/
findTextLines(recognize: boolean): Textline[];
/**
* Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster.
*/
findWords(recognize: boolean): Word[];
/**
* Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster.
*/
findSymbols(recognize: boolean): symbol[];
/**
* Returns text in the specified format. Valid formats are: plain, unlv.
*/
findText(format: 'plain' | 'unlv', withConfidence?: boolean): string;
findText(format: 'hocr' | 'box', pageNumber: number): string;
}
export interface Barcodeformat {
QR_CODE: boolean;
DATA_MATRIX: boolean;
PDF_417: boolean;
UPC_E: boolean;
UPC_A: boolean;
EAN_8: boolean;
EAN_13: boolean;
CODE_128: boolean;
CODE_39: boolean;
ITF: boolean;
AZTEC: boolean;
}
export interface BarCode {
type: string;
data: string;
buffer: Buffer;
points: Point[];
}
/**
* A ZXing object represents a barcode reader. By default it attempts to decode all barcode formats that ZXing supports.
*/
export class ZXing {
constructor(image?: Image);
/**
* Accessor for the input image this barcode reader operates on.
*/
image: Image;
/**
* List of barcodes the reader tries to find. It's specified as an object and missing properties account as false
*/
formats: Barcodeformat;
/**
* If try harder is enabled, the barcode reader spends more time trying to find a barcode (optimize for accuracy, not speed).
*/
tryHarder: boolean;
/**
* Returns the first barcode found as an object with the following format:
*/
findCode(): BarCode;
/**
* enotes the barcodes type.
*/
readonly type: 'None' | 'QR_CODE' | 'DATA_MATRIX' | 'PDF_417' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'ITF' | 'AZTEC';
/**
* denotes the stringified data read from the barcode.
*/
readonly data: string;
/**
* denotes the decoded binary data of the barcode before conversion into another character encoding.
*/
readonly buffer: Buffer;
/**
* denotes the points in pixels which were used by the barcode reader to detect the barcode.
*/
readonly points: Point[];
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"dv-tests.ts"
]
}
@@ -1,6 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"dt-header": false
"unified-signatures": false
}
}
}
@@ -52,3 +52,7 @@ typedElectronStore.set({
enabled: true,
interval: 10000,
});
const offDidChange = typedElectronStore.onDidChange("enabled", (n: boolean | undefined, p: boolean | undefined) => {});
offDidChange();
+6 -4
View File
@@ -8,6 +8,8 @@
/// <reference types="node" />
import EventEmitter = require("events");
type JSONValue = string | number | boolean | JSONObject | JSONArray;
interface JSONObject {
@@ -79,12 +81,12 @@ declare class ElectronStore<T = {}> implements Iterable<[string, JSONValue]> {
*/
onDidChange<K extends keyof T>(
key: K,
callback: (newValue: T[K], oldValue: T[K]) => void
): void;
callback: (newValue: T[K] | undefined, oldValue: T[K] | undefined) => void
): () => EventEmitter;
onDidChange(
key: string,
callback: (newValue: JSONValue, oldValue: JSONValue) => void
): void;
callback: (newValue: JSONValue | undefined, oldValue: JSONValue | undefined) => void
): () => EventEmitter;
/**
* Get the item count.
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -35,6 +35,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+5 -2
View File
@@ -38,15 +38,17 @@ import {
ComputedPropertyCallback,
ObserverMethod
} from '@ember/object/-private/types';
import * as HandlebarsNamespace from 'handlebars';
// Capitalization is intentional: this makes it much easier to re-export RSVP on
// the Ember namespace.
import Rsvp from 'rsvp';
import { TemplateFactory } from 'htmlbars-inline-precompile';
import { Registry as ServiceRegistry } from '@ember/service';
import { Registry as ControllerRegistry } from '@ember/controller';
import * as EmberStringNs from '@ember/string';
import * as EmberStringHandlebarsNs from '@ember/string/-private/handlebars';
// tslint:disable-next-line:no-duplicate-imports
import * as EmberServiceNs from '@ember/service';
import * as EmberPolyfillsNs from '@ember/polyfills';
@@ -424,11 +426,12 @@ export namespace Ember {
function K(): any;
function createFrame(objec: any): any;
function Exception(message: string): void;
const SafeString: typeof HandlebarsNamespace.SafeString;
class SafeString extends EmberStringHandlebarsNs.SafeString {}
function parse(string: string): any;
function print(ast: any): void;
const logger: typeof Logger;
function log(level: string, str: string): void;
function registerHelper(name: string, helper: any): void;
}
namespace String {
const camelize: typeof EmberStringNs.camelize;
+2 -2
View File
@@ -92,10 +92,10 @@ App.userController = Ember.Object.create({
}),
});
Handlebars.registerHelper(
Ember.Handlebars.registerHelper(
'highlight',
(property: string, options: any) =>
new Handlebars.SafeString('<span class="highlight">' + 'some value' + '</span>')
new Ember.Handlebars.SafeString('<span class="highlight">' + 'some value' + '</span>')
);
const coolView = App.CoolView.create();
+1 -1
View File
@@ -1,5 +1,5 @@
import Ember from 'ember';
import { SafeString } from 'handlebars';
import { SafeString } from '@ember/string/-private/handlebars';
const { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w } = Ember.String;
+1
View File
@@ -36,6 +36,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"handlebars": "^4.1.0"
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"handlebars": "^4.1.0"
}
}
+22 -2
View File
@@ -1,12 +1,32 @@
import EmberObject from "@ember/object";
import {
UnwrapComputedPropertyGetter,
UnwrapComputedPropertyGetters
} from "@ember/object/-private/types";
/**
* `Ember.ObjectProxy` forwards all properties not defined by the proxy itself
* to a proxied `content` object.
*/
export default class ObjectProxy extends EmberObject {
export default class ObjectProxy<T extends object = object> extends EmberObject {
/**
* The object whose properties will be forwarded.
*/
content: object;
content: T | undefined;
get<K extends keyof this>(key: K): UnwrapComputedPropertyGetter<this[K]>;
get<K extends keyof T>(key: K): UnwrapComputedPropertyGetter<T[K]> | undefined;
getProperties<K extends keyof this>(
list: K[]
): Pick<UnwrapComputedPropertyGetters<this>, K>;
getProperties<K extends keyof this>(
...list: K[]
): Pick<UnwrapComputedPropertyGetters<this>, K>;
getProperties<K extends keyof T>(
list: K[]
): Pick<Partial<UnwrapComputedPropertyGetters<T>>, K>;
getProperties<K extends keyof T>(
...list: K[]
): Pick<Partial<UnwrapComputedPropertyGetters<T>>, K>;
}
+38
View File
@@ -0,0 +1,38 @@
import ObjectProxy from "@ember/object/proxy";
interface Book {
title: string;
subtitle: string;
chapters: Array<{ title: string }>;
}
class DefaultProxy extends ObjectProxy {}
DefaultProxy.create().content; // $ExpectType object | undefined
class BookProxy extends ObjectProxy<Book> {
private readonly baz = 'baz';
getTitle() {
return this.get('title');
}
getPropertiesTitleSubtitle() {
return this.getProperties('title', 'subtitle');
}
}
const book = BookProxy.create();
book.content; // $ExpectType Book | undefined
book.get("unknownProperty"); // $ExpectError
book.get("title"); // $ExpectType string | undefined
book.getTitle(); // $ExpectType string | undefined
book.getProperties("title", "unknownProperty"); // $ExpectError
book.getProperties("title", "subtitle"); // $ExpectType Pick<Partial<UnwrapComputedPropertyGetters<Book>>, "title" | "subtitle">
book.getPropertiesTitleSubtitle(); // $ExpectType Pick<Partial<UnwrapComputedPropertyGetters<Book>>, "title" | "subtitle">
book.getProperties(["subtitle", "chapters"]); // $ExpectType Pick<Partial<UnwrapComputedPropertyGetters<Book>>, "subtitle" | "chapters">
book.getProperties(["title", "unknownProperty"]); // $ExpectError
book.get("baz"); // $ExpectError
+1
View File
@@ -49,6 +49,7 @@
"test/extend.ts",
"test/object.ts",
"test/observable.ts",
"test/proxy.ts",
"test/reopen.ts"
]
}
+37
View File
@@ -0,0 +1,37 @@
export interface QueueItem {
method: string;
target: object;
args: object[];
stack: string | undefined;
}
export interface DeferredActionQueues {
[index: string]: any;
queues: object;
schedule(
queueName: string,
target: any,
method: any,
args: any,
onceFlag: boolean,
stack: any
): any;
flush(fromAutorun: boolean): any;
}
export interface DebugInfo {
autorun: Error | undefined | null;
counters: object;
timers: QueueItem[];
instanceStack: DeferredActionQueues[];
}
export interface Backburner {
join(...args: any[]): void;
on(...args: any[]): void;
scheduleOnce(...args: any[]): void;
schedule(queueName: string, target: object | null, method: () => void | string): void;
ensureInstance(): void;
DEBUG: boolean;
getDebugInfo(): DebugInfo;
}
@@ -1,9 +1,19 @@
import { run } from '@ember/runloop';
import EmberObject from '@ember/object';
import { Backburner, DebugInfo, QueueItem, DeferredActionQueues } from '@ember/runloop/-private/backburner';
run; // $ExpectType RunNamespace
run.queues; // $ExpectType EmberRunQueues[]
const queues: string[] = run.queues;
// It will be the responsibility of each consuming package that needs access to the backburner property
// to merge the private types in the public API.
declare module '@ember/runloop' {
interface RunNamespace {
backburner: Backburner;
}
}
function testRun() {
run(() => { // $ExpectType number
// code to be executed within a RunLoop
@@ -198,3 +208,9 @@ function testThrottle() {
run.throttle(runIt, 150);
run.throttle(myContext, runIt, 150);
}
function testBackburner() {
const debugInfo: DebugInfo = run.backburner.getDebugInfo();
const queueItems: QueueItem[] = debugInfo.timers;
const deferredActionQueues: DeferredActionQueues[] = debugInfo.instanceStack;
}
+308 -306
View File
@@ -1,320 +1,322 @@
// Type definitions for non-npm package @ember/runloop 3.0
// Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Frunloop
// Definitions by: Mike North <https://github.com/mike-north>
// Steve Calvert <https://github.com/scalvert>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { RunMethod, EmberRunQueues } from "@ember/runloop/-private/types";
import { EmberRunTimer } from "@ember/runloop/types";
import '@ember/runloop/-private/backburner';
// tslint:disable-next-line:strict-export-declare-modifiers
export const run: {
/**
* Runs the passed target and method inside of a RunLoop, ensuring any
* deferred actions including bindings and views updates are flushed at the
* end.
*/
<Ret>(method: (...args: any[]) => Ret): Ret;
<Target, Ret>(target: Target, method: RunMethod<Target, Ret>): Ret;
/**
* If no run-loop is present, it creates a new one. If a run loop is
* present it will queue itself to run on the existing run-loops action
* queue.
*/
join<Ret>(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined;
join<Target, Ret>(
target: Target,
method: RunMethod<Target, Ret>,
...args: any[]
): Ret | undefined;
/**
* Allows you to specify which context to call the specified function in while
* adding the execution of that function to the Ember run loop. This ability
* makes this method a great way to asynchronously integrate third-party libraries
* into your Ember application.
*/
bind<Target, Ret>(
target: Target,
method: RunMethod<Target, Ret>,
...args: any[]
): (...args: any[]) => Ret;
/**
* Begins a new RunLoop. Any deferred actions invoked after the begin will
* be buffered until you invoke a matching call to `run.end()`. This is
* a lower-level way to use a RunLoop instead of using `run()`.
*/
begin(): void;
/**
* Ends a RunLoop. This must be called sometime after you call
* `run.begin()` to flush any deferred actions. This is a lower-level way
* to use a RunLoop instead of using `run()`.
*/
end(): void;
/**
* Adds the passed target/method and any optional arguments to the named
* queue to be executed at the end of the RunLoop. If you have not already
* started a RunLoop when calling this method one will be started for you
* automatically.
*/
schedule<Target>(
queue: EmberRunQueues,
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
schedule(
queue: EmberRunQueues,
method: (args: any[]) => any,
...args: any[]
): EmberRunTimer;
/**
* Invokes the passed target/method and optional arguments after a specified
* period of time. The last parameter of this method must always be a number
* of milliseconds.
*/
later(method: (...args: any[]) => any, wait: number): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
wait: number
): EmberRunTimer;
/**
* Schedule a function to run one time during the current RunLoop. This is equivalent
* to calling `scheduleOnce` with the "actions" queue.
*/
once<Target>(
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Schedules a function to run one time in a given queue of the current RunLoop.
* Calling this method with the same queue/target/method combination will have
* no effect (past the initial call).
*/
scheduleOnce<Target>(
queue: EmberRunQueues,
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Schedules an item to run from within a separate run loop, after
* control has been returned to the system. This is equivalent to calling
* `run.later` with a wait time of 1ms.
*/
next<Target>(
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Cancels a scheduled item. Must be a value returned by `run.later()`,
* `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or
* `run.throttle()`.
*/
cancel(timer: EmberRunTimer): boolean;
/**
* Delay calling the target method until the debounce period has elapsed
* with no additional debounce calls. If `debounce` is called again before
* the specified time has elapsed, the timer is reset and the entire period
* must pass again before the target method is called.
*/
debounce(
method: (...args: any[]) => any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
/**
* Ensure that the target method is never called more frequently than
* the specified spacing period. The target method is called immediately.
*/
throttle(
method: (...args: any[]) => any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
export interface RunNamespace {
/**
* Runs the passed target and method inside of a RunLoop, ensuring any
* deferred actions including bindings and views updates are flushed at the
* end.
*/
<Ret>(method: (...args: any[]) => Ret): Ret;
<Target, Ret>(target: Target, method: RunMethod<Target, Ret>): Ret;
/**
* If no run-loop is present, it creates a new one. If a run loop is
* present it will queue itself to run on the existing run-loops action
* queue.
*/
join<Ret>(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined;
join<Target, Ret>(
target: Target,
method: RunMethod<Target, Ret>,
...args: any[]
): Ret | undefined;
/**
* Allows you to specify which context to call the specified function in while
* adding the execution of that function to the Ember run loop. This ability
* makes this method a great way to asynchronously integrate third-party libraries
* into your Ember application.
*/
bind<Target, Ret>(
target: Target,
method: RunMethod<Target, Ret>,
...args: any[]
): (...args: any[]) => Ret;
/**
* Begins a new RunLoop. Any deferred actions invoked after the begin will
* be buffered until you invoke a matching call to `run.end()`. This is
* a lower-level way to use a RunLoop instead of using `run()`.
*/
begin(): void;
/**
* Ends a RunLoop. This must be called sometime after you call
* `run.begin()` to flush any deferred actions. This is a lower-level way
* to use a RunLoop instead of using `run()`.
*/
end(): void;
/**
* Adds the passed target/method and any optional arguments to the named
* queue to be executed at the end of the RunLoop. If you have not already
* started a RunLoop when calling this method one will be started for you
* automatically.
*/
schedule<Target>(
queue: EmberRunQueues,
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
schedule(
queue: EmberRunQueues,
method: (args: any[]) => any,
...args: any[]
): EmberRunTimer;
/**
* Invokes the passed target/method and optional arguments after a specified
* period of time. The last parameter of this method must always be a number
* of milliseconds.
*/
later(method: (...args: any[]) => any, wait: number): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
wait: number
): EmberRunTimer;
later<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
wait: number
): EmberRunTimer;
/**
* Schedule a function to run one time during the current RunLoop. This is equivalent
* to calling `scheduleOnce` with the "actions" queue.
*/
once<Target>(
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Schedules a function to run one time in a given queue of the current RunLoop.
* Calling this method with the same queue/target/method combination will have
* no effect (past the initial call).
*/
scheduleOnce<Target>(
queue: EmberRunQueues,
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Schedules an item to run from within a separate run loop, after
* control has been returned to the system. This is equivalent to calling
* `run.later` with a wait time of 1ms.
*/
next<Target>(
target: Target,
method: RunMethod<Target>,
...args: any[]
): EmberRunTimer;
/**
* Cancels a scheduled item. Must be a value returned by `run.later()`,
* `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or
* `run.throttle()`.
*/
cancel(timer: EmberRunTimer): boolean;
/**
* Delay calling the target method until the debounce period has elapsed
* with no additional debounce calls. If `debounce` is called again before
* the specified time has elapsed, the timer is reset and the entire period
* must pass again before the target method is called.
*/
debounce(
method: (...args: any[]) => any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
debounce<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
wait: number,
immediate?: boolean
): EmberRunTimer;
/**
* Ensure that the target method is never called more frequently than
* the specified spacing period. The target method is called immediately.
*/
throttle(
method: (...args: any[]) => any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
throttle<Target>(
target: Target,
method: RunMethod<Target>,
arg0: any,
arg1: any,
arg2: any,
arg3: any,
arg4: any,
arg5: any,
spacing: number,
immediate?: boolean
): EmberRunTimer;
queues: EmberRunQueues[];
};
queues: EmberRunQueues[];
}
export const run: RunNamespace;
export const begin: typeof run.begin;
export const bind: typeof run.bind;
export const cancel: typeof run.cancel;
+1
View File
@@ -28,6 +28,7 @@
"index.d.ts",
"types.d.ts",
"-private/types.d.ts",
"-private/backburner.d.ts",
"ember__runloop-tests.ts"
]
}
+5
View File
@@ -0,0 +1,5 @@
export class SafeString {
constructor(str: string);
toString(): string;
toHTML(): string;
}
+2 -2
View File
@@ -1,5 +1,5 @@
import { dasherize, camelize, capitalize, classify, decamelize, htmlSafe, loc, underscore, w, isHTMLSafe } from '@ember/string';
import { SafeString } from 'handlebars';
import { SafeString } from '@ember/string/-private/handlebars';
dasherize(); // $ExpectError
dasherize('blue man group'); // $ExpectType string
@@ -37,7 +37,7 @@ const handlebarsSafeString: SafeString = htmlSafe('lorem ipsum...');
htmlSafe('lorem ipsum...'); // $ExpectType SafeString
const regularString: string = htmlSafe('lorem ipsum...'); // $ExpectError
function isSafeTest(a: string|Handlebars.SafeString) {
function isSafeTest(a: string | SafeString) {
if (isHTMLSafe(a)) {
a = a.toString();
}
+1 -1
View File
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import { SafeString } from 'handlebars';
import { SafeString } from "./-private/handlebars";
export function camelize(str: string): string;
export function capitalize(str: string): string;
+3 -1
View File
@@ -15,13 +15,15 @@
"../"
],
"paths": {
"@ember/string": ["ember__string"]
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"-private/handlebars.d.ts",
"index.d.ts",
"ember__string-tests.ts"
]
+1
View File
@@ -38,6 +38,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
+1
View File
@@ -36,6 +36,7 @@
"@ember/runloop/*": ["ember__runloop/*"],
"@ember/service": ["ember__service"],
"@ember/string": ["ember__string"],
"@ember/string/*": ["ember__string/*"],
"@ember/test": ["ember__test"],
"@ember/test/*": ["ember__test/*"],
"@ember/utils": ["ember__utils"],
@@ -48,6 +48,10 @@ FB.logout(function(response: fb.StatusResponse) {
console.log(response.authResponse.accessToken);
});
FB.login({ auth_type: 'reauthenticate' });
FB.login({ auth_type: 'reauthorize' });
FB.login({ auth_type: 'rerequest' });
FB.logout();
/**
+1 -1
View File
@@ -150,7 +150,7 @@ declare namespace facebook {
}
interface LoginOptions {
auth_type?: 'rerequest';
auth_type?: 'reauthenticate' | 'reauthorize' | 'rerequest';
scope?: string;
return_scopes?: boolean;
enable_profile_selector?: boolean;
+1
View File
@@ -15,6 +15,7 @@ filesize(265318, {standard: "iec"}); // "259.1 KiB"
filesize(265318, {standard: "iec", fullform: true}); // "259.1 kibibytes"
filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов"
filesize(265318, {separator: ","}); // "259,1 KB"
filesize(265318, {locale: 'de-DE'}); // "259,1 KB"
const size = filesize.partial({standard: "iec"});
size(265318);
+6 -1
View File
@@ -1,8 +1,9 @@
// Type definitions for filesize 4.0
// Type definitions for filesize 4.1
// Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Renaud Chaput <https://github.com/renchap>
// Roman Nuritdinov <https://github.com/Ky6uk>
// Sam Hulick <https://github.com/ffxsam>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var fileSize: Filesize.Filesize;
@@ -57,6 +58,10 @@ declare namespace Filesize {
* Array of full form overrides, default is []
*/
fullforms?: string[];
/**
* BCP 47 language tag to specify a locale, or true to use default locale, default is ""
*/
locale?: string | boolean;
/**
* Output of function (array, exponent, object, or string), default is string
*/
+63 -6
View File
@@ -1,4 +1,4 @@
// Type definitions for Forge Viewer 6.3
// Type definitions for Forge Viewer 6.4
// Project: https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d/
// Definitions by: Autodesk Forge Partner Development <https://github.com/Autodesk-Forge>, Alan Smith <https://github.com/alansmithnbs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -150,6 +150,13 @@ declare namespace Autodesk {
interface ViewerConfig {
disableBrowserContextMenu?: boolean;
disabledExtensions?: {
bimwalk?: boolean;
hyperlink?: boolean;
measure?: boolean;
scalarisSimulation?: boolean;
section?: boolean;
};
extensions?: string[];
useConsolidation?: boolean;
consolidationMemoryLimit?: number;
@@ -238,10 +245,14 @@ declare namespace Autodesk {
[key: string]: any;
}
const AGGREGATE_FIT_TO_VIEW_EVENT = 'aggregateFitToView';
const AGGREGATE_ISOLATION_CHANGED_EVENT = 'aggregateIsolation';
const AGGREGATE_SELECTION_CHANGED_EVENT = 'aggregateSelection';
const ANIMATION_READY_EVENT = 'animationReady';
const CAMERA_CHANGE_EVENT = 'cameraChanged';
const CAMERA_TRANSITION_COMPLETED = 'cameraTransitionCompleted';
const CUTPLANES_CHANGE_EVENT = 'cutplanesChanged';
const CANCEL_LEAFLET_SCREENSHOT = 'cancelLeafletScreenshot';
const ESCAPE_EVENT = 'escape';
const EXPLODE_CHANGE_EVENT = 'explodeChanged';
const EXTENSION_LOADED_EVENT = 'extensionLoaded';
@@ -251,12 +262,17 @@ declare namespace Autodesk {
const FRAGMENTS_LOADED_EVENT = 'fragmentsLoaded';
const FULLSCREEN_MODE_EVENT = 'fullscreenMode';
const GEOMETRY_LOADED_EVENT = 'geometryLoaded';
const GEOMETRY_DOWNLOAD_COMPLETE_EVENT = 'geometryDownloadComplete';
const HIDE_EVENT = 'hide';
const HYPERLINK_EVENT = 'hyperlink';
const ISOLATE_EVENT = 'isolate';
const LAYER_VISIBILITY_CHANGED_EVENT = 'layerVisibilityChanged';
const LOAD_GEOMETRY_EVENT = 'loadGeometry';
const LOAD_MISSING_GEOMETRY = 'loadMissingGeometry';
const MODEL_ADDED_EVENT = 'modelAdded';
const MODEL_ROOT_LOADED_EVENT = 'modelRootLoaded';
const MODEL_REMOVED_EVENT = 'modelRemoved';
const MODEL_LAYERS_LOADED_EVENT = 'modelLayersLoaded';
const MODEL_UNLOADED_EVENT = 'modelUnloaded';
const NAVIGATION_MODE_CHANGED_EVENT = 'navigationModeChanged';
const OBJECT_TREE_CREATED_EVENT = 'objectTreeCreated';
@@ -277,6 +293,7 @@ declare namespace Autodesk {
const VIEWER_RESIZE_EVENT = 'viewerResize';
const VIEWER_STATE_RESTORED_EVENT = 'viewerStateRestored';
const VIEWER_UNINITIALIZED = 'viewerUninitialized';
const WEBGL_CONTEXT_LOST_EVENT = 'webGlContextLost';
interface ViewerEventArgs {
target?: Viewer3D;
@@ -333,6 +350,7 @@ declare namespace Autodesk {
setTag(tag: string, value: any): void;
traverse(cb: () => void): boolean;
urn(searchParent: boolean): string;
useAsDefault(): boolean;
}
let theExtensionManager: ExtensionManager;
@@ -345,6 +363,7 @@ declare namespace Autodesk {
language?: string;
accessToken?: string;
useADP?: boolean;
useConsolidation?: boolean;
[key: string]: any;
}
@@ -438,16 +457,42 @@ declare namespace Autodesk {
}
class Model {
getBoundingBox(): THREE.Box3;
fetchTopology(maxSizeMB: number): Promise<object>;
getBulkProperties(dbIds: number[], propFilter?: string[], successCallback?: (r: any) => void, errorCallback?: (err: any) => void): void;
getData(): any;
getFragmentList(): any;
getObjectTree(successCallback?: (result: InstanceTree) => void, errorCallback?: (err: any) => void): void;
getProperties(dbId: number, successCallback?: (r: PropertyResult) => void, errorCallback?: (err: any) => void): void;
geomPolyCount(): number;
getDefaultCamera(): THREE.Camera;
getDisplayUnit(): string;
getDocumentNode(): object;
getExternalIdMapping(onSuccessCallback: () => void, onErrorCallback: () => void): any;
getFastLoadList(): any;
getFragmentMap(): any; // DbidFragmentMap|InstanceTree;
getLayersRoot(): object;
getMetadata(itemName: string, subitemName?: string, defaultValue?: any): any;
getRoot(): object;
getRootId(): number;
getTopoIndex(fragId: number): number;
getTopology(index: number): object;
getUnitData(unit: string): object;
getUnitScale(): number;
getUnitString(): number;
search(text: string, successCallback: (r: number[]) => void, errorCallback?: (err: any) => void, attributeNames?: string[]): void;
getUnitString(): string;
getUpVector(): any;
hasTopology(): boolean;
instancePolyCount(): number;
is2d(): boolean;
is3d(): boolean;
isAEC(): boolean;
isLoadDone(): boolean;
isObjectTreeCreated(): boolean;
isObjectTreeLoaded(): boolean;
pageToModel(): void;
pointInClip(): void;
search(text: string, onSuccessCallback: () => void, onErrorCallback: () => void, attributeNames?: string[]): void;
setData(data: object): void;
setUUID(urn: string): void;
clearThemingColors(): void;
getInstanceTree(): InstanceTree;
@@ -760,6 +805,13 @@ declare namespace Autodesk {
getHitPoint(x: number, y: number): THREE.Vector3;
}
namespace Extensions {
class ViewerPropertyPanel extends UI.PropertyPanel {
constructor(viewer: Private.GuiViewer3D);
currentNodeIds: object[];
}
}
namespace Private {
function getHtmlTemplate(url: string, callback: (error: string, content: string) => void): void;
@@ -850,11 +902,16 @@ declare namespace Autodesk {
hitTestViewport(vpVec: THREE.Vector3, ignoreTransparent: boolean): HitTestResult;
initialize(): void;
setLightPreset(index: number, force?: boolean): void;
viewportToClient(viewportX: number, viewportY: number): THREE.Vector3;
viewportToClient(viewportX: number, viewportY: number): THREE.Vector3;
modelqueue(): any;
matman(): any;
getMaterials(): any;
getScreenShotProgressive(w: number, h: number, onFinished?: () => void, options?: any): any;
getRenderProxy(model: Model, fragId: number): any;
sceneUpdated(param: boolean): void;
setViewFromCamera(camera: THREE.Camera, skipTransition?: boolean, useExactCamera?: boolean): void;
}
class VisibilityManager {
+2 -1
View File
@@ -1,6 +1,7 @@
// Type definitions for gestalt 0.75
// Project: https://github.com/pinterest/gestalt, https://pinterest.github.io/gestalt
// Definitions by: Nicolás Serrano Arévalo <https://github.com/serranoarevalo>
// Josh Gachnang <https://github.com/joshgachnang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -938,7 +939,7 @@ export class Pog extends React.Component<PogProps, any> {}
export class Pulsar extends React.Component<PulsarProps, any> {}
export class RadioButton extends React.Component<RadioButtonProps, any> {}
export class SearchField extends React.Component<SearchFieldProps, any> {}
export class SegmentedControl extends React.Component<SearchFieldProps, any> {}
export class SegmentedControl extends React.Component<SegmentedControlProps, any> {}
export class SelectList extends React.Component<SelectListProps, any> {}
export class Spinner extends React.Component<SpinnerProps, any> {}
export class Sticky extends React.Component<StickyProps, any> {}
+7 -1
View File
@@ -4,6 +4,7 @@ let mapOptions: google.maps.MapOptions = {
backgroundColor: "#fff",
center: { lat: -25.363, lng: 131.044 },
clickableIcons: true,
controlSize: 30,
draggable: true,
fullscreenControl: true,
fullscreenControlOptions: {
@@ -124,7 +125,7 @@ data.setStyle({
cursor: "pointer",
fillColor: "#79B55B",
fillOpacity: 1,
icon: <google.maps.Icon>{ url: "//maps.google.com/mapfiles/ms/icons/blue.png" },
icon: { url: "//maps.google.com/mapfiles/ms/icons/blue.png" } as google.maps.Icon,
shape: { coords: [1, 2, 3], type: "circle" },
strokeColor: "#79B55B",
strokeOpacity: 1,
@@ -449,3 +450,8 @@ service.findPlaceFromPhoneNumber({
results[0].name; // $ExpectType string
});
/***** google.maps.places.Autocomplete *****/
const autocomplete = new google.maps.places.Autocomplete(document.createElement('input'));
const placeResult = autocomplete.getPlace();
placeResult.name; // $ExpectType string
+31 -22
View File
@@ -11,6 +11,7 @@
// Sven Kreiss <https://github.com/svenkreiss>
// Umar Bolatov <https://github.com/bolatovumar>
// Michael Gauthier <https://github.com/gauthierm>
// Colin Doig <https://github.com/captain-igloo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*
@@ -93,6 +94,14 @@ declare namespace google.maps {
* interest, also known as a POI. By default map icons are clickable.
*/
clickableIcons?: boolean
/**
* Size in pixels of the controls appearing on the map. This value must be
* supplied directly when creating the Map, updating this value later may
* bring the controls into an undefined state. Only governs the controls
* made by the Maps API itself. Does not scale developer created custom
* controls.
*/
controlSize?: number;
/** Enables/disables all default UI. May be overridden individually. */
disableDefaultUI?: boolean;
/** Enables/disables zoom and center on double click. Enabled by default. */
@@ -2726,29 +2735,29 @@ declare namespace google.maps {
}
export interface PlaceResult {
address_components: GeocoderAddressComponent[];
adr_address: string;
aspects: PlaceAspectRating[];
formatted_address: string;
formatted_phone_number: string;
geometry: PlaceGeometry;
html_attributions: string[];
icon: string;
id: string;
international_phone_number: string;
address_components?: GeocoderAddressComponent[];
adr_address?: string;
aspects?: PlaceAspectRating[];
formatted_address?: string;
formatted_phone_number?: string;
geometry?: PlaceGeometry;
html_attributions?: string[];
icon?: string;
id?: string;
international_phone_number?: string;
name: string;
opening_hours: OpeningHours;
permanently_closed: boolean;
photos: PlacePhoto[];
place_id: string;
price_level: number;
rating: number;
reviews: PlaceReview[];
types: string[];
url: string;
utc_offset: number;
vicinity: string;
website: string;
opening_hours?: OpeningHours;
permanently_closed?: boolean;
photos?: PlacePhoto[];
place_id?: string;
price_level?: number;
rating?: number;
reviews?: PlaceReview[];
types?: string[];
url?: string;
utc_offset?: number;
vicinity?: string;
website?: string;
}
export interface PlaceReview {
+2 -2
View File
@@ -29,8 +29,8 @@ declare namespace gsap {
* Gets or sets an event callback like "onComplete", "onUpdate", "onStart", "onReverseComplete" or "onRepeat" (onRepeat only applies to TweenMax or TimelineMax instances) along with any
* parameters that should be passed to that callback.
*/
eventCallback(type: string): () => void;
eventCallback(type: string, callback: () => void, params?: any[], scope?: any): Animation;
eventCallback(type: string): (...args: any[]) => void;
eventCallback(type: string, callback: (...args: any[]) => void, params?: any[], scope?: any): Animation;
/**
* Clears any initialization data (like starting/ending values in tweens) which can be useful if, for example, you want to restart a tween without reverting to any previously recorded
+1 -1
View File
@@ -1,6 +1,6 @@
declare namespace gsap {
class Ease {
constructor(func?: () => void, extraParams?: any[], type?: number, power?: number);
constructor(func?: (...args: any[]) => void, extraParams?: any[], type?: number, power?: number);
/** Translates the tween's progress ratio into the corresponding ease ratio. */
getRatio(p: number): number;

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