Merge branch 'master' of github.com:DefinitelyTyped/DefinitelyTyped into chrome-updates

This commit is contained in:
Nikolai Ommundsen
2018-08-03 16:45:08 +02:00
388 changed files with 22583 additions and 5456 deletions
+1
View File
@@ -4293,6 +4293,7 @@
/types/timer-machine/ @dolanmiu
/types/timezone-js/ @bonnici
/types/tinajs__tina/ @Jimexist
/types/tinajs__tina-redux/ @Jimexist
/types/tinder/ @pingec
/types/tiny-slider-react/ @screendriver
/types/tinycolor2/ @M-Zuber @geertjansen @nvh
+3
View File
@@ -67,6 +67,9 @@ var mongoConnectionString = "mongodb://127.0.0.1/agenda";
await job.save();
const jobs = await agenda.jobs({ name: 'printAnalyticsReport' });
jobs.forEach((job) => {
job.save();
});
let numRemoved = await agenda.cancel({ name: 'printAnalyticsReport' });
+1 -1
View File
@@ -96,7 +96,7 @@ declare class Agenda extends EventEmitter {
* Find all Jobs matching `query` and pass same back in cb().
* @param query
*/
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any): Promise<void>;
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any): Promise<Agenda.Job<T>[]>;
/**
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
+23
View File
@@ -0,0 +1,23 @@
import agent = require('agent-base');
agent(); // $ExpectType Agent
agent({ timeout: 1000 }); // $ExpectType Agent
agent((req, opts) => {}); // $ExpectType Agent
agent((req, opts) => {}, { timeout: 1000 }); // $ExpectType Agent
agent(async (req, opts) => {}); // $ExpectType Agent
agent(async (req, opts) => {}, { timeout: 1000 }); // $ExpectType Agent
agent(0); // $ExpectError
agent(1); // $ExpectError
agent(''); // $ExpectError
agent(true); // $ExpectError
agent(null); // $ExpectError
agent((req, opts) => {}, 0); // $ExpectError
agent((req, opts) => {}, 1); // $ExpectError
agent((req, opts) => {}, ''); // $ExpectError
agent((req, opts) => {}, true); // $ExpectError
agent((req, opts) => {}, null); // $ExpectError
agent((req, opts) => {}, (req, opts) => {}); // $ExpectError
+44
View File
@@ -0,0 +1,44 @@
// Type definitions for agent-base 4.2
// Project: https://github.com/TooTallNate/node-agent-base#readme
// Definitions by: Christopher Quadflieg <https://github.com/Shinigami92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'events';
declare namespace Agent {
type AgentCallback = (
req?: any,
opts?: {
secureEndpoint: boolean;
}
) => void;
interface AgentOptions {
timeout?: number;
host?: string;
port?: number;
[key: string]: any;
}
interface Agent extends EventEmitter {
_promisifiedCallback: boolean;
timeout: number | null;
options?: AgentOptions;
callback: AgentCallback;
addRequest: (req?: any, opts?: any) => void;
freeSocket: (socket: any, opts: any) => void;
}
}
/**
* Base `http.Agent` implementation.
* No pooling/keep-alive is implemented by default.
*/
declare function Agent(opts?: Agent.AgentOptions): Agent.Agent;
declare function Agent(
callback: Agent.AgentCallback,
opts?: Agent.AgentOptions
): Agent.Agent;
export = Agent;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"agent-base-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -22,7 +22,7 @@ declare module 'angular' {
* This is an experimental technology
* Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/badge
*/
badge?: USVString;
badge?: string;
/**
* The data read-only property of the Notification interface returns a structured clone of the notification's data,
@@ -40,7 +40,7 @@ declare module 'angular' {
* Note: This feature is available in Web Workers.
* Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/image
*/
image?: USVString;
image?: string;
/**
* The renotify read-only property of the Notification interface specifies whether the user should be notified after a
+4 -3
View File
@@ -731,11 +731,12 @@ function test_angular_forEach() {
this.push(`${key}: ${value}`);
}, log);
// expect(log).toEqual(['name: misko', 'gender: male']);
// $ExpectType NodeListOf<HTMLImageElement>
angular.forEach(document.getElementsByTagName('img'), (value, key, obj) => {
// TODO: Set minimum version to ts3.1 where this is always HTMLCollectionOf
type Collection = NodeListOf<HTMLImageElement> | HTMLCollectionOf<HTMLImageElement>;
const collection: Collection = angular.forEach(document.getElementsByTagName('img'), (value, key, obj) => {
value; // $ExpectType HTMLImageElement
key; // $ExpectType number
obj; // $ExpectType NodeListOf<HTMLImageElement>
const collection: Collection = obj;
});
// $ExpectType number[]
angular.forEach([1, 2, 3], (value, key, obj) => {
+10
View File
@@ -96,3 +96,13 @@ console.log(
RETURN u
`.toArray()
);
const view = db._view("yolo")!;
view.properties({
locale: "C",
commit: {
consolidate: {
bytes: { segmentThreshold: 20 }
}
}
});
+66 -9
View File
@@ -837,11 +837,68 @@ declare namespace ArangoDB {
// Views
interface View {
// TODO
[key: string]: any;
interface ArangoSearchView {
_dbName: string;
_id: string;
name(): string;
type(): ViewType;
rename(newName: string): void;
properties(
newProperties?: ArangoSearchViewPropertiesOptions
): ArangoSearchViewProperties;
}
interface ArangoSearchViewConsolidate {
threshold: number;
segmentThreshold: number;
}
interface ArangoSearchViewCollectionLink {
analyzers?: string[];
fields?: { [key: string]: ArangoSearchViewCollectionLink | undefined };
includeAllFields?: boolean;
trackListPositions?: boolean;
storeValues?: "none" | "id";
}
interface ArangoSearchViewProperties {
id: string;
name: string;
type: "arangosearch";
commit: {
cleanupIntervalStep: number;
commitIntervalMsec: number;
consolidate: {
bytes?: ArangoSearchViewConsolidate;
bytes_accum?: ArangoSearchViewConsolidate;
count?: ArangoSearchViewConsolidate;
fill?: ArangoSearchViewConsolidate;
};
};
locale: string;
links: {
[key: string]: ArangoSearchViewCollectionLink | undefined;
};
}
interface ArangoSearchViewPropertiesOptions {
locale?: string;
commit?: {
consolidate?:
| "none"
| {
count?: Partial<ArangoSearchViewConsolidate>;
bytes?: Partial<ArangoSearchViewConsolidate>;
bytes_accum?: Partial<ArangoSearchViewConsolidate>;
fill?: Partial<ArangoSearchViewConsolidate>;
};
commitIntervalMsec?: number;
cleanupIntervalStep?: number;
};
links?: {
[key: string]: ArangoSearchViewCollectionLink | undefined;
};
}
type ViewProperties = object; // TODO
// Global
@@ -923,13 +980,13 @@ declare namespace ArangoDB {
): DocumentMetadata;
// Views
_view(name: string): View | null;
_views(): View[];
_view(name: string): ArangoSearchView | null;
_views(): ArangoSearchView[];
_createView(
name: string,
type: ViewType,
properties: ViewProperties
): View;
properties: ArangoSearchViewPropertiesOptions
): ArangoSearchView;
_dropView(name: string): void;
// Global
@@ -1392,7 +1449,7 @@ declare module "@arangodb/foxx/router" {
}
declare module "@arangodb/foxx/graphql" {
import { GraphQLSchema, formatError } from "graphql";
import { formatError, GraphQLSchema } from "graphql";
type GraphQLModule = object;
type GraphQLFormatErrorFunction = typeof formatError;
interface GraphQLOptions {
+45 -22
View File
@@ -741,7 +741,7 @@ context.fail(error);
context.fail(str);
/* Handler */
let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
const handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
/* In node8.10 runtime, handlers may return a promise for the result value, so existing async
* handlers that return Promise<void> before calling the callback will now have a `null` result.
@@ -749,7 +749,7 @@ let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AW
* since the upgrade effort should be pretty low in most cases, and it points them at a nicer solution.
*/
// $ExpectError
let legacyAsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
const legacyAsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
event: AWSLambda.APIGatewayProxyEvent,
context: AWSLambda.Context,
cb: AWSLambda.Callback<AWSLambda.APIGatewayProxyResult>,
@@ -757,7 +757,7 @@ let legacyAsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
cb(null, { statusCode: 200, body: 'No longer valid' });
};
let node8AsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
const node8AsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
event: AWSLambda.APIGatewayProxyEvent,
context: AWSLambda.Context,
cb: AWSLambda.Callback<AWSLambda.APIGatewayProxyResult>,
@@ -765,7 +765,7 @@ let node8AsyncHandler: AWSLambda.APIGatewayProxyHandler = async (
return { statusCode: 200, body: 'Is now valid!' };
};
let inferredHandler: AWSLambda.S3Handler = (event, context, cb) => {
const inferredHandler: AWSLambda.S3Handler = (event, context, cb) => {
// $ExpectType S3Event
event;
str = event.Records[0].eventName;
@@ -782,35 +782,35 @@ let inferredHandler: AWSLambda.S3Handler = (event, context, cb) => {
};
// Test using default Callback type still works.
let defaultCallbackHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
const defaultCallbackHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { };
// Specific types
let s3Handler: AWSLambda.S3Handler = (event: AWSLambda.S3Event, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
// Test old name
let s3CreateHandler: AWSLambda.S3Handler = (event: AWSLambda.S3CreateEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const s3CreateHandler: AWSLambda.S3Handler = (event: AWSLambda.S3CreateEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
s3Handler = s3CreateHandler;
let dynamoDBStreamHandler: AWSLambda.DynamoDBStreamHandler = (event: AWSLambda.DynamoDBStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const dynamoDBStreamHandler: AWSLambda.DynamoDBStreamHandler = (event: AWSLambda.DynamoDBStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let snsHandler: AWSLambda.SNSHandler = (event: AWSLambda.SNSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const snsHandler: AWSLambda.SNSHandler = (event: AWSLambda.SNSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let cognitoUserPoolHandler: AWSLambda.CognitoUserPoolTriggerHandler = (event: AWSLambda.CognitoUserPoolEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const cognitoUserPoolHandler: AWSLambda.CognitoUserPoolTriggerHandler = (event: AWSLambda.CognitoUserPoolEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let cloudFormationCustomResourceHandler: AWSLambda.CloudFormationCustomResourceHandler =
const cloudFormationCustomResourceHandler: AWSLambda.CloudFormationCustomResourceHandler =
(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let cloudWatchLogsHandler: AWSLambda.CloudWatchLogsHandler = (event: AWSLambda.CloudWatchLogsEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const cloudWatchLogsHandler: AWSLambda.CloudWatchLogsHandler = (event: AWSLambda.CloudWatchLogsEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let scheduledHandler: AWSLambda.ScheduledHandler = (event: AWSLambda.ScheduledEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const scheduledHandler: AWSLambda.ScheduledHandler = (event: AWSLambda.ScheduledEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayProxyEvent, context: AWSLambda.Context, cb: AWSLambda.APIGatewayProxyCallback) => { };
// Test old names
let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
const proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { };
apiGtwProxyHandler = proxyHandler;
let codePipelineHandler: AWSLambda.CodePipelineHandler = (event: AWSLambda.CodePipelineEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
const codePipelineHandler: AWSLambda.CodePipelineHandler = (event: AWSLambda.CodePipelineEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => {};
let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => {
const cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => {
cb();
cb(null);
cb(new Error(''));
@@ -820,14 +820,14 @@ let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLa
cb(null, { });
};
let cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { };
const cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { };
let customAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { };
const customAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { };
interface CustomEvent { eventString: string; eventBool: boolean; }
interface CustomResult { resultString: string; resultBool?: boolean; }
type CustomCallback = AWSLambda.Callback<CustomResult>;
let customHandler: AWSLambda.Handler<CustomEvent, CustomResult> = (event, context, cb) => {
const customHandler: AWSLambda.Handler<CustomEvent, CustomResult> = (event, context, cb) => {
// $ExpectType CustomEvent
event;
str = event.eventString;
@@ -841,9 +841,9 @@ let customHandler: AWSLambda.Handler<CustomEvent, CustomResult> = (event, contex
cb(null, { resultString: bool });
};
let kinesisStreamHandler: AWSLambda.KinesisStreamHandler = (event: AWSLambda.KinesisStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => { };
const kinesisStreamHandler: AWSLambda.KinesisStreamHandler = (event: AWSLambda.KinesisStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => { };
let SQSMessageHandler: AWSLambda.SQSHandler = (event: AWSLambda.SQSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => { };
const SQSMessageHandler: AWSLambda.SQSHandler = (event: AWSLambda.SQSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback<void>) => { };
// See https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-sqs
const SQSEvent: AWSLambda.SQSEvent = {
@@ -867,7 +867,7 @@ const SQSEvent: AWSLambda.SQSEvent = {
]
};
let SQSMessageLegacyAsyncHandler: AWSLambda.SQSHandler = async (
const SQSMessageLegacyAsyncHandler: AWSLambda.SQSHandler = async (
event: AWSLambda.SQSEvent,
context: AWSLambda.Context,
cb: AWSLambda.Callback<void>,
@@ -886,7 +886,7 @@ let SQSMessageLegacyAsyncHandler: AWSLambda.SQSHandler = async (
cb(new Error());
};
let SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async (
const SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async (
event: AWSLambda.SQSEvent,
context: AWSLambda.Context
) => {
@@ -899,3 +899,26 @@ let SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async (
str = context.functionName;
return;
};
const firehoseEventHandler: AWSLambda.FirehoseTransformationHandler = (
event: AWSLambda.FirehoseTransformationEvent,
context: AWSLambda.Context,
callback: AWSLambda.FirehoseTransformationCallback
) => {
// $ExpectType FirehoseTransformationEvent
event;
str = event.records[0].recordId;
// $ExpectType Context
context;
str = context.functionName;
callback(null, {
records: [
{
recordId: event.records[0].recordId,
result: 'Ok' as AWSLambda.FirehoseRecordTransformationStatus,
data: 'eyJmb28iOiJiYXIifQ==',
}
]
});
};
+73 -30
View File
@@ -20,6 +20,7 @@
// Aneil Mallavarapu <https://github.com/aneilbaboo>
// Jeremy Nagel <https://github.com/jeznag>
// Louis Larry <https://github.com/louislarry>
// Daniel Papukchiev <https://github.com/dpapukchiev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -212,27 +213,27 @@ export type S3CreateEvent = S3Event; // old name
export interface CognitoUserPoolTriggerEvent {
version: number;
triggerSource:
| "PreSignUp_SignUp"
| "PostConfirmation_ConfirmSignUp"
| "PreAuthentication_Authentication"
| "PostAuthentication_Authentication"
| "CustomMessage_SignUp"
| "CustomMessage_AdminCreateUser"
| "CustomMessage_ResendCode"
| "CustomMessage_ForgotPassword"
| "CustomMessage_UpdateUserAttribute"
| "CustomMessage_VerifyUserAttribute"
| "CustomMessage_Authentication"
| "DefineAuthChallenge_Authentication"
| "CreateAuthChallenge_Authentication"
| "VerifyAuthChallengeResponse_Authentication"
| "PreSignUp_AdminCreateUser"
| "PostConfirmation_ConfirmForgotPassword"
| "TokenGeneration_HostedAuth"
| "TokenGeneration_Authentication"
| "TokenGeneration_NewPasswordChallenge"
| "TokenGeneration_AuthenticateDevice"
| "TokenGeneration_RefreshTokens";
| "PreSignUp_SignUp"
| "PostConfirmation_ConfirmSignUp"
| "PreAuthentication_Authentication"
| "PostAuthentication_Authentication"
| "CustomMessage_SignUp"
| "CustomMessage_AdminCreateUser"
| "CustomMessage_ResendCode"
| "CustomMessage_ForgotPassword"
| "CustomMessage_UpdateUserAttribute"
| "CustomMessage_VerifyUserAttribute"
| "CustomMessage_Authentication"
| "DefineAuthChallenge_Authentication"
| "CreateAuthChallenge_Authentication"
| "VerifyAuthChallengeResponse_Authentication"
| "PreSignUp_AdminCreateUser"
| "PostConfirmation_ConfirmForgotPassword"
| "TokenGeneration_HostedAuth"
| "TokenGeneration_Authentication"
| "TokenGeneration_NewPasswordChallenge"
| "TokenGeneration_AuthenticateDevice"
| "TokenGeneration_RefreshTokens";
region: string;
userPoolId: string;
userName?: string;
@@ -241,8 +242,8 @@ export interface CognitoUserPoolTriggerEvent {
clientId: string;
};
request: {
userAttributes: {[key: string]: string};
validationData?: {[key: string]: string};
userAttributes: { [key: string]: string };
validationData?: { [key: string]: string };
codeParameter?: string;
usernameParameter?: string;
newDeviceUsed?: boolean;
@@ -252,8 +253,8 @@ export interface CognitoUserPoolTriggerEvent {
challengeMetaData?: string;
}>;
challengeName?: string;
privateChallengeParameters?: {[key: string]: string};
challengeAnswer?: {[key: string]: string};
privateChallengeParameters?: { [key: string]: string };
challengeAnswer?: { [key: string]: string };
};
response: {
autoConfirmUser?: boolean;
@@ -263,8 +264,8 @@ export interface CognitoUserPoolTriggerEvent {
challengeName?: string;
issueTokens?: boolean;
failAuthentication?: boolean;
publicChallengeParameters?: {[key: string]: string};
privateChallengeParameters?: {[key: string]: string};
publicChallengeParameters?: { [key: string]: string };
privateChallengeParameters?: { [key: string]: string };
challengeMetaData?: string;
answerCorrect?: boolean;
};
@@ -550,7 +551,7 @@ export interface CodePipelineEvent {
inputArtifacts: Artifact[];
outputArtifacts: Artifact[];
artifactCredentials: Credentials;
encryptionKey?: EncryptionKey & {type: 'KMS'};
encryptionKey?: EncryptionKey & { type: 'KMS' };
continuationToken?: string;
};
};
@@ -645,6 +646,47 @@ export interface KinesisStreamEvent {
Records: KinesisStreamRecord[];
}
// Kinesis Data Firehose Event
// https://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-kinesis-firehose
// https://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html
// https://aws.amazon.com/blogs/compute/amazon-kinesis-firehose-data-transformation-with-aws-lambda/
// Examples in the lambda blueprints
export interface FirehoseTransformationEvent {
invocationId: string;
deliveryStreamArn: string;
region: string;
records: FirehoseTransformationEventRecord[];
}
export interface FirehoseTransformationEventRecord {
recordId: string;
approximateArrivalTimestamp: number;
/** Base64 encoded */
data: string;
kinesisRecordMetadata?: FirehoseRecordMetadata;
}
export interface FirehoseRecordMetadata {
shardId: string;
partitionKey: string;
approximateArrivalTimestamp: string;
sequenceNumber: string;
subsequenceNumber: string;
}
export type FirehoseRecordTransformationStatus = 'Ok' | 'Dropped' | 'ProcessingFailed';
export interface FirehoseTransformationResultRecord {
recordId: string;
result: FirehoseRecordTransformationStatus;
/** Encode in Base64 */
data: string;
}
export interface FirehoseTransformationResult {
records: FirehoseTransformationResultRecord[];
}
// SQS
// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-sqs
export interface SQSRecord {
@@ -657,7 +699,7 @@ export interface SQSRecord {
eventSource: string;
eventSourceARN: string;
awsRegion: string;
}
}
export interface SQSEvent {
Records: SQSRecord[];
@@ -757,7 +799,8 @@ export type CloudFrontResponseCallback = Callback<CloudFrontResponseResult>;
export type KinesisStreamHandler = Handler<KinesisStreamEvent, void>;
// TODO: Kinesis Firehose
export type FirehoseTransformationCallback = Callback<FirehoseTransformationResult>;
export type FirehoseTransformationHandler = Handler<FirehoseTransformationEvent, FirehoseTransformationResult>;
export type CustomAuthorizerHandler = Handler<CustomAuthorizerEvent, CustomAuthorizerResult>;
export type CustomAuthorizerCallback = Callback<CustomAuthorizerResult>;
+3 -3
View File
@@ -10,10 +10,10 @@ import { GeneratorOptions } from "@babel/generator";
import traverse, { Visitor, NodePath } from "@babel/traverse";
import template from "@babel/template";
import * as t from "@babel/types";
import { BabylonOptions } from "babylon";
import { ParseOptions } from "@babel/parser";
export {
BabylonOptions,
ParseOptions,
GeneratorOptions,
t as types,
template,
@@ -217,7 +217,7 @@ export interface TransformOptions {
*
* Default: `{}`
*/
parserOpts?: BabylonOptions | null;
parserOpts?: ParseOptions | null;
/**
* List of plugins to load and use
+3
View File
@@ -22,6 +22,9 @@
"@babel/generator": [
"babel__generator"
],
"@babel/parser": [
"babel__parser"
],
"@babel/template": [
"babel__template"
],
@@ -135,6 +135,15 @@ class MyView extends Marionette.View<MyModel> {
}
}
class MyOtherView extends MyView {
private readonly foo: string;
constructor(model: MyModel) {
super(model);
this.foo = 'bar';
}
}
class MainRegion extends Marionette.Region {
constructor() {
super();
@@ -185,10 +194,20 @@ class MyHtmlElRegion extends Marionette.Region {
}
}
class MyCollectionView extends Marionette.CollectionView<MyModel, MyView> {
class MyCollectionView extends Marionette.CollectionView<MyModel, MyView | MyOtherView> {
constructor() {
super();
this.childView = (model: MyModel) => {
if (model.get('isFoo')) {
return MyView;
}
return MyOtherView;
};
this.childView = MyView;
this.childViewEvents = {
render() {
console.log('a childView has been rendered');
@@ -282,7 +301,7 @@ function CollectionViewTests() {
cv.collection.add(new MyModel());
app.mainRegion.show(cv);
cv.emptyView = MyView;
const view: Marionette.CollectionView<MyModel, MyView> = cv.destroy();
const view: Marionette.CollectionView<MyModel, MyView | MyOtherView> = cv.destroy();
}
class MyController {
+4 -3
View File
@@ -3,7 +3,8 @@
// Definitions by: Zeeshan Hamid <https://github.com/zhamid>,
// Natan Vivo <https://github.com/nvivo>,
// Sven Tschui <https://github.com/sventschui>,
// Volker Nauruhn <https://github.com/razorness>
// Volker Nauruhn <https://github.com/razorness>,
// Ard Timmerman <https://github.com/confususs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -1157,7 +1158,7 @@ export interface CollectionViewOptions<
/**
* Specify a child view to use.
*/
childView?: (() => typeof Backbone.View) | typeof Backbone.View;
childView?: ((model: TModel) => typeof Backbone.View) | typeof Backbone.View;
/**
* Define options to pass to the childView constructor.
@@ -1219,7 +1220,7 @@ export class CollectionView<TModel extends Backbone.Model, TView extends View<TM
/**
* Specify a child view to use.
*/
childView: (() => { new(...args: any[]): TView }) | { new(...args: any[]): TView };
childView: ((model: TModel) => { new(...args: any[]): TView }) | { new(...args: any[]): TView };
/**
* Define options to pass to the childView constructor.
+1 -1
View File
@@ -38,7 +38,7 @@ var tester: BlazyInstance = new Blazy({
/* Functions tests */
tester.revalidate();
var elements = <NodeList>document.getElementsByTagName('img');
var elements = document.getElementsByTagName('img');
tester.load(elements, true);
tester.destroy();
+1 -1
View File
@@ -53,7 +53,7 @@ interface BlazyInstance {
* Forces the given element(s) to load if not collapsed. If you also want to load a collapsed/hidden elements you can add true as the second parameter.
* You can pass a single element or a list of elements. Tested with getElementById, getElementsByClassName, querySelectorAll, querySelector and jQuery selector.
*/
load(elements: Element|Element[]|HTMLElement|HTMLElement[]|NodeList, force: boolean): void;
load(elements: Element|Element[]|HTMLElement|HTMLElement[]|HTMLCollection|NodeList, force: boolean): void;
/**
* Unbind events and resets image array.
+6 -4
View File
@@ -1,3 +1,5 @@
declare let aHtmlElement: HTMLElement;
// --------------------------------------------------------------------------------------
// Alert
// --------------------------------------------------------------------------------------
@@ -78,7 +80,7 @@ $("#collapse").collapse({
});
$("#collapse").collapse({
parent: document.body,
parent: aHtmlElement,
});
$("#collapse").collapse({
@@ -122,11 +124,11 @@ $("#dropdown").dropdown({
});
$("#dropdown").dropdown({
boundary: document.body,
boundary: aHtmlElement,
});
$("#dropdown").dropdown({
reference: document.body,
reference: aHtmlElement,
});
// --------------------------------------------------------------------------------------
@@ -340,5 +342,5 @@ $("#tooltip").tooltip({
});
$("#tooltip").tooltip({
boundary: document.body,
boundary: aHtmlElement,
});
+1 -1
View File
@@ -1,7 +1,7 @@
import Bricks from 'bricks.js';
const bricks = Bricks({
container: document.body.firstChild!,
container: document.body!.firstChild!,
packed: 'packed',
sizes: [
{ columns: 2, gutter: 10 },
+4 -1
View File
@@ -6,7 +6,10 @@ import Redis = require("ioredis");
import Queue = require("bull");
const videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379');
const audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object
const audioQueue = new Queue('audio transcoding', {
redis: {port: 6379, host: '127.0.0.1'}, // Specify Redis connection using object
settings: {},
});
const imageQueue: Queue.Queue<{ image: string }> = new Queue('image transcoding');
videoQueue.process((job, done) => {
+1 -1
View File
@@ -88,7 +88,7 @@ declare namespace Bull {
/**
* Define a custom backoff strategy
*/
backoffStrategies: {
backoffStrategies?: {
[key: string]: (attemptsMade: number, err: typeof Error) => number;
};
}
+1 -1
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
+1 -1
View File
@@ -3593,7 +3593,7 @@ declare namespace Cesium {
cull?: boolean;
asynchronous?: boolean;
debugShowBoundingVolume?: boolean;
shadows: ShadowMode
shadows?: ShadowMode
});
destroy(): void;
getGeometryInstanceAttributes(id: any): any;
+1 -1
View File
@@ -1,4 +1,4 @@
clipboard.copy("Hello World");
clipboard.copy(document.body).then(() => console.log("success"));
clipboard.copy(document.body!).then(() => console.log("success"));
clipboard.paste().then(val => console.log(val));
+6
View File
@@ -14,6 +14,12 @@ const cb5 = new ClipboardJS(".btn", {
action: elem => "copy",
target: elem => null
});
const cb6 = new ClipboardJS(".btn", {
action: elem => "copy",
text: trigger => trigger.getAttribute('aria-label'),
target: trigger => trigger.nextElementSibling,
container: document.getElementById('modal')
});
cb1.destroy();
ClipboardJS.isSupported();
+8
View File
@@ -49,6 +49,14 @@ declare namespace ClipboardJS {
* @returns Text to be copied.
*/
text?(elem: Element): string;
/**
* For use in Bootstrap Modals or with any
* other library that changes the focus
* you'll want to set the focused element
* as the container value.
*/
container?: Element;
}
interface Event {
+5
View File
@@ -31,6 +31,11 @@ bucket.manager().createPrimaryIndex(function() {
});
});
// Ensure bucket.upsert is composable with normal callbacks
function composable(callback: (err?: Error) => void) {
bucket.upsert('key', {value: 1}, callback);
}
// From https://developer.couchbase.com/documentation/server/current/sdk/nodejs/n1ql-queries-with-sdk.html
function n1ql_a() {
const n1qlquery = N1qlQuery.fromString('SELECT name, email FROM users WHERE name=$1');
+2 -2
View File
@@ -2019,10 +2019,10 @@ declare namespace Bucket {
*/
interface OpCallback {
/**
* @param error The error for the operation. This can either be an Error object or a value which evaluates to false (null, undefined, 0 or false).
* @param error The error for the operation. This can either be an Error object or a value which evaluates to false.
* @param result The result of the operation that was executed. This usually contains at least a cas property, and on some operations will contain a value property as well.
*/
(error: CouchbaseError | number, result: any): void;
(error: CouchbaseError | null, result: any): void;
}
/**
+2 -2
View File
@@ -252,7 +252,7 @@ declare namespace Domain {
/**
* @param data is the command data
* @callback callback is optional, if not defined as function argument you can throw errors or return errors here (sync way)
* @param callback is optional, if not defined as function argument you can throw errors or return errors here (sync way)
*/
type preLoadConditionHandler = (data: any, callback?: (err: string | Error) => string | Error) => void | string | Error;
@@ -295,7 +295,7 @@ declare namespace Domain {
/**
* @param data is the command data
* @param aggregate is the aggregate object
* @callback callback is optional, if not defined as function argument you can throw errors or return errors here (sync way)
* @param callback is optional, if not defined as function argument you can throw errors or return errors here (sync way)
*/
type preConditionHandler = (data: any, aggregate: AggregateModel, callback?: (err: string | Error) => string | Error) => void | string | Error;
+17
View File
@@ -0,0 +1,17 @@
import cssnano = require('cssnano');
import { Transformer } from 'postcss';
const nano1: Transformer = cssnano();
const nano2: Transformer = cssnano({
configFile: '/path/to/config',
});
const nano3: Transformer = cssnano({
preset: 'default',
});
const nano4: Transformer = cssnano({
preset: ['default', {
discardComments: {
removeAll: true,
},
}],
});
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for cssnano 4.0
// Project: https://github.com/cssnano/cssnano
// Definitions by: Armando Meziat <https://github.com/odnamrataizem>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { Plugin } from 'postcss';
declare namespace cssnano {
interface CssNanoOptions {
configFile?: string;
preset?: [string, object] | string;
}
type CssNano = Plugin<CssNanoOptions>;
}
declare const cssnano: cssnano.CssNano;
export = cssnano;
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"postcss": "5 - 7"
}
}
+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",
"cssnano-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4 -4
View File
@@ -47,12 +47,12 @@ undef = dispatch.on('unknown') as undefined;
dispatch.on('bar', dispatch.on('bar')!);
dispatch.call('foo');
dispatch.call('foo', document.body);
dispatch.call('foo', document.body, { a: 3, b: 'test' }, 1);
dispatch.call('foo', document.body!);
dispatch.call('foo', document.body!, { a: 3, b: 'test' }, 1);
dispatch.apply('bar');
dispatch.apply('bar', document.body);
dispatch.apply('bar', document.body, [{ a: 3, b: 'test' }, 1]);
dispatch.apply('bar', document.body!);
dispatch.apply('bar', document.body!, [{ a: 3, b: 'test' }, 1]);
dispatch.on('bar', null);
+8 -7
View File
@@ -189,6 +189,10 @@ stratificatorizer = d3Hierarchy.stratify<TabularHierarchyDatum>();
// id(...)
stratificatorizer = stratificatorizer.id((d) => {
return d.name; // d is of type TabularHierarchyDatum
});
stratificatorizer = stratificatorizer.id((d, i, data) => {
console.log('Length of tabular array: ', data.length);
console.log('Name of first entry in tabular array: ', data[0].name); // data of type Array<TabularHierarchyDatum>
@@ -199,6 +203,10 @@ idStringAccessor = stratificatorizer.id();
// parentId(...)
stratificatorizer = stratificatorizer.parentId((d) => {
return d.parentId; // d is of type TabularHierarchyDatum
});
stratificatorizer = stratificatorizer.parentId((d, i, data) => {
console.log('Length of tabular array: ', data.length);
console.log('Name of first entry in tabular array: ', data[0].name); // data of type Array<TabularHierarchyDatum>
@@ -225,14 +233,12 @@ clusterLayout = d3Hierarchy.cluster<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
clusterLayout = clusterLayout.size(null);
clusterLayout = clusterLayout.size([200, 200]);
size = clusterLayout.size();
// nodeSize() ------------------------------------------------------------
clusterLayout = clusterLayout.nodeSize(null);
clusterLayout = clusterLayout.nodeSize([10, 10]);
size = clusterLayout.nodeSize();
@@ -358,14 +364,12 @@ treeLayout = d3Hierarchy.tree<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
treeLayout = treeLayout.size(null);
treeLayout = treeLayout.size([200, 200]);
size = treeLayout.size();
// nodeSize() ------------------------------------------------------------
treeLayout = treeLayout.nodeSize(null);
treeLayout = treeLayout.nodeSize([10, 10]);
size = treeLayout.nodeSize();
@@ -416,7 +420,6 @@ tilingFn = treemapLayout.tile();
// size() ----------------------------------------------------------------
treemapLayout = treemapLayout.size(null);
treemapLayout = treemapLayout.size([400, 200]);
size = treemapLayout.size();
@@ -635,7 +638,6 @@ partitionLayout = d3Hierarchy.partition<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
partitionLayout = partitionLayout.size(null);
partitionLayout = partitionLayout.size([400, 200]);
size = partitionLayout.size();
@@ -674,7 +676,6 @@ packLayout = d3Hierarchy.pack<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
packLayout = packLayout.size(null);
packLayout = packLayout.size([400, 400]);
size = packLayout.size();
+626 -98
View File
@@ -1,65 +1,208 @@
// Type definitions for D3JS d3-hierarchy module 1.1
// Project: https://github.com/d3/d3-hierarchy/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.1.1
// Last module patch version validated against: 1.1.6
// -----------------------------------------------------------------------
// Hierarchy
// -----------------------------------------------------------------------
export interface HierarchyLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyNode<Datum>;
}
export interface HierarchyNode<Datum> {
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyNode<Datum> | null;
children?: Array<HierarchyNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* The associated data, as specified to the constructor.
*/
data: Datum;
/**
* Zero for the root node, and increasing by one for each descendant generation.
*/
readonly depth: number;
/**
* Zero for leaf nodes, and the greatest distance from any descendant leaf for internal nodes.
*/
readonly height: number;
/**
* The parent node, or null for the root node.
*/
parent: this | null;
/**
* An array of child nodes, if any; undefined for leaf nodes.
*/
children?: this[];
/**
* Aggregated numeric value as calculated by `sum(value)` or `count()`, if previously invoked.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
* Optional node id string set by `StratifyOperator`, if hierarchical data was created from tabular data using stratify().
*/
readonly id?: string;
ancestors(): Array<HierarchyNode<Datum>>;
descendants(): Array<HierarchyNode<Datum>>;
leaves(): Array<HierarchyNode<Datum>>;
path(target: HierarchyNode<Datum>): Array<HierarchyNode<Datum>>;
/**
* Returns the array of ancestors nodes, starting with this node, then followed by each parent up to the root.
*/
ancestors(): this[];
/**
* Returns the array of descendant nodes, starting with this node, then followed by each child in topological order.
*/
descendants(): this[];
/**
* Returns the array of leaf nodes in traversal order; leaves are nodes with no children.
*/
leaves(): this[];
/**
* Returns the shortest path through the hierarchy from this node to the specified target node.
* The path starts at this node, ascends to the least common ancestor of this node and the target node, and then descends to the target node.
*
* @param target The target node.
*/
path(target: this): this[];
/**
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
links(): Array<HierarchyLink<Datum>>;
/**
* Evaluates the specified value function for this node and each descendant in post-order traversal, and returns this node.
* The `node.value` property of each node is set to the numeric value returned by the specified function plus the combined value of all descendants.
*
* @param value The value function is passed the node’s data, and must return a non-negative number.
*/
sum(value: (d: Datum) => number): this;
/**
* Computes the number of leaves under this node and assigns it to `node.value`, and similarly for every descendant of node.
* If this node is a leaf, its count is one. Returns this node.
*/
count(): this;
sort(compare: (a: HierarchyNode<Datum>, b: HierarchyNode<Datum>) => number): this;
each(func: (node: HierarchyNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyNode<Datum>) => void): this;
copy(): HierarchyNode<Datum>;
/**
* Sorts the children of this node, if any, and each of this node’s descendants’ children,
* in pre-order traversal using the specified compare function, and returns this node.
*
* @param compare The compare function is passed two nodes a and b to compare.
* If a should be before b, the function must return a value less than zero;
* if b should be before a, the function must return a value greater than zero;
* otherwise, the relative order of a and b are not specified. See `array.sort` for more.
*/
sort(compare: (a: this, b: this) => number): this;
/**
* Invokes the specified function for node and each descendant in breadth-first order,
* such that a given node is only visited if all nodes of lesser depth have already been visited,
* as well as all preceding nodes of the same depth.
*
* @param func The specified function is passed the current node.
*/
each(func: (node: this) => void): this;
/**
* Invokes the specified function for node and each descendant in post-order traversal,
* such that a given node is only visited after all of its descendants have already been visited.
*
* @param func The specified function is passed the current node.
*/
eachAfter(func: (node: this) => void): this;
/**
* Invokes the specified function for node and each descendant in pre-order traversal,
* such that a given node is only visited after all of its ancestors have already been visited.
*
* @param func The specified function is passed the current node.
*/
eachBefore(func: (node: this) => void): this;
/**
* Return a deep copy of the subtree starting at this node. The returned deep copy shares the same data, however.
* The returned node is the root of a new tree; the returned node’s parent is always null and its depth is always zero.
*/
copy(): this;
}
/**
* Constructs a root node from the specified hierarchical data.
*
* @param data The root specified data.
* @param children The specified children accessor function invoked for each datum, starting with the root data.
* Must return an array of data representing the children, and return null or undefined if the current datum has no children.
* If children is not specified, it defaults to: `(d) => d.children`.
*/
export function hierarchy<Datum>(data: Datum, children?: (d: Datum) => (Datum[] | null)): HierarchyNode<Datum>;
// -----------------------------------------------------------------------
// Stratify
// -----------------------------------------------------------------------
// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is referring to the element on node, it should be 'parent'?
export interface StratifyOperator<Datum> {
/**
* Generates a new hierarchy from the specified tabular data. Each node in the returned object has a shallow copy of the properties
* from the corresponding data object, excluding the following reserved properties: id, parentId, children.
*
* @param data The root specified data.
* @throws Error on missing id, ambiguous id, cycle, multiple roots or no root.
*/
(data: Datum[]): HierarchyNode<Datum>;
/**
* Returns the current id accessor, which defaults to: `(d) => d.id`.
*/
id(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined);
/**
* Sets the id accessor to the given function.
* The id accessor is invoked for each element in the input data passed to the stratify operator.
* The returned string is then used to identify the node's relationships in conjunction with the parent id.
* For leaf nodes, the id may be undefined, null or the empty string; otherwise, the id must be unique.
*
* @param id The id accessor.
*/
id(id: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this;
/**
* Returns the current parent id accessor, which defaults to: `(d) => d.parentId`.
*/
parentId(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined);
/**
* Sets the parent id accessor to the given function.
* The parent id accessor is invoked for each element in the input data passed to the stratify operator.
* The returned string is then used to identify the node's relationships in conjunction with the id.
* For the root node, the parent id should be undefined, null or the empty string.
* There must be exactly one root node in the input data, and no circular relationships.
*
* @param parentId The parent id accessor.
*/
parentId(parentId: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this;
}
/**
* Constructs a new stratify operator with the default settings.
*/
export function stratify<Datum>(): StratifyOperator<Datum>;
// -----------------------------------------------------------------------
@@ -67,52 +210,86 @@ export function stratify<Datum>(): StratifyOperator<Datum>;
// -----------------------------------------------------------------------
export interface HierarchyPointLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyPointNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyPointNode<Datum>;
}
export interface HierarchyPointNode<Datum> {
export interface HierarchyPointNode<Datum> extends HierarchyNode<Datum> {
/**
* The x-coordinate of the node.
*/
x: number;
/**
* The y-coordinate of the node.
*/
y: number;
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyPointNode<Datum> | null;
children?: Array<HierarchyPointNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
*/
readonly id?: string;
ancestors(): Array<HierarchyPointNode<Datum>>;
descendants(): Array<HierarchyPointNode<Datum>>;
leaves(): Array<HierarchyPointNode<Datum>>;
path(target: HierarchyPointNode<Datum>): Array<HierarchyPointNode<Datum>>;
links(): Array<HierarchyPointLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
each(func: (node: HierarchyPointNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyPointNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyPointNode<Datum>) => void): this;
copy(): HierarchyPointNode<Datum>;
}
export interface ClusterLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You may want to call `root.sort` before passing the hierarchy to the cluster layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyPointNode<Datum>;
/**
* Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.
*/
size(): [number, number] | null;
/**
* Sets this cluster layout’s size to the specified [width, height] array and returns the cluster layout.
* The size represent an arbitrary coordinate system; for example, to produce a radial layout,
* a size of [360, radius] corresponds to a breadth of 360° and a depth of radius.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.
*/
nodeSize(): [number, number] | null;
/**
* Sets this cluster layout’s node size to the specified [width, height] array and returns this cluster layout.
* When a node size is specified, the root node is always positioned at <0, 0>.
*
* @param size The specified two-element size array.
*/
nodeSize(size: [number, number]): this;
/**
* Returns the current separation accessor, which defaults to: `(a, b) => a.parent == b.parent ? 1 : 2`.
*/
separation(): (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number;
/**
* Sets the separation accessor to the specified function and returns this cluster layout.
* The separation accessor is used to separate neighboring leaves.
*
* @param separation The separation function is passed two leaves a and b, and must return the desired separation.
* The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent.
*/
separation(separation: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
}
/**
* Creates a new cluster layout with default settings.
*/
export function cluster<Datum>(): ClusterLayout<Datum>;
// -----------------------------------------------------------------------
@@ -120,15 +297,56 @@ export function cluster<Datum>(): ClusterLayout<Datum>;
// -----------------------------------------------------------------------
export interface TreeLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You may want to call `root.sort` before passing the hierarchy to the tree layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyPointNode<Datum>;
/**
* Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.
*/
size(): [number, number] | null;
/**
* Sets this tree layout’s size to the specified [width, height] array and returns the tree layout.
* The size represent an arbitrary coordinate system; for example, to produce a radial layout,
* a size of [360, radius] corresponds to a breadth of 360° and a depth of radius.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.
*/
nodeSize(): [number, number] | null;
/**
* Sets this tree layout’s node size to the specified [width, height] array and returns this tree layout.
* When a node size is specified, the root node is always positioned at <0, 0>.
*
* @param size The specified two-element size array.
*/
nodeSize(size: [number, number]): this;
/**
* Returns the current separation accessor, which defaults to: `(a, b) => a.parent == b.parent ? 1 : 2`.
*/
separation(): (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number;
/**
* Sets the separation accessor to the specified function and returns this tree layout.
* The separation accessor is used to separate neighboring nodes.
*
* @param separation The separation function is passed two nodes a and b, and must return the desired separation.
* The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent.
*/
separation(separation: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
}
/**
* Creates a new tree layout with default settings.
*/
export function tree<Datum>(): TreeLayout<Datum>;
// -----------------------------------------------------------------------
@@ -136,91 +354,283 @@ export function tree<Datum>(): TreeLayout<Datum>;
// -----------------------------------------------------------------------
export interface HierarchyRectangularLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyRectangularNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyRectangularNode<Datum>;
}
export interface HierarchyRectangularNode<Datum> {
export interface HierarchyRectangularNode<Datum> extends HierarchyNode<Datum> {
/**
* The left edge of the rectangle.
*/
x0: number;
/**
* The top edge of the rectangle
*/
y0: number;
/**
* The right edge of the rectangle.
*/
x1: number;
/**
* The bottom edge of the rectangle.
*/
y1: number;
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyRectangularNode<Datum> | null;
children?: Array<HierarchyRectangularNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
*/
readonly id?: string;
ancestors(): Array<HierarchyRectangularNode<Datum>>;
descendants(): Array<HierarchyRectangularNode<Datum>>;
leaves(): Array<HierarchyRectangularNode<Datum>>;
path(target: HierarchyRectangularNode<Datum>): Array<HierarchyRectangularNode<Datum>>;
links(): Array<HierarchyRectangularLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyRectangularNode<Datum>, b: HierarchyRectangularNode<Datum>) => number): this;
each(func: (node: HierarchyRectangularNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyRectangularNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyRectangularNode<Datum>) => void): this;
copy(): HierarchyRectangularNode<Datum>;
}
export interface TreemapLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You must call `root.sum` before passing the hierarchy to the treemap layout.
* You probably also want to call `root.sort` to order the hierarchy before computing the layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyRectangularNode<Datum>;
/**
* Returns the current tiling method, which defaults to `d3.treemapSquarify` with the golden ratio.
*/
tile(): (node: HierarchyRectangularNode<Datum>, x0: number, y0: number, x1: number, y1: number) => void;
/**
* Sets the tiling method to the specified function and returns this treemap layout.
*
* @param tile The specified tiling function.
*/
tile(tile: (node: HierarchyRectangularNode<Datum>, x0: number, y0: number, x1: number, y1: number) => void): this;
/**
* Returns the current size, which defaults to [1, 1].
*/
size(): [number, number];
/**
* Sets this treemap layout’s size to the specified [width, height] array and returns this treemap layout.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current rounding state, which defaults to false.
*/
round(): boolean;
/**
* Enables or disables rounding according to the given boolean and returns this treemap layout.
*
* @param round The specified boolean flag.
*/
round(round: boolean): this;
/**
* Returns the current inner padding function.
*/
padding(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the inner and outer padding to the specified number and returns this treemap layout.
*
* @param padding The specified padding value.
*/
padding(padding: number): this;
/**
* Sets the inner and outer padding to the specified function and returns this treemap layout.
*
* @param padding The specified padding function.
*/
padding(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current inner padding function, which defaults to the constant zero.
*/
paddingInner(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the inner padding to the specified number and returns this treemap layout.
* The inner padding is used to separate a node’s adjacent children.
*
* @param padding The specified inner padding value.
*/
paddingInner(padding: number): this;
/**
* Sets the inner padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The inner padding is used to separate a node’s adjacent children.
*
* @param padding The specified inner padding function.
*/
paddingInner(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current top padding function.
*/
paddingOuter(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the top, right, bottom and left padding to the specified function and returns this treemap layout.
*
* @param padding The specified padding outer value.
*/
paddingOuter(padding: number): this;
/**
* Sets the top, right, bottom and left padding to the specified function and returns this treemap layout.
*
* @param padding The specified padding outer function.
*/
paddingOuter(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current top padding function, which defaults to the constant zero.
*/
paddingTop(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the top padding to the specified number and returns this treemap layout.
* The top padding is used to separate the top edge of a node from its children.
*
* @param padding The specified top padding value.
*/
paddingTop(padding: number): this;
/**
* Sets the top padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The top padding is used to separate the top edge of a node from its children.
*
* @param padding The specified top padding function.
*/
paddingTop(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current right padding function, which defaults to the constant zero.
*/
paddingRight(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the right padding to the specified number and returns this treemap layout.
* The right padding is used to separate the right edge of a node from its children.
*
* @param padding The specified right padding value.
*/
paddingRight(padding: number): this;
/**
* Sets the right padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The right padding is used to separate the right edge of a node from its children.
*
* @param padding The specified right padding function.
*/
paddingRight(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current bottom padding function, which defaults to the constant zero.
*/
paddingBottom(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the bottom padding to the specified number and returns this treemap layout.
* The bottom padding is used to separate the bottom edge of a node from its children.
*
* @param padding The specified bottom padding value.
*/
paddingBottom(padding: number): this;
/**
* Sets the bottom padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The bottom padding is used to separate the bottom edge of a node from its children.
*
* @param padding The specified bottom padding function.
*/
paddingBottom(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current left padding function, which defaults to the constant zero.
*/
paddingLeft(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the left padding to the specified number and returns this treemap layout.
* The left padding is used to separate the left edge of a node from its children.
*
* @param padding The specified left padding value.
*/
paddingLeft(padding: number): this;
/**
* Sets the left padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The left padding is used to separate the left edge of a node from its children.
*
* @param padding The specified left padding function.
*/
paddingLeft(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
}
/**
* Creates a new treemap layout with default settings.
*/
export function treemap<Datum>(): TreemapLayout<Datum>;
// Tiling functions ---------------------------------------------------------------------------------
// Tiling functions -----------------------------------------------------------------------
/**
* Recursively partitions the specified nodes into an approximately-balanced binary tree,
* choosing horizontal partitioning for wide rectangles and vertical partitioning for tall rectangles.
*/
export function treemapBinary(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* Divides the rectangular area specified by x0, y0, x1, y1 horizontally according the value of each of the specified node’s children.
* The children are positioned in order, starting with the left edge (x0) of the given rectangle.
* If the sum of the children’s values is less than the specified node’s value (i.e., if the specified node has a non-zero internal value),
* the remaining empty space will be positioned on the right edge (x1) of the given rectangle.
*/
export function treemapDice(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* Divides the rectangular area specified by x0, y0, x1, y1 vertically according the value of each of the specified node’s children.
* The children are positioned in order, starting with the top edge (y0) of the given rectangle.
* If the sum of the children’s values is less than the specified node’s value (i.e., if the specified node has a non-zero internal value),
* the remaining empty space will be positioned on the bottom edge (y1) of the given rectangle.
*/
export function treemapSlice(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* If the specified node has odd depth, delegates to treemapSlice; otherwise delegates to treemapDice.
*/
export function treemapSliceDice(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
// TODO: Test Factory code
export interface RatioSquarifyTilingFactory {
(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* Specifies the desired aspect ratio of the generated rectangles.
* Note that the orientation of the generated rectangles (tall or wide) is not implied by the ratio.
* Furthermore, the rectangles ratio are not guaranteed to have the exact specified aspect ratio.
* If not specified, the aspect ratio defaults to the golden ratio, φ = (1 + sqrt(5)) / 2, per Kong et al.
*
* @param ratio The specified ratio value greater than or equal to one.
*/
ratio(ratio: number): RatioSquarifyTilingFactory;
}
/**
* Implements the squarified treemap algorithm by Bruls et al., which seeks to produce rectangles of a given aspect ratio.
*/
export const treemapSquarify: RatioSquarifyTilingFactory;
/**
* Like `d3.treemapSquarify`, except preserves the topology (node adjacencies) of the previous layout computed by `d3.treemapResquarify`,
* if there is one and it used the same target aspect ratio. This tiling method is good for animating changes to treemaps because
* it only changes node sizes and not their relative positions, thus avoiding distracting shuffling and occlusion.
* The downside of a stable update, however, is a suboptimal layout for subsequent updates: only the first layout uses the Bruls et al. squarified algorithm.
*/
export const treemapResquarify: RatioSquarifyTilingFactory;
// -----------------------------------------------------------------------
@@ -228,15 +638,53 @@ export const treemapResquarify: RatioSquarifyTilingFactory;
// -----------------------------------------------------------------------
export interface PartitionLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You must call `root.sum` before passing the hierarchy to the partition layout.
* You probably also want to call `root.sort` to order the hierarchy before computing the layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyRectangularNode<Datum>;
/**
* Returns the current size, which defaults to [1, 1].
*/
size(): [number, number];
/**
* Sets this partition layout’s size to the specified [width, height] array and returns this partition layout.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current rounding state, which defaults to false.
*/
round(): boolean;
/**
* Enables or disables rounding according to the given boolean and returns this partition layout.
*
* @param round The specified boolean flag.
*/
round(round: boolean): this;
/**
* Returns the current padding, which defaults to zero.
*/
padding(): number;
/**
* Sets the padding to the specified number and returns this partition layout.
* The padding is used to separate a node’s adjacent children.
*
* @param padding The specified padding value.
*/
padding(padding: number): this;
}
/**
* Creates a new partition layout with the default settings.
*/
export function partition<Datum>(): PartitionLayout<Datum>;
// -----------------------------------------------------------------------
@@ -244,54 +692,110 @@ export function partition<Datum>(): PartitionLayout<Datum>;
// -----------------------------------------------------------------------
export interface HierarchyCircularLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyCircularNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyCircularNode<Datum>;
}
export interface HierarchyCircularNode<Datum> {
export interface HierarchyCircularNode<Datum> extends HierarchyNode<Datum> {
/**
* The x-coordinate of the circle’s center.
*/
x: number;
/**
* The y-coordinate of the circle’s center.
*/
y: number;
/**
* The radius of the circle.
*/
r: number;
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyCircularNode<Datum> | null;
children?: Array<HierarchyCircularNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
*/
readonly id?: string;
ancestors(): Array<HierarchyCircularNode<Datum>>;
descendants(): Array<HierarchyCircularNode<Datum>>;
leaves(): Array<HierarchyCircularNode<Datum>>;
path(target: HierarchyCircularNode<Datum>): Array<HierarchyCircularNode<Datum>>;
links(): Array<HierarchyCircularLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyCircularNode<Datum>, b: HierarchyCircularNode<Datum>) => number): this;
each(func: (node: HierarchyCircularNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyCircularNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyCircularNode<Datum>) => void): this;
copy(): HierarchyCircularNode<Datum>;
}
export interface PackLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You must call `root.sum` before passing the hierarchy to the pack layout.
* You probably also want to call `root.sort` to order the hierarchy before computing the layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyCircularNode<Datum>;
/**
* Returns the current radius accessor, which defaults to null.
*/
radius(): null | ((node: HierarchyCircularNode<Datum>) => number);
/**
* Sets the pack layout’s radius accessor to the specified function and returns this pack layout.
* If the radius accessor is null, the radius of each leaf circle is derived from the leaf `node.value` (computed by `node.sum`);
* the radii are then scaled proportionally to fit the layout size.
* If the radius accessor is not null, the radius of each leaf circle is specified exactly by the function.
*
* @param radius The specified radius accessor.
*/
radius(radius: (node: HierarchyCircularNode<Datum>) => number): this;
/**
* Returns the current size, which defaults to [1, 1].
*/
size(): [number, number];
/**
* Sets this pack layout’s size to the specified [width, height] array and returns this pack layout.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current padding accessor, which defaults to the constant zero.
*/
padding(): (node: HierarchyCircularNode<Datum>) => number;
/**
* Sets this pack layout’s padding accessor to the specified number and returns this pack layout.
* Returns the current padding accessor, which defaults to the constant zero.
*
* When siblings are packed, tangent siblings will be separated by approximately the specified padding;
* the enclosing parent circle will also be separated from its children by approximately the specified padding.
* If an explicit radius is not specified, the padding is approximate because a two-pass algorithm
* is needed to fit within the layout size: the circles are first packed without padding;
* a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding.
*
* @param padding The specified padding value.
*/
padding(padding: number): this;
/**
* Sets this pack layout’s padding accessor to the specified function and returns this pack layout.
* Returns the current padding accessor, which defaults to the constant zero.
*
* When siblings are packed, tangent siblings will be separated by approximately the specified padding;
* the enclosing parent circle will also be separated from its children by approximately the specified padding.
* If an explicit radius is not specified, the padding is approximate because a two-pass algorithm
* is needed to fit within the layout size: the circles are first packed without padding;
* a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding.
*
* @param padding The specified padding function.
*/
padding(padding: (node: HierarchyCircularNode<Datum>) => number): this;
}
/**
* Creates a new pack layout with the default settings.
*/
export function pack<Datum>(): PackLayout<Datum>;
// -----------------------------------------------------------------------
@@ -299,8 +803,19 @@ export function pack<Datum>(): PackLayout<Datum>;
// -----------------------------------------------------------------------
export interface PackCircle {
/**
* The radius of the circle.
*/
r: number;
/**
* The x-coordinate of the circle’s center.
*/
x?: number;
/**
* The y-coordinate of the circle’s center.
*/
y?: number;
}
@@ -309,6 +824,19 @@ export interface PackCircle {
// For invocation of packEnclose the x and y coordinates are mandatory. It seems easier to just comment
// on the mandatory nature, then to create separate interfaces and having to deal with recasting.
/**
* Packs the specified array of circles, each of which must have a `circle.r` property specifying the circle’s radius.
* The circles are positioned according to the front-chain packing algorithm by Wang et al.
*
* @param circles The specified array of circles to pack.
*/
export function packSiblings<Datum extends PackCircle>(circles: Datum[]): Datum[];
/**
* Computes the smallest circle that encloses the specified array of circles, each of which must have
* a `circle.r` property specifying the circle’s radius, and `circle.x` and `circle.y` properties specifying the circle’s center.
* The enclosing circle is computed using the Matoušek-Sharir-Welzl algorithm. (See also Apollonius’ Problem.)
*
* @param circles The specified array of circles to pack.
*/
export function packEnclose<Datum extends PackCircle>(circles: Datum[]): { r: number, x: number, y: number };
+4 -4
View File
@@ -24,7 +24,7 @@
})
}
let render = createApp(document.body)
let render = createApp(document.body!)
function main(state: any){
let vnode = view(state, (action: any) => main({ count: 0 }))
@@ -43,7 +43,7 @@
return element('div', { class: `size-${ props.size }` })
}
const render = createApp(document.body)
const render = createApp(document.body!)
render(element(App, { size: 'small' }))
@@ -82,11 +82,11 @@
(function (){
const { createApp, element } = deku
let render: Function = createApp(document.body)
let render: Function = createApp(document.body!)
render(element('div'))
render = createApp(document.body, (action: any) => {
render = createApp(document.body!, (action: any) => {
render(element('div'))
})
+3
View File
@@ -0,0 +1,3 @@
import isNode = require("detect-node");
isNode;
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for detect-node 2.0
// Project: https://github.com/iliakan/detect-node
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
declare const isNode: boolean;
export = isNode;
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "detect-node-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -7,6 +7,6 @@ download(new Blob(['hello world']), 'dlTextBlob.txt', 'text/plain');
download('/robots.txt');
download(document.documentElement.outerHTML, 'dlHTML.html', 'text/html');
download(document.documentElement!.outerHTML, 'dlHTML.html', 'text/html');
download(new Blob(['hello world'.bold()]), 'dlHtmlBlob.html', 'text/html');
download('/diff6.png');
+49 -3
View File
@@ -328,11 +328,11 @@ declare module 'ember' {
*/
resolveRegistration(fullName: string): Function;
/**
* Registers a factory that can be used for dependency injection (with
* Registers a factory or value that can be used for dependency injection (with
* `inject`) or for service lookup. Each factory is registered with
* a full name including two parts: `type:name`.
*/
register(fullName: string, factory: Function, options?: { singleton?: boolean, instantiate?: boolean }): any;
register(fullName: string, factory: any, options?: { singleton?: boolean, instantiate?: boolean }): any;
/**
* Unregister a factory.
*/
@@ -3372,7 +3372,48 @@ declare module 'ember' {
/**
* The Router service is the public API that provides component/view layer access to the router.
*/
class RouterService extends Ember.Service {
export class RouterService extends Ember.Service {
//
/**
Name of the current route.
This property represent the logical name of the route,
which is comma separated.
For the following router:
```app/router.js
Router.map(function() {
this.route('about');
this.route('blog', function () {
this.route('post', { path: ':post_id' });
});
});
```
It will return:
* `index` when you visit `/`
* `about` when you visit `/about`
* `blog.index` when you visit `/blog`
* `blog.post` when you visit `/blog/some-post-id`
*/
readonly currentRouteName: string;
//
/**
Current URL for the application.
This property represent the URL path for this route.
For the following router:
```app/router.js
Router.map(function() {
this.route('about');
this.route('blog', function () {
this.route('post', { path: ':post_id' });
});
});
```
It will return:
* `/` when you visit `/`
* `/about` when you visit `/about`
* `/blog` when you visit `/blog`
* `/blog/some-post-id` when you visit `/blog/some-post-id`
*/
readonly currentURL: string;
//
/**
* Determines whether a route is active.
@@ -3776,6 +3817,11 @@ declare module '@ember/routing/router' {
export default class EmberRouter extends Ember.Router { }
}
declare module '@ember/routing/router-service' {
import { RouterService } from 'ember';
export default class extends RouterService { }
}
declare module '@ember/runloop' {
import Ember from 'ember';
export const begin: typeof Ember.run.begin;
+3
View File
@@ -1,4 +1,5 @@
import ApplicationInstance from '@ember/application/instance';
import hbs from 'htmlbars-inline-precompile';
const appInstance = ApplicationInstance.create();
appInstance.register('some:injection', class Foo {});
@@ -11,6 +12,8 @@ appInstance.register('some:injection', class Foo {}, {
instantiate: false,
});
appInstance.register('templates:foo/bar', hbs`<h1>Hello World</h1>`);
appInstance.register('some:injection', class Foo {}, {
singleton: false,
instantiate: true,
+7
View File
@@ -1,4 +1,5 @@
import Ember from 'ember';
import { assertType } from './lib/assert';
const AppRouter = Ember.Router.extend({
});
@@ -25,6 +26,12 @@ AppRouter.map(function() {
const RouterServiceConsumer = Ember.Service.extend({
router: Ember.inject.service('router'),
currentRouteName() {
const x: string = Ember.get(this, 'router').currentRouteName;
},
currentURL() {
const x: string = Ember.get(this, 'router').currentURL;
},
transitionWithoutModel() {
Ember.get(this, 'router')
.transitionTo('some-route');
@@ -0,0 +1,7 @@
import ErrorSubclass from 'error-subclass';
class ExampleError extends ErrorSubclass {
static displayName = 'ExampleError';
}
throw new ExampleError('Something went wrong!');
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for error-subclass 2.2
// Project: https://github.com/spudly/error-subclass#readme
// Definitions by: Fitbit <https://github.com/fitbit>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export default class ErrorSubclass extends Error {
static displayName: string;
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"error-subclass-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3
View File
@@ -10,5 +10,8 @@ wifi.startAP('ssid', { password: 'pass', authMode: 'wpa_wpa2' }, err => {
console.log("created");
});
digitalWrite(D2, false);
digitalWrite(D2, true);
I2C1.setup({ scl: D4, sda: D0 });
Serial2.setup(9600, { rx: D16, tx: D17 });
+1 -1
View File
@@ -3600,7 +3600,7 @@ declare function digitalPulse(pin: Pin, value: boolean, time: any): void;
* @param value
* @url http://www.espruino.com/Reference#l__global_digitalWrite
*/
declare function digitalWrite(pin: Pin, value: number): void;
declare function digitalWrite(pin: Pin, value: number | boolean): void;
/**
* <p>Get the digital value of the given pin.</p>
@@ -0,0 +1,3 @@
import * as lw from "eth-lightwallet";
lw.keystore.createVault({});
+64
View File
@@ -0,0 +1,64 @@
// Type definitions for eth-lightwallet 3.0
// Project: https://github.com/ConsenSys/eth-lightwallet#readme
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
export interface ECSignatureBuffer {
v: number;
r: Buffer;
s: Buffer;
}
export namespace signing {
function signTx(
keystore: keystore,
pwDerivedKey: Uint8Array,
rawTx: string,
signingAddress: string
): string;
function signMsg(
keystore: keystore,
pwDerivedKey: Uint8Array,
rawMsg: string,
signingAddress: string
): ECSignatureBuffer;
function signMsgHash(
keystore: keystore,
pwDerivedKey: Uint8Array,
msgHash: string,
signingAddress: string
): ECSignatureBuffer;
function concatSig(signature: any): string;
}
export class keystore {
static createVault(
options: any,
callback?: (error: Error, keystore: keystore) => void
): keystore;
static generateRandomSeed(): string;
static isSeedValid(seed: string): boolean;
static deserialize(keystore: string): keystore;
serialize(): string;
keyFromPassword(
password: string,
callback?: (error: Error, pwDerivedKey: Uint8Array) => void
): Uint8Array;
isDerivedKeyCorrect(pwDerivedKey: Uint8Array): boolean;
generateNewAddress(
pwDerivedKey: Uint8Array,
numberOfAddresses: number
): void;
getSeed(pwDerivedKey: Uint8Array): string;
exportPrivateKey(address: string, pwDerivedKey: Uint8Array): string;
getAddresses(): string[];
}
export interface VaultOptions {
password: string;
seedPhrase: string;
salt?: string;
hdPathString: string;
}
+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",
"eth-lightwallet-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+95
View File
@@ -0,0 +1,95 @@
import figlet = require('figlet');
figlet('abc', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet('My World', '1Row', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
// $ExpectError
figlet('fweGWEPewfe', 'What is the font? I cannot get it');
// $ExpectError
figlet('qweoqw');
// $ExpectError
figlet('qweoqw', '1Row');
// $ExpectError
figlet('qweoqw', '1Row', undefined as any, undefined as any);
figlet.text('tokiyo tomare', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet.text('Hi', 'Flower Power', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet.text('Annyeong', {
font: 'Fun Face',
horizontalLayout: 'full',
verticalLayout: 'fitted',
}, (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet.text('Oreehe', {
font: 'Fun Face',
// $ExpectError
value: 'abc',
}, undefined as any);
// $ExpectError
figlet.text('It cannot make sense');
// $ExpectType string
figlet.textSync('test text');
// $ExpectType string
figlet.textSync('text desu', 'Fuzzy');
// $ExpectType string
figlet.textSync('oho', {
font: 'Invita',
});
// $ExpectError
figlet.textSync();
figlet.metadata('JS Block Letters', (err, fontOptions, headerComment) => {
// $ExpectType Error | null
err;
// $ExpectType FontOptions | undefined
fontOptions;
// $ExpectType string | undefined
headerComment;
});
// $ExpectError
figlet.metadata('This is random font name which cannot make sense', undefined as any);
// $ExpectError
figlet.metadata('Alligator', undefined as any, undefined as any);
// $ExpectType Defaults
figlet.defaults();
// $ExpectType Defaults
figlet.defaults({});
// $ExpectType Defaults
figlet.defaults({
font: 'Patorjk\'s Cheese'
});
figlet.fonts((err, fonts) => {
// $ExpectType Error | null
err;
// $ExpectType Fonts[] | undefined
fonts;
});
// $ExpectType Fonts[]
figlet.fontsSync();
+406
View File
@@ -0,0 +1,406 @@
// Type definitions for figlet 1.2
// Project: https://github.com/patorjk/figlet.js
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
declare namespace figlet {
type Fonts =
| '1Row'
| '3-D'
| '3D Diagonal'
| '3D-ASCII'
| '3x5'
| '4Max'
| '5 Line Oblique'
| 'AMC 3 Line'
| 'AMC 3 Liv1'
| 'AMC AAA01'
| 'AMC Neko'
| 'AMC Razor'
| 'AMC Razor2'
| 'AMC Slash'
| 'AMC Slider'
| 'AMC Thin'
| 'AMC Tubes'
| 'AMC Untitled'
| 'ANSI Shadow'
| 'ASCII New Roman'
| 'Acrobatic'
| 'Alligator'
| 'Alligator2'
| 'Alpha'
| 'Alphabet'
| 'Arrows'
| 'Avatar'
| 'B1FF'
| 'B1FF'
| 'Banner'
| 'Banner3-D'
| 'Banner3'
| 'Banner4'
| 'Barbwire'
| 'Basic'
| 'Bear'
| 'Bell'
| 'Benjamin'
| 'Big Chief'
| 'Big Money-ne'
| 'Big Money-nw'
| 'Big Money-se'
| 'Big Money-sw'
| 'Big'
| 'Bigfig'
| 'Binary'
| 'Block'
| 'Blocks'
| 'Bloody'
| 'Bolger'
| 'Braced'
| 'Bright'
| 'Broadway KB'
| 'Broadway'
| 'Bubble'
| 'Bulbhead'
| 'Caligraphy'
| 'Caligraphy2'
| 'Calvin S'
| 'Cards'
| 'Catwalk'
| 'Chiseled'
| 'Chunky'
| 'Coinstak'
| 'Cola'
| 'Colossal'
| 'Computer'
| 'Contessa'
| 'Contrast'
| 'Cosmike'
| 'Crawford'
| 'Crawford2'
| 'Crazy'
| 'Cricket'
| 'Cursive'
| 'Cyberlarge'
| 'Cybermedium'
| 'Cybersmall'
| 'Cygnet'
| 'DANC4'
| 'DOS Rebel'
| 'DWhistled'
| 'Dancing Font'
| 'Decimal'
| 'Def Leppard'
| 'Delta Corps Priest 1'
| 'Diamond'
| 'Diet Cola'
| 'Digital'
| 'Doh'
| 'Doom'
| 'Dot Matrix'
| 'Double Shorts'
| 'Double'
| 'Dr Pepper'
| 'Efti Chess'
| 'Efti Font'
| 'Efti Italic'
| 'Efti Piti'
| 'Efti Robot'
| 'Efti Wall'
| 'Efti Water'
| 'Electronic'
| 'Elite'
| 'Epic'
| 'Fender'
| 'Filter'
| 'Fire Font-k'
| 'Fire Font-s'
| 'Flipped'
| 'Flower Power'
| 'Four Tops'
| 'Fraktur'
| 'Fun Face'
| 'Fun Faces'
| 'Fuzzy'
| 'Georgi16'
| 'Georgia11'
| 'Ghost'
| 'Ghoulish'
| 'Glenyn'
| 'Goofy'
| 'Gothic'
| 'Graceful'
| 'Gradient'
| 'Graffiti'
| 'Greek'
| 'Heart Left'
| 'Heart Right'
| 'Henry 3D'
| 'Hex'
| 'Hieroglyphs'
| 'Hollywood'
| 'Horizontal Left'
| 'Horizontal Right'
| 'ICL-1900'
| 'Impossible'
| 'Invita'
| 'Isometric1'
| 'Isometric2'
| 'Isometric3'
| 'Isometric4'
| 'Italic'
| 'Ivrit'
| 'JS Block Letters'
| 'JS Bracket Letters'
| 'JS Capital Curves'
| 'JS Cursive'
| 'JS Stick Letters'
| 'Jacky'
| 'Jazmine'
| 'Jerusalem'
| 'Katakana'
| 'Kban'
| 'Keyboard'
| 'Knob'
| 'Konto Slant'
| 'Konto'
| 'LCD'
| 'Larry 3D 2'
| 'Larry 3D'
| 'Lean'
| 'Letters'
| 'Lil Devil'
| 'Line Blocks'
| 'Linux'
| 'Lockergnome'
| 'Madrid'
| 'Marquee'
| 'Maxfour'
| 'Merlin1'
| 'Merlin2'
| 'Mike'
| 'Mini'
| 'Mirror'
| 'Mnemonic'
| 'Modular'
| 'Morse'
| 'Morse2'
| 'Moscow'
| 'Mshebrew210'
| 'Muzzle'
| 'NScript'
| 'NT Greek'
| 'NV Script'
| 'Nancyj-Fancy'
| 'Nancyj-Improved'
| 'Nancyj-Underlined'
| 'Nancyj'
| 'Nipples'
| 'O8'
| 'OS2'
| 'Octal'
| 'Ogre'
| 'Old Banner'
| 'Patorjk\'s Cheese'
| 'Patorjk-HeX'
| 'Pawp'
| 'Peaks Slant'
| 'Peaks'
| 'Pebbles'
| 'Pepper'
| 'Poison'
| 'Puffy'
| 'Puzzle'
| 'Pyramid'
| 'Rammstein'
| 'Rectangles'
| 'Red Phoenix'
| 'Relief'
| 'Relief2'
| 'Reverse'
| 'Roman'
| 'Rot13'
| 'Rot13'
| 'Rotated'
| 'Rounded'
| 'Rowan Cap'
| 'Rozzo'
| 'Runic'
| 'Runyc'
| 'S Blood'
| 'SL Script'
| 'Santa Clara'
| 'Script'
| 'Serifcap'
| 'Shadow'
| 'Shimrod'
| 'Short'
| 'Slant Relief'
| 'Slant'
| 'Slide'
| 'Small Caps'
| 'Small Isometric1'
| 'Small Keyboard'
| 'Small Poison'
| 'Small Script'
| 'Small Shadow'
| 'Small Slant'
| 'Small Tengwar'
| 'Small'
| 'Soft'
| 'Speed'
| 'Spliff'
| 'Stacey'
| 'Stampate'
| 'Stampatello'
| 'Standard'
| 'Star Strips'
| 'Star Wars'
| 'Stellar'
| 'Stforek'
| 'Stick Letters'
| 'Stop'
| 'Straight'
| 'Stronger Than All'
| 'Sub-Zero'
| 'Swamp Land'
| 'Swan'
| 'Sweet'
| 'THIS'
| 'Tanja'
| 'Tengwar'
| 'Term'
| 'Test1'
| 'The Edge'
| 'Thick'
| 'Thin'
| 'Thorned'
| 'Three Point'
| 'Ticks Slant'
| 'Ticks'
| 'Tiles'
| 'Tinker-Toy'
| 'Tombstone'
| 'Train'
| 'Trek'
| 'Tsalagi'
| 'Tubular'
| 'Twisted'
| 'Two Point'
| 'USA Flag'
| 'Univers'
| 'Varsity'
| 'Wavy'
| 'Weird'
| 'Wet Letter'
| 'Whimsy'
| 'Wow'
;
type KerningMethods =
| 'default'
| 'full'
| 'fitted'
| 'controlled smushing'
| 'universal smushing'
;
type PrintDirection = number;
interface FittingRules {
vLayout: number;
vRule5: boolean;
vRule4: boolean;
vRule3: boolean;
vRule2: boolean;
vRule1: boolean;
hLayout: number;
hRule6: boolean;
hRule5: boolean;
hRule4: boolean;
hRule3: boolean;
hRule2: boolean;
hRule1: boolean;
}
interface Options {
font?: Fonts;
horizontalLayout?: KerningMethods;
verticalLayout?: KerningMethods;
printDirection?: PrintDirection;
showHardBlanks?: boolean;
}
interface FontOptions {
hardBlank: string;
height: number;
baseline: number;
maxLength: number;
oldLayout: number;
numCommentLines: number;
printDirection: PrintDirection;
fullLayout: number | null;
codeTagCount: number | null;
fittingRules: FittingRules;
}
interface Defaults {
font: Fonts;
fontPath: string;
}
function text(txt: string, cb: (error: Error | null, result?: string) => void): void;
function text(txt: string, font: Fonts, cb: (error: Error | null, result?: string) => void): void;
/**
* @desc
* This `unified-signatures` is disabled because `Fonts` type is too long
*/
// tslint:disable-next-line: unified-signatures
function text(txt: string, options: Options | undefined, cb: (error: Error | null, result?: string) => void): void;
function textSync(txt: string, font?: Fonts): string;
/**
* @desc
* This `unified-signatures` is disabled because `Fonts` type is too long
*/
// tslint:disable-next-line: unified-signatures
function textSync(txt: string, options: Options): string;
function metadata(font: Fonts, cb: (error: Error | null, fontOptions?: FontOptions, headerComment?: string) => void): void;
function defaults(opt?: Partial<Defaults>): Defaults;
function loadFont(font: Fonts, cb: (error: Error | null, fontOptions?: FontOptions) => void): void;
/**
* @todo
* Use 'node' namespace to add following methods only in node environment.
*/
/**
* @warn
* This method works in node environment only.
* In browser environment, this method does not work.
*/
function loadFontSync(font: Fonts): FontOptions;
/**
* @warn
* This method exists in node environment only.
* In browser environment, this method does not exist.
*/
function fonts(cb: (error: Error | null, fontList?: Fonts[]) => void): void;
/**
* @warn
* This method exists in node environment only.
* In browser environment, this method does not exist.
*/
function fontsSync(): Fonts[];
}
declare function figlet(txt: string, cb: (error: Error | null, result?: string) => void): void;
declare function figlet(txt: string, font: figlet.Fonts, cb: (error: Error | null, result?: string) => void): void;
/**
* @desc
* This `unified-signatures` is disabled because `Fonts` type is too long
*/
// tslint:disable-next-line: unified-signatures
declare function figlet(txt: string, options: figlet.Options | undefined, cb: (error: Error | null, result?: string) => void): void;
export as namespace figlet;
export = figlet;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"figlet-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+6 -6
View File
@@ -16,9 +16,9 @@ find.file(regexPattern, rootDir, (dirs: string[]): void => { }).error(errorCb);
find.fileSync(rootDir); // $ExpectType string[]
find.fileSync(stringPattern, rootDir); // $ExpectType string[]
find.fileSync(regexPattern, rootDir); // $ExpectType string[]
find.eachFile(rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachFile(stringPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachFile(regexPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachfile(rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachfile(stringPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachfile(regexPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.dir(stringPattern, rootDir, (dirs: string[]): void => { }).error(emptyCb); // $ExpectType void
find.dir(stringPattern, rootDir, (dirs: string[]): void => { }).error(errorCb); // $ExpectType void
@@ -27,6 +27,6 @@ find.dir(rootDir, (dirs: string[]): void => { }).error(errorCb); // $ExpectType
find.dirSync(rootDir); // $ExpectType string[]
find.dirSync(stringPattern, rootDir); // $ExpectType string[]
find.dirSync(regexPattern, rootDir); // $ExpectType string[]
find.eachDir(rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachDir(stringPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachDir(regexPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachdir(rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachdir(stringPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
find.eachdir(regexPattern, rootDir, singleStringCb).end(emptyCb).error(errorCb).end(emptyCb); // $ExpectType FindEachStream
+4 -4
View File
@@ -45,7 +45,7 @@ export function file(pattern: string | RegExp, root: string, callback: (files: s
* @param root The root directory
* @param callback A callback that accepts each file separately
*/
export function eachFile(root: string, callback: (file: string) => void): FindEachStream;
export function eachfile(root: string, callback: (file: string) => void): FindEachStream;
/**
* Find all files that match a glob pattern in a given directory asynchronously.
@@ -53,7 +53,7 @@ export function eachFile(root: string, callback: (file: string) => void): FindEa
* @param root The root directory
* @param callback A callback that accepts an array of the found files
*/
export function eachFile(pattern: string | RegExp, root: string, callback: (file: string) => void): FindEachStream;
export function eachfile(pattern: string | RegExp, root: string, callback: (file: string) => void): FindEachStream;
/**
* Find all files in a given directory synchronously.
@@ -105,7 +105,7 @@ export function dirSync(pattern: string | RegExp, root: string): string[];
* @param root The root directory
* @param callback A callback that accepts each of the found directories separately
*/
export function eachDir(root: string, callback: (directory: string) => void): FindEachStream;
export function eachdir(root: string, callback: (directory: string) => void): FindEachStream;
/**
* Find all directories that match a glob pattern in a given directory asynchronously.
@@ -113,4 +113,4 @@ export function eachDir(root: string, callback: (directory: string) => void): Fi
* @param root The root directory
* @param callback A callback that accepts each of the found directories separately
*/
export function eachDir(pattern: string | RegExp, root: string, callback: (directory: string) => void): FindEachStream;
export function eachdir(pattern: string | RegExp, root: string, callback: (directory: string) => void): FindEachStream;
+2
View File
@@ -41,6 +41,8 @@ const opts = {
const pool = genericPool.createPool<Connection>(factory, opts);
pool.start();
pool.use((conn: Connection) => 'test')
.then((result: string) => { });
+1
View File
@@ -17,6 +17,7 @@ export class Pool<T> extends EventEmitter {
max: number;
min: number;
start(): void;
acquire(priority?: number): PromiseLike<T>;
release(resource: T): void;
destroy(resource: T): void;
+1
View File
@@ -79,6 +79,7 @@ outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
outVal = vec2.angle(vec2A, vec2B);
outStr = vec2.str(vec2A);
outBool = vec2.exactEquals(vec2A, vec2B);
outBool = vec2.equals(vec2A, vec2B);
+8
View File
@@ -431,6 +431,14 @@ declare module 'gl-matrix' {
public static forEach(a: Float32Array, stride: number, offset: number, count: number,
fn: (a: vec2 | number[], b: vec2 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Get the angle between two 2D vectors
* @param a The first operand
* @param b The second operand
* @returns The angle in radians
*/
public static angle(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Perform some operation over an array of vec2s.
*
+2
View File
@@ -6,6 +6,8 @@
import ndarray = require("ndarray");
type GLenum = number;
type InputType = ImageData | HTMLCanvasElement | HTMLImageElement | HTMLVideoElement;
interface RawObject {
+8 -3
View File
@@ -1,7 +1,8 @@
// Type definitions for @google-cloud/pubsub 0.18
// Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/pubsub
// Project: https://github.com/googleapis/nodejs-pubsub
// Definitions by: Paul Huynh <https://github.com/pheromonez>
// LunaPg <https://github.com/LunaPg>
// Marco Siviero <https://github.com/msiviero>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -115,11 +116,15 @@ declare namespace PubSub {
interface Publisher {
publish(data: Buffer, callback: Publisher.PublishCallback): void;
publish(data: Buffer, attributes: object, callback: Publisher.PublishCallback): void;
publish(data: Buffer, attributes?: object): Promise<string>;
publish(data: Buffer, attributes: Publisher.Attributes, callback: Publisher.PublishCallback): void;
publish(data: Buffer, attributes?: Publisher.Attributes): Promise<string>;
}
namespace Publisher {
type PublishCallback = (error: Error | null, messageId: string) => void;
interface Attributes {
[key: string]: string | Buffer | ArrayBuffer;
}
}
interface Snapshot {
@@ -0,0 +1,42 @@
import tinycolor = require('tinycolor2');
import gradient = require('gradient-string');
// $ExpectType string
gradient('cyan', 'pink')('Hello world!');
// $ExpectType Gradient
gradient('red', 'green', 'blue');
// $ExpectType Gradient
gradient(['#FF0000', '#00FF00', '#0000FF']);
// $ExpectType Gradient
gradient([
tinycolor('#FFBB65'), // tinycolor object
{r: 0, g: 255, b: 0}, // RGB object
{h: 240, s: 1, v: 1, a: 1}, // HSVa object
'rgb(120, 120, 0)', // RGB CSS string
'gold' // named color
]);
// $ExpectType string
gradient.rainbow('I love gradient-strings!');
// $ExpectType string
gradient('orange', 'yellow').multiline([
" __",
"<(o )___",
" ( ._> /",
" `---'",
].join('\n'));
// $ExpectType string
gradient.atlas.multiline('Multi line\nstring');
// $ExpectType string
gradient('cyan', 'pink').multiline('Multi line\nstring', {interpolation: 'hsv'});
// $ExpectType Gradient
gradient([
{color: '#d8e0de', pos: 0},
{color: '#255B53', pos: 0.8},
{color: '#000000', pos: 1},
]);
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for gradient-string 1.1
// Project: https://github.com/bokub/gradient-string
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
import tinycolor = require('tinycolor2');
declare namespace gradient {
interface PositionedColorInput {
color: tinycolor.ColorInput;
pos: number;
}
interface Gradient {
(message?: string, opt?: Options): string;
multiline(message?: string, opt?: Options): string;
}
interface Options {
interpolation?: string;
hsvSpin?: string;
}
const atlas: Gradient;
const cristal: Gradient;
const teen: Gradient;
const mind: Gradient;
const morning: Gradient;
const vice: Gradient;
const passion: Gradient;
const fruit: Gradient;
const instagram: Gradient;
const retro: Gradient;
const summer: Gradient;
const rainbow: Gradient;
const pastel: Gradient;
}
declare function gradient(colors: tinycolor.ColorInput[] | gradient.PositionedColorInput[]): gradient.Gradient;
declare function gradient(...colors: tinycolor.ColorInput[]): gradient.Gradient;
declare function gradient(...colors: gradient.PositionedColorInput[]): gradient.Gradient;
export = gradient;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gradient-string-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
@@ -0,0 +1,20 @@
import * as GulpImagemin from 'gulp-imagemin';
GulpImagemin();
GulpImagemin([
GulpImagemin.gifsicle({ interlaced: true }),
GulpImagemin.jpegtran({ progressive: true }),
GulpImagemin.optipng({ optimizationLevel: 5 }),
GulpImagemin.svgo({
plugins: [{ removeViewBox: true }, { cleanupIDs: false }]
})
]);
GulpImagemin({ verbose: true });
GulpImagemin([
GulpImagemin.svgo({
plugins: [{ removeViewBox: true }]
})
], { verbose: true });
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for gulp-imagemin 4.1
// Project: https://github.com/sindresorhus/gulp-imagemin#readme
// Definitions by: Romain Faust <https://github.com/romain-faust>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Transform } from 'stream';
declare function imagemin(pluginsOrOptions?: imagemin.Plugin[] | imagemin.Options): Transform;
declare function imagemin(plugins?: imagemin.Plugin[], options?: imagemin.Options): Transform;
declare namespace imagemin {
interface Options {
verbose?: boolean;
}
type Plugin = (input: any) => Promise<any>;
type PluginFactory = (options?: any) => Plugin;
const gifsicle: PluginFactory;
const jpegtran: PluginFactory;
const optipng: PluginFactory;
const svgo: PluginFactory;
}
export = imagemin;
+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",
"gulp-imagemin-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,20 @@
import gulp = require('gulp');
import gulpTemplate = require('gulp-template');
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ a: 'A' }, { sourceURL: 'https://www.example.com' })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ b: 'B' }, { escape: /x/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ c: 'C' }, { evaluate: /y/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ d: 'D' }, { imports: /z/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ e: 'E' }, { interpolate: /w/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ f: 'F' }, { variable: 'some-var' })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate({ g: 'G' }, { badOption: 'some-var' }))); // $ExpectError
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ sourceURL: 'https://www.example.com' })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ escape: /x/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ evaluate: /y/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ imports: /z/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ interpolate: /w/ })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ variable: 'some-var' })));
gulp.task('replace', () => gulp.src('files').pipe(gulpTemplate.precompile({ badOption: 'some-var' }))); // $ExpectError
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for gulp-template 5.0
// Project: https://github.com/sindresorhus/gulp-template#readme
// Definitions by: Peter Safranek <https://github.com/pe8ter>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="node" />
import * as _ from 'lodash';
import * as stream from 'stream';
declare function gulpTemplate(data: any, options: _.TemplateOptions): stream.Transform;
declare namespace gulpTemplate {
function precompile(options: _.TemplateOptions): stream.Transform;
}
export = gulpTemplate;
+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",
"gulp-template-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -451,7 +451,7 @@ export interface Request extends Podium {
* An object where each key is the name assigned by a route pre-handler methods function. The values are the raw values provided to the continuation function as argument. For the wrapped response
* object, use responses.
*/
readonly pre: Util.Dictionary<object>;
readonly pre: Util.Dictionary<any>;
/**
* Access: read / write (see limitations below).
@@ -463,7 +463,7 @@ export interface Request extends Podium {
/**
* Same as pre but represented as the response object created by the pre method.
*/
readonly preResponses: Util.Dictionary<object>;
readonly preResponses: Util.Dictionary<any>;
/**
* By default the object outputted from node's URL parse() method. Might also be set indirectly via request.setUrl in which case it may be a string (if url is set to an object with the query
+8 -7
View File
@@ -1,7 +1,8 @@
// Type definitions for history 4.6.2
// Type definitions for history 4.7.2
// Project: https://github.com/mjackson/history
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>, Young Rok Kim <https://github.com/rokoroku>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export as namespace History;
export type Action = 'PUSH' | 'POP' | 'REPLACE';
@@ -23,24 +24,24 @@ export interface History {
createHref(location: LocationDescriptorObject): Href;
}
export interface Location {
export interface Location<S = LocationState> {
pathname: Pathname;
search: Search;
state: LocationState;
state: S;
hash: Hash;
key?: LocationKey;
}
export interface LocationDescriptorObject {
export interface LocationDescriptorObject<S = LocationState> {
pathname?: Pathname;
search?: Search;
state?: LocationState;
state?: S;
hash?: Hash;
key?: LocationKey;
}
export namespace History {
export type LocationDescriptor = Path | LocationDescriptorObject;
export type LocationDescriptor<S = LocationState> = Path | LocationDescriptorObject<S>;
export type LocationKey = string;
export type LocationListener = (location: Location, action: Action) => void;
export type LocationState = any;
@@ -53,7 +54,7 @@ export namespace History {
export type Href = string;
}
export type LocationDescriptor = History.LocationDescriptor;
export type LocationDescriptor<S = LocationState> = History.LocationDescriptor<S>;
export type LocationKey = History.LocationKey;
export type LocationListener = History.LocationListener;
export type LocationState = History.LocationState;
@@ -0,0 +1,45 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
import hoistNonReactStatics = require('hoist-non-react-statics');
class A extends React.Component<{x: number, y?: number}> {
static a = 'a';
static propTypes = {
m: PropTypes.number.isRequired
};
getA() {
return A.a;
}
}
class B extends React.Component {
static b = 'b';
static propTypes = {
n: PropTypes.number.isRequired
};
getB() {
return B.b;
}
}
const C = hoistNonReactStatics(A, B);
C.a !== C.b;
C.propTypes.m;
C.prototype.getA();
C.propTypes.n; // $ExpectError
C.prototype.getB(); // $ExpectError
<C x={1}/>;
const D = hoistNonReactStatics(A, B, { a: true, b: true });
D.a;
D.b; // $ExpectError
+50
View File
@@ -0,0 +1,50 @@
// Type definitions for hoist-non-react-statics 3.0
// Project: https://github.com/mridgway/hoist-non-react-statics#readme
// Definitions by: JounQin <https://github.com/JounQin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
interface REACT_STATICS {
childContextTypes: true;
contextTypes: true;
defaultProps: true;
displayName: true;
getDefaultProps: true;
getDerivedStateFromProps: true;
mixins: true;
propTypes: true;
type: true;
}
interface KNOWN_STATICS {
name: true;
length: true;
prototype: true;
caller: true;
callee: true;
arguments: true;
arity: true;
}
declare function hoistNonReactStatics<
T extends React.ComponentType<any>,
S extends React.ComponentType<any>,
C extends {
[key: string]: true
} = {}
>(
TargetComponent: T,
SourceComponent: S,
customStatic?: C,
): T &
{
[key in Exclude<
keyof S,
// only extends static properties, exclude instance properties and known react statics
keyof REACT_STATICS | keyof KNOWN_STATICS | keyof C
>]: S[key]
};
export = hoistNonReactStatics;
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
},
"files": [
"index.d.ts",
"hoist-non-react-statics-tests.tsx"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -19,7 +19,7 @@ const options: LngDetector.DetectorOptions = {
cookieDomain: "myDomain",
// optional htmlTag with lang attribute, the default is:
htmlTag: document.documentElement
htmlTag: document.documentElement!
};
i18next.use(LngDetector).init({
+35 -15
View File
@@ -1,4 +1,4 @@
// Type definitions for jQuery File Upload Plugin 5.40.1
// Type definitions for jQuery File Upload Plugin 9.22.0
// Project: https://github.com/blueimp/jQuery-File-Upload
// Definitions by: Rob Alarcon <https://github.com/rob-alarcon/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -6,7 +6,7 @@
/// <reference types="jquery"/>
// Interface options for the plugin
// Interface options for the plugin
interface JQueryFileInputOptions {
/**
@@ -106,8 +106,8 @@ interface JQueryFileInputOptions {
*/
redirectParamName?: string;
// The HTTP request method must be "POST" or "PUT"
type?: string,
// The HTTP request method must be "POST" or "PUT"
type?: string,
/**
* Set the following option to the location of a postMessage window,
@@ -199,7 +199,7 @@ interface JQueryFileInputOptions {
* handlers using jQuery's Deferred callbacks:
* data.submit().done(func).fail(func).always(func);
*/
add?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void;
add?: (e: JQueryEventObject, data: JqueryFileUploadAddObject) => void;
// The plugin options are used as settings object for the ajax calls.
// The following are jQuery ajax settings required for the file uploads:
@@ -209,7 +209,7 @@ interface JQueryFileInputOptions {
cache?: boolean;
timeout?: number;
active?: Function;
progress?: (e: JQueryEventObject, data: JQueryFileUploadProgressObject) => void;
send?: (e: JQueryEventObject, data: JQueryFileUploadProgressObject) => void;
@@ -217,13 +217,13 @@ interface JQueryFileInputOptions {
// Validation
/**
* The maximum allowed file size in bytes.
* Type: integer
* Default: undefined
* Example: 10000000 // 10 MB
* Note: This option has only an effect for browsers supporting the File API.
* @see https://github.com/blueimp/jQuery-File-Upload/wiki/Options#maxfilesize
*/
* The maximum allowed file size in bytes.
* Type: integer
* Default: undefined
* Example: 10000000 // 10 MB
* Note: This option has only an effect for browsers supporting the File API.
* @see https://github.com/blueimp/jQuery-File-Upload/wiki/Options#maxfilesize
*/
maxFileSize?: number;
// Other callbacks:
@@ -243,7 +243,7 @@ interface JQueryFileInputOptions {
chunkfail?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
chunkalways?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
// Others
// Others
url?: string;
files?: any;
@@ -263,6 +263,12 @@ interface JQuery {
fileupload(action: string, message:string, settings: JQueryFileInputOptions | string): JQueryFileUpload;
}
interface JqueryFileUploadEnhancedPromise<T> extends JQueryPromise<T>{
success: JQueryPromise<T>['done'],
error: JQueryPromise<T>['fail'],
complete: JQueryPromise<T>['always'],
}
interface JQuerySupport {
fileInput?: boolean;
}
@@ -275,6 +281,20 @@ interface JQueryFileUploadChangeObject {
originalFiles: File[];
}
interface JqueryFileUploadConvenienceObject {
abort: () => JqueryFileUploadEnhancedPromise<any>;
process: (resolveFunc?: Function, rejectFunc?: Function) => JqueryFileUploadEnhancedPromise<any>;
processing: () => JqueryFileUploadEnhancedPromise<any>;
progress: () => JqueryFileUploadEnhancedPromise<any>;
response: () => JqueryFileUploadEnhancedPromise<any>;
submit<T>(): JqueryFileUploadEnhancedPromise<T>;
state: () => JqueryFileUploadEnhancedPromise<any>;
}
interface JqueryFileUploadAddObject extends JQueryFileUploadChangeObject, JqueryFileUploadConvenienceObject {
paramName?: string | string[];
}
interface JQueryFileUploadProgressAllObject {
loaded?: number;
total?: number;
@@ -304,4 +324,4 @@ interface JQueryFileUploadProgressObject extends JQueryFileInputOptions, JQueryF
}
interface JQueryFileUploadDone extends JQueryFileInputOptions, JQueryFileUploadXhr {
}
}
+15 -15
View File
@@ -10,23 +10,23 @@ gridster-0.1.0.d.ts may be freely distributed under the MIT license.
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/gridster.d.ts
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
@@ -104,7 +104,7 @@ interface GridsterOptions {
* Base widget dimensions in pixels. The first index for the width and the second for the height.
* Default = [400, 225]
**/
widget_base_dimensions?: number[];
widget_base_dimensions?: ('auto'|number)[];
/**
* Add more columns in addition to those that have been calculated.
@@ -292,7 +292,7 @@ interface Gridster {
* @return Returns the instance of the Gridster class.
**/
enable(): Gridster;
/**
* Disables dragging.
* @return Returns the instance of the Gridster class.
@@ -28,6 +28,9 @@ var position = coords.col + coords.row;
options.widget_base_dimensions = [100, 200];
gridster.resize_widget_dimensions(options);
options.widget_base_dimensions = ['auto', 200];
gridster.resize_widget_dimensions(options);
gridster.set_widget_min_size(0, [1, 2]);
function noOptions() {
@@ -48,13 +51,13 @@ function widgetSelectorString() {
};
var grid: Gridster = $('.gridster ul').gridster(opts).data('gridster')
}
}
function withNamespace() {
var grid: Gridster = $('.gridster ul').gridster({
namespace: 'custom-gridster'
}).data('gridster')
}
}
function withStylesheet() {
var grid: Gridster = $('.gridster ul').gridster({
+1 -1
View File
@@ -1,4 +1,4 @@
let $container: JQueryNotifyWidget = $("<div style='display:none' class='noprint'><div></div></div>").appendTo(document.body).notify();
let $container: JQueryNotifyWidget = $("<div style='display:none' class='noprint'><div></div></div>").appendTo(document.body!).notify();
let notification: JQueryNotifyInstance = $container.notify(
"create",
+5 -5
View File
@@ -17,7 +17,7 @@ function test_executing_scripts1() {
</body>`);
// The script will not be executed, by default:
dom.window.document.body.children.length === 1;
dom.window.document.body!.children.length === 1;
}
function test_executing_scripts2() {
@@ -26,14 +26,14 @@ function test_executing_scripts2() {
</body>`, { runScripts: 'dangerously' });
// The script will be executed and modify the DOM:
dom.window.document.body.children.length === 2;
dom.window.document.body!.children.length === 2;
}
function test_executing_scripts3() {
const window = (new JSDOM(``, { runScripts: 'outside-only' })).window;
window.eval(`document.body.innerHTML = "<p>Hello, world!</p>";`);
window.document.body.children.length === 1;
window.document.body!.children.length === 1;
}
function test_virtualConsole() {
@@ -74,7 +74,7 @@ function test_serialize() {
dom.serialize() === '<!DOCTYPE html><html><head></head><body>hello</body></html>';
// Contrast with:
dom.window.document.documentElement.outerHTML === '<html><head></head><body>hello</body></html>';
dom.window.document.documentElement!.outerHTML === '<html><head></head><body>hello</body></html>';
}
function test_nodeLocation() {
@@ -86,7 +86,7 @@ function test_nodeLocation() {
);
const document = dom.window.document;
const bodyEl = document.body; // implicitly created
const bodyEl = document.body!; // implicitly created
const pEl = document.querySelector('p')!;
const textNode = pEl.firstChild!;
const imgEl = document.querySelector('img')!;
+2 -1
View File
@@ -92,9 +92,10 @@ declare abstract class JSON2CSVBase<T> {
* Performs the flattening of a data row recursively
*
* @param {object} dataRow Original JSON object
* @param {string} separator Separator to be used as the flattened field name
* @returns {object} Flattened object
*/
protected flatten(dataRow: T): object;
protected flatten(dataRow: T, separator: string): object;
/**
* Performs the unwind recursively in specified sequence
+2 -1
View File
@@ -80,9 +80,10 @@ declare class JSON2CSVTransform<T> extends Transform { // implements JSON2CSVBas
* Performs the flattening of a data row recursively
*
* @param {object} dataRow Original JSON object
* @param {string} separator Separator to be used as the flattened field name
* @returns {object} Flattened object
*/
protected flatten(dataRow: T): object;
protected flatten(dataRow: T, separator: string): object;
/**
* Performs the unwind recursively in specified sequence
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for json2csv 4.1
// Type definitions for json2csv 4.2
// Project: https://github.com/zemirco/json2csv
// Definitions by: Juanjo Diaz <https://github.com/juanjoDiaz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+2 -2
View File
@@ -76,7 +76,7 @@ class ParserExt extends Parser<ExampleObj> {
s = this.processValue(new Date(), true);
s = this.processValue({}, true);
s = this.processValue([], true);
const flattenedData: object = this.flatten({});
const flattenedData: object = this.flatten({}, '.');
const unwindedData: object[] = this.unwindData([], []);
}
}
@@ -110,7 +110,7 @@ class TransformExt extends Transform<ExampleObj> {
s = this.processValue(new Date(), true);
s = this.processValue({}, true);
s = this.processValue([], true);
const flattenedData: object = this.flatten({});
const flattenedData: object = this.flatten({}, '.');
const unwindedData: object[] = this.unwindData([], []);
}
}
+2 -7
View File
@@ -286,12 +286,6 @@ declare namespace Knex {
(columnName: string): QueryBuilder;
}
interface WhereIn {
(columnName: string, values: Value[]): QueryBuilder;
(columnName: string, callback: QueryCallback): QueryBuilder;
(columnName: string, query: QueryBuilder): QueryBuilder;
}
interface WhereBetween {
(columnName: string, range: [Value, Value]): QueryBuilder;
}
@@ -306,7 +300,8 @@ declare namespace Knex {
}
interface WhereIn {
(columnName: string, values: Value[]): QueryBuilder;
(columnName: string, values: Value[] | QueryBuilder | QueryCallback): QueryBuilder;
(columnNames: string[], values: Value[][] | QueryBuilder | QueryCallback): QueryBuilder;
}
interface GroupBy extends RawQueryBuilder, ColumnNameQueryBuilder {
+22
View File
@@ -1123,3 +1123,25 @@ knex({
table1Id: 'table1.id',
table2Id: 'table2.id'
});
knex('characters')
.select()
.whereIn(['name', 'class'], [['Bar', 'Fighter'], ['Foo', 'Druid']]);
knex('characters')
.select()
.whereIn('name', knex('characters').select('name'));
knex('characters')
.select()
.whereIn(['name', 'class'], knex('characters').select('name', 'class'));
knex('characters')
.select()
.whereIn('name', function() {
this.select('name').from('characters');
});
knex('characters')
.select()
.whereIn(['name', 'class'], function() {
this.select('name', 'class').from('characters');
});

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