Merge remote-tracking branch 'upstream/master' into api-gateway-custom-authorizer-event

This commit is contained in:
KeitaNishimoto
2017-03-28 21:45:09 +09:00
148 changed files with 3420 additions and 1312 deletions
+5 -5
View File
@@ -118,7 +118,7 @@ You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (nee
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/base64-js).
For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
#### Common mistakes
@@ -191,7 +191,7 @@ If you're adding a new major version of a library, you can copy `index.d.ts` to
#### I notice some packages having a `package.json` here.
Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it.
A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/pikaday/package.json).
A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json).
We do not allow other fields, such as `"description"`, to be defined manually.
Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json.
@@ -231,7 +231,7 @@ Before making your change, please create a new subfolder with the current versio
1. Update the relative paths in `tsconfig.json` as well as `tslint.json`.
2. Add path mapping rules to ensure that tests are running against the intended version.
For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/history/v2/tsconfig.json) looks like:
For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) looks like:
```json
{
@@ -250,8 +250,8 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi
```
Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*.
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`;
transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router-bootstrap/tsconfig.json).
For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`;
transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
Also, `/// <reference types=".." />` will not work with path mapping, so dependencies must use `import`.
@@ -30,6 +30,7 @@ class FormConfig {
formlyConfig.extras.errorExistsAndShouldBeVisibleExpression = angular.noop;
formlyConfig.extras.explicitAsync = true;
formlyConfig.extras.fieldTransform = angular.noop;
formlyConfig.extras.fieldTransform = [angular.noop];
formlyConfig.extras.getFieldId = angular.noop;
formlyConfig.extras.ngModelAttrsManipulatorPreferUnbound = true;
}
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for angular-formly 7.2.3
// Type definitions for angular-formly 7.2.4
// Project: https://github.com/formly-js/angular-formly
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -44,7 +44,7 @@ declare namespace AngularFormly {
data?: {
[key: string]: any;
};
fieldTransform?: Function;
fieldTransform?: Function | Array<Function>;
formState?: Object;
removeChromeAutoComplete?: boolean;
resetModel?: Function;
@@ -580,7 +580,7 @@ declare namespace AngularFormly {
defaultHideDirective: string;
errorExistsAndShouldBeVisibleExpression: any;
getFieldId: Function;
fieldTransform: Function;
fieldTransform: Function | Array<Function>;
explicitAsync: boolean;
}
+273
View File
@@ -0,0 +1,273 @@
// Copyright (c) Martin Costello, 2017. All rights reserved.
// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information.
declare function describe(desc: string, fn: () => void): void;
declare function it(desc: string, fn: () => void): void;
describe("ApplePaySession", () => {
it("the constants are defined", () => {
let status = 0;
switch (status) {
case ApplePaySession.STATUS_FAILURE:
case ApplePaySession.STATUS_INVALID_BILLING_POSTAL_ADDRESS:
case ApplePaySession.STATUS_INVALID_SHIPPING_CONTACT:
case ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS:
case ApplePaySession.STATUS_PIN_INCORRECT:
case ApplePaySession.STATUS_PIN_LOCKOUT:
case ApplePaySession.STATUS_PIN_REQUIRED:
case ApplePaySession.STATUS_SUCCESS:
default:
break;
}
});
it("can create a new instance", () => {
const version = 1;
const paymentRequest = {
countryCode: "US",
currencyCode: "USD",
supportedNetworks: [
"masterCard",
"visa"
],
merchantCapabilities: [
"supports3DS"
],
total: {
label: "My Store",
amount: "9.99"
}
};
const session = new ApplePaySession(version, paymentRequest);
});
it("can call static methods", () => {
const merchantIdentifier = "MyMerchantId";
let canMakePayments: boolean = ApplePaySession.canMakePayments();
let supported: boolean = ApplePaySession.supportsVersion(2);
ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier)
.then((status: boolean) => {
console.log(`Can make payments with active card: ${status}.`);
});
ApplePaySession.openPaymentSetup(merchantIdentifier)
.then((success) => {
console.log(`Apple Pay setup: ${success}.`);
});
});
it("can call instance methods", () => {
const version = 1;
const paymentRequest = {
countryCode: "US",
currencyCode: "USD",
supportedNetworks: [
"masterCard",
"visa"
],
merchantCapabilities: [
"supports3DS"
],
total: {
label: "My Store",
amount: "9.99"
}
};
const session = new ApplePaySession(version, paymentRequest);
session.abort();
session.completeMerchantValidation({
foo: "bar"
});
session.completePayment(ApplePaySession.STATUS_SUCCESS);
const total = {
label: "Subtotal",
type: "final",
amount: "35.00"
};
const lineItems = [
{
label: "Subtotal",
type: "final",
amount: "35.00"
},
{
label: "Free Shipping",
amount: "0.00",
type: "pending"
},
{
label: "Estimated Tax",
amount: "3.06"
}
];
const shippingMethods = [
{
label: "Free Shipping",
detail: "Arrives in 5 to 7 days",
amount: "0.00",
identifier: "FreeShipping"
},
{
label: "2-hour Shipping",
amount: "5.00"
}
];
session.completePaymentMethodSelection(total, lineItems);
session.completeShippingContactSelection(
ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
shippingMethods,
total,
lineItems);
session.completeShippingMethodSelection(
ApplePaySession.STATUS_SUCCESS,
total,
lineItems);
session.oncancel = (event: ApplePayJS.Event): void => {
event.cancelBubble = true;
};
session.onpaymentauthorized = (event: ApplePayJS.ApplePayPaymentAuthorizedEvent) => {
if (event.payment) {
console.log("Payment data:", JSON.stringify(event.payment));
}
};
session.onpaymentmethodselected = (event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => {
if (event.paymentMethod) {
console.log("Payment method:", JSON.stringify(event.paymentMethod));
}
};
session.onshippingcontactselected = (event: ApplePayJS.ApplePayShippingContactSelectedEvent) => {
if (event.shippingContact) {
console.log("Shipping contact:", JSON.stringify(event.shippingContact));
}
};
session.onshippingmethodselected = (event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => {
if (event.shippingMethod) {
console.log("Shipping method:", JSON.stringify(event.shippingMethod));
}
};
session.onvalidatemerchant = (event: ApplePayJS.ApplePayValidateMerchantEvent) => {
if (event.validationURL) {
console.log(`The validation URL is '${event.validationURL}'.`);
}
};
});
});
describe("ApplePayPaymentRequest", () => {
it("can create a new instance", () => {
let paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
applicationData: "ApplicationData",
countryCode: "GB",
currencyCode: "GBP",
merchantCapabilities: [
"supports3DS",
"supportsCredit",
"supportsDebit"
],
supportedNetworks: [
"amex",
"discover",
"jcb",
"masterCard",
"privateLabel",
"visa"
],
total: {
label: "Apple",
type: "final",
amount: "9.99"
}
};
paymentRequest.billingContact = {
emailAddress: "ravipatel@example.com",
familyName: "Patel",
givenName: "Ravi",
phoneNumber: "(408) 555-5555",
addressLines: [
"1 Infinite Loop"
],
locality: "Cupertino",
administrativeArea: "CA",
postalCode: "95014",
country: "United States",
countryCode: "US"
};
paymentRequest.lineItems = [
{
label: "Subtotal",
type: "final",
amount: "35.00"
},
{
label: "Free Shipping",
amount: "0.00",
type: "pending"
},
{
label: "Estimated Tax",
amount: "3.06"
}
];
paymentRequest.requiredBillingContactFields = [
"postalAddress",
"name"
];
paymentRequest.requiredShippingContactFields = [
"postalAddress",
"name",
"phone",
"email"
];
paymentRequest.shippingContact = {
emailAddress: "ravipatel@example.com",
familyName: "Patel",
givenName: "Ravi",
phoneNumber: "(408) 555-5555",
addressLines: [
"1 Infinite Loop"
],
locality: "Cupertino",
administrativeArea: "CA",
postalCode: "95014",
country: "United States",
countryCode: "US"
};
paymentRequest.shippingMethods = [
{
label: "Free Shipping",
detail: "Arrives in 5 to 7 days",
amount: "0.00",
identifier: "FreeShipping"
},
{
label: "2-hour Shipping",
amount: "5.00"
}
];
paymentRequest.shippingType = "storePickup";
});
});
+576
View File
@@ -0,0 +1,576 @@
// Type definitions for Apple Pay JS 1.0
// Project: https://developer.apple.com/reference/applepayjs
// Definitions by: Martin Costello <https://martincostello.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* A session object for managing the payment process on the web.
*/
declare class ApplePaySession extends EventTarget {
/**
* Creates a new instance of the ApplePaySession class.
* @param version - The version of the ApplePay JS API you are using.
* @param paymentRequest - An ApplePayPaymentRequest object that contains the information that is displayed on the Apple Pay payment sheet.
*/
constructor(version: number, paymentRequest: ApplePayJS.ApplePayPaymentRequest);
/**
* A callback function that is automatically called when the payment UI is dismissed with an error.
*/
oncancel: (event: ApplePayJS.Event) => void;
/**
* A callback function that is automatically called when the user has authorized the Apple Pay payment, typically via TouchID.
*/
onpaymentauthorized: (event: ApplePayJS.ApplePayPaymentAuthorizedEvent) => void;
/**
* A callback function that is automatically called when a new payment method is selected.
*/
onpaymentmethodselected: (event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => void;
/**
* A callback function that is called when a shipping contact is selected in the payment sheet.
*/
onshippingcontactselected: (event: ApplePayJS.ApplePayShippingContactSelectedEvent) => void;
/**
* A callback function that is automatically called when a shipping method is selected.
*/
onshippingmethodselected: (event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => void;
/**
* A callback function that is automatically called when the payment sheet is displayed.
*/
onvalidatemerchant: (event: ApplePayJS.ApplePayValidateMerchantEvent) => void;
/**
* Indicates whether or not the device supports Apple Pay.
* @returns true if the device supports making payments with Apple Pay; otherwise, false.
*/
static canMakePayments(): boolean;
/**
* Indicates whether or not the device supports Apple Pay and if the user has an active card in Wallet.
* @param merchantIdentifier - The merchant ID received when the merchant enrolled in Apple Pay.
* @returns true if the device supports Apple Pay and there is at least one active card in Wallet; otherwise, false.
*/
static canMakePaymentsWithActiveCard(merchantIdentifier: string): Promise<boolean>;
/**
* Displays the Set up Apple Pay button.
* @param merchantIdentifier - The merchant ID received when the merchant enrolled in Apple Pay.
* @returns A boolean value indicating whether setup was successful.
*/
static openPaymentSetup(merchantIdentifier: string): Promise<boolean>;
/**
* Verifies if a web browser supports a given Apple Pay JS API version.
* @param version - A number representing the Apple Pay JS API version being checked. The initial version is 1.
* @returns A boolean value indicating whether the web browser supports the given API version. Returns false if the web browser does not support the specified version.
*/
static supportsVersion(version: number): boolean;
/**
* Aborts the current Apple Pay session.
*/
abort(): void;
/**
* Begins the merchant validation process.
*/
begin(): void;
/**
* Call after the merchant has been validated.
* @param merchantSession - An opaque message session object.
*/
completeMerchantValidation(merchantSession: any): void;
/**
* Call when a payment has been authorized.
* @param status - The status of the payment.
*/
completePayment(status: number): void;
/**
* Call after a payment method has been selected.
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
*/
completePaymentMethodSelection(newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void;
/**
* Call after a shipping contact has been selected.
* @param status - The status of the shipping contact update.
* @param newShippingMethods - A sequence of ApplePayShippingMethod dictionaries.
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
*/
completeShippingContactSelection(
status: number,
newShippingMethods: ApplePayJS.ApplePayShippingMethod[],
newTotal: ApplePayJS.ApplePayLineItem,
newLineItems: ApplePayJS.ApplePayLineItem[]): void;
/**
* Call after the shipping method has been selected.
* @param status - The status of the shipping method update.
* @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase.
* @param newLineItems - A sequence of ApplePayLineItem dictionaries.
*/
completeShippingMethodSelection(status: number, newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void;
/**
* The requested action succeeded.
*/
static readonly STATUS_SUCCESS: number;
/**
* The requested action failed.
*/
static readonly STATUS_FAILURE: number;
/**
* The billing address is not valid.
*/
static readonly STATUS_INVALID_BILLING_POSTAL_ADDRESS: number;
/**
* The shipping address is not valid.
*/
static readonly STATUS_INVALID_SHIPPING_POSTAL_ADDRESS: number;
/**
* The shipping contact information is not valid.
*/
static readonly STATUS_INVALID_SHIPPING_CONTACT: number;
/**
* The PIN information is not valid. Cards on the China Union Pay network may require a PIN.
*/
static readonly STATUS_PIN_INCORRECT: number;
/**
* The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
*/
static readonly STATUS_PIN_LOCKOUT: number;
/**
* The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
*/
static readonly STATUS_PIN_REQUIRED: number;
}
declare namespace ApplePayJS {
/**
* Defines a line item in a payment request - for example, total, tax, discount, or grand total.
*/
interface ApplePayLineItem {
/**
* A short, localized description of the line item.
*/
label: string;
/**
* The line item's amount.
*/
amount: string;
/**
* A value that indicates if the line item is final or pending.
*/
type?: string;
}
/**
* Represents the result of authorizing a payment request and contains encrypted payment information.
*/
interface ApplePayPayment {
/**
* The encrypted token for an authorized payment.
*/
token: ApplePayPaymentToken;
/**
* The billing contact selected by the user for this transaction.
*/
billingContact?: ApplePayPaymentContact;
/**
* The shipping contact selected by the user for this transaction.
*/
shippingContact?: ApplePayPaymentContact;
}
/**
* The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
*/
abstract class ApplePayPaymentAuthorizedEvent extends Event {
/**
* The payment token used to authorize a payment.
*/
readonly payment: ApplePayPayment;
}
/**
* Encapsulates contact information needed for billing and shipping.
*/
interface ApplePayPaymentContact {
/**
* An email address for the contact.
*/
emailAddress: string;
/**
* The contact's family name.
*/
familyName: string;
/**
* The contact's given name.
*/
givenName: string;
/**
* A phone number for the contact.
*/
phoneNumber: string;
/**
* The address for the contact.
*/
addressLines: string[];
/**
* The city for the contact.
*/
locality: string;
/**
* The state for the contact.
*/
administrativeArea: string;
/**
* The zip code, where applicable, for the contact.
*/
postalCode: string;
/**
* The colloquial country name for the contact.
*/
country: string;
/**
* The contact's ISO country code.
*/
countryCode: string;
}
/**
* Contains information about an Apple Pay payment card.
*/
interface ApplePayPaymentMethod {
/**
* A string, suitable for display, that describes the card.
*/
displayName: string;
/**
* A string, suitable for display, that is the name of the payment network backing the card.
* The value is one of the supported networks specified in the supportedNetworks property of the ApplePayPaymentRequest.
*/
network: string;
/**
* A value representing the card's type of payment.
*/
type: string;
/**
* The payment pass object associated with the payment.
*/
paymentPass: ApplePayPaymentPass;
}
/**
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
*/
abstract class ApplePayPaymentMethodSelectedEvent extends Event {
/**
* The card used to complete a payment.
*/
readonly paymentMethod: ApplePayPaymentMethod;
}
/**
* Represents a provisioned payment card for Apple Pay payments.
*/
interface ApplePayPaymentPass {
/**
* The unique identifier for the primary account number for the payment card.
*/
primaryAccountIdentifier: string;
/**
* A version of the primary account number suitable for display in your UI.
*/
primaryAccountNumberSuffix: string;
/**
* The unique identifier for the device-specific account number.
*/
deviceAccountIdentifier?: string;
/**
* A version of the device account number suitable for display in your UI.
*/
deviceAccountNumberSuffix?: string;
/**
* The activation state of the pass.
*/
activationState: string;
}
/**
* Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information.
*/
interface ApplePayPaymentRequest {
/**
* The merchant's two-letter ISO 3166 country code.
*/
countryCode: string;
/**
* The three-letter ISO 4217 currency code for the payment.
*/
currencyCode: string;
/**
* A set of line items that explain recurring payments and/or additional charges.
*/
lineItems?: ApplePayLineItem[];
/**
* The payment capabilities supported by the merchant.
* The value must at least contain ApplePayMerchantCapability.supports3DS.
*/
merchantCapabilities: string[];
/**
* The payment networks supported by the merchant.
*/
supportedNetworks: string[];
/**
* A line item representing the total for the payment.
*/
total: ApplePayLineItem;
/**
* Billing contact information for the user.
*/
billingContact?: ApplePayPaymentContact;
/**
* The billing information that you require from the user in order to process the transaction.
*/
requiredBillingContactFields?: string[];
/**
* The shipping information that you require from the user in order to fulfill the order.
*/
requiredShippingContactFields?: string[];
/**
* Shipping contact information for the user.
*/
shippingContact?: ApplePayPaymentContact;
/**
* A set of shipping method objects that describe the available shipping methods.
*/
shippingMethods?: ApplePayShippingMethod[] | string[];
/**
* How the items are to be shipped.
*/
shippingType?: string;
/**
* Optional user-defined data.
*/
applicationData?: string;
}
/**
* Contains the user's payment credentials.
*/
interface ApplePayPaymentToken {
/**
* An object containing the encrypted payment data.
*/
paymentData: any;
/**
* Information about the card used in the transaction.
*/
paymentMethod: ApplePayPaymentMethod;
/**
* A unique identifier for this payment.
*/
transactionIdentifier: string;
}
/**
* The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
*/
abstract class ApplePayShippingContactSelectedEvent extends Event {
/**
* The shipping address selected by the user.
*/
readonly shippingContact: ApplePayPaymentContact;
}
/**
* Defines a shipping method for delivering physical goods.
*/
interface ApplePayShippingMethod {
/**
* A short description of the shipping method.
*/
label: string;
/**
* A further description of the shipping method.
*/
detail?: string;
/**
* The amount associated with this shipping method.
*/
amount: string;
/**
* A client-defined identifier.
*/
identifier?: string;
}
/**
* The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
*/
abstract class ApplePayShippingMethodSelectedEvent extends Event {
/**
* The shipping method selected by the user.
*/
readonly shippingMethod: ApplePayShippingMethod;
}
/**
* The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
*/
abstract class ApplePayValidateMerchantEvent extends Event {
/**
* The URL used to validate the merchant server.
*/
readonly validationURL: string;
}
abstract class Event {
readonly bubbles: boolean;
cancelBubble: boolean;
readonly cancelable: boolean;
readonly composed: boolean;
readonly currentTarget: EventTarget;
readonly defaultPrevented: boolean;
readonly eventPhase: number;
readonly isTrusted: boolean;
returnValue: boolean;
readonly srcElement: EventTarget;
readonly target: EventTarget;
readonly timeStamp: string;
readonly type: string;
composedPath(): Node[];
initEvent(type?: string, bubbles?: boolean, cancelable?: boolean): void;
preventDefault(): void;
stopImmediatePropagation(): void;
stopPropagation(): void;
static readonly AT_TARGET: number;
static readonly BLUR: number;
static readonly BUBBLING_PHASE: number;
static readonly CAPTURING_PHASE: number;
static readonly CHANGE: number;
static readonly CLICK: number;
static readonly DBLCLICK: number;
static readonly DRAGDROP: number;
static readonly FOCUS: number;
static readonly KEYDOWN: number;
static readonly KEYPRESS: number;
static readonly KEYUP: number;
static readonly MOUSEDOWN: number;
static readonly MOUSEDRAG: number;
static readonly MOUSEMOVE: number;
static readonly MOUSEOUT: number;
static readonly MOUSEOVER: number;
static readonly MOUSEUP: number;
static readonly NONE: number;
static readonly SELECT: number;
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"baseUrl": "../",
"forceConsistentCasingInFileNames": true,
"lib": [
"dom",
"es6"
],
"module": "commonjs",
"noImplicitAny": true,
"noImplicitThis": true,
"noEmit": true,
"strictNullChecks": true,
"typeRoots": [
"../"
],
"types": []
},
"files": [
"index.d.ts",
"applepayjs-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+5 -5
View File
@@ -1,11 +1,11 @@
import { BloomFilter } from './index';
import { BloomFilter } from 'bloomfilter';
function test_bloomfilter() {
const m: number = 10;
const k: number = 2;
let bloomFilter = new BloomFilter(m, k);
let array: Array<Int32Array> = bloomFilter.buckets;
let length: number = bloomFilter.buckets.length;
const bloomFilter = new BloomFilter(m, k);
const array: Int32Array[] = bloomFilter.buckets;
const length: number = bloomFilter.buckets.length;
bloomFilter.add('someString');
let test: boolean = bloomFilter.test('someString');
const test: boolean = bloomFilter.test('someString');
}
+2 -2
View File
@@ -3,8 +3,8 @@
// Definitions by: slawiko <https://github.com/slawiko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export declare class BloomFilter {
buckets: Array<Int32Array>;
export class BloomFilter {
buckets: Int32Array[];
constructor(m: number, k: number);
+1 -1
View File
@@ -16,7 +16,7 @@ declare namespace bodyParser {
interface Options {
inflate?: boolean;
limit?: number | string;
type?: string | ((req: Request) => any);
type?: string | string[] | ((req: Request) => any);
verify?: (req: Request, res: Response, buf: Buffer, encoding: string) => void;
}
+2
View File
@@ -68,6 +68,8 @@ export class ObjectId {
static isValid(id: number | string | ObjectId): boolean;
constructor(id?: number | string | ObjectId);
toHexString(): string;
getTimestamp(): Date;
}
export type ObjectID = ObjectId;
export class BSONRegExp {
@@ -1,8 +1,6 @@
import blackhole = require("bunyan-blackhole");
var logsLaboursLost = blackhole("lost");
const logsLaboursLost = blackhole("lost");
const rotten = new Error("Something is rotten in the state of Denmark");
@@ -20,7 +18,5 @@ logsLaboursLost.info({play: "Much Ado About Nothing"}, "Let me be that I am and
logsLaboursLost.warn({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none");
logsLaboursLost.error({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none");
var hamlet = logsLaboursLost.child({play: "Hamlet"});
const hamlet = logsLaboursLost.child({play: "Hamlet"});
hamlet.info({character: "Polonius"}, "Though this be madness, yet there is method in't");
+38 -24
View File
@@ -1,4 +1,4 @@
// Type definitions for canvas-gauges v2.0.8
// Type definitions for canvas-gauges v2.1.3
// Project: https://github.com/Mikhus/canvas-gauges
// Definitions by: Mikhus <https://github.com/Mikhus>
// Definitions: https://github.com/Mikhus/DefinitelyTyped
@@ -20,6 +20,10 @@ declare namespace CanvasGauges {
color: string
}
export interface EventListeners {
[key: string]: Function|[Function]
}
export type MajorTicks = string[]|number[];
export interface GenericOptions {
@@ -30,6 +34,7 @@ declare namespace CanvasGauges {
maxValue?: number,
value?: number,
units?: string|boolean,
exactTicks?: boolean,
majorTicks?: MajorTicks,
minorTicks?: number,
strokeTicks?: boolean,
@@ -37,6 +42,8 @@ declare namespace CanvasGauges {
animateOnInit?: boolean,
title?: string|boolean,
borders?: boolean,
numbersMargin?: number,
listeners?: EventListeners,
valueInt?: number,
valueDec?: number,
majorTicksInt?: number,
@@ -45,6 +52,7 @@ declare namespace CanvasGauges {
animationDuration?: number,
animationRule?: string|AnimationRule,
colorPlate?: string,
colorPlateEnd?: string,
colorMajorTicks?: string,
colorMinorTicks?: string,
colorTitle?: string,
@@ -67,6 +75,26 @@ declare namespace CanvasGauges {
colorValueBoxShadow?: string,
colorNeedleShadowUp?: string,
colorNeedleShadowDown?: string,
colorBarStroke?: string,
colorBar?: string,
colorBarProgress?: string,
colorBarShadow?: string,
fontNumbers?: string,
fontTitle?: string,
fontUnits?: string,
fontValue?: string,
fontTitleSize?: number,
fontValueSize?: number,
fontUnitsSize?: number,
fontNumbersSize?: number,
fontTitleStyle?: FontStyle,
fontValueStyle?: FontStyle,
fontUnitsStyle?: FontStyle,
fontNumbersStyle?: FontStyle,
fontTitleWeight?: FontWeight,
fontValueWeight?: FontWeight,
fontUnitsWeight?: FontWeight,
fontNumbersWeight?: FontWeight,
needle?: boolean,
needleShadow?: boolean,
needleType?: string,
@@ -85,22 +113,10 @@ declare namespace CanvasGauges {
valueBoxBorderRadius?: number,
highlights?: Highlight[],
highlightsWidth?: number,
fontNumbers?: string,
fontTitle?: string,
fontUnits?: string,
fontValue?: string,
fontTitleSize?: number,
fontValueSize?: number,
fontUnitsSize?: number,
fontNumbersSize?: number,
fontTitleStyle?: FontStyle,
fontValueStyle?: FontStyle,
fontUnitsStyle?: FontStyle,
fontNumbersStyle?: FontStyle,
fontTitleWeight?: FontWeight,
fontValueWeight?: FontWeight,
fontUnitsWeight?: FontWeight,
fontNumbersWeight?: FontWeight
barWidth?: number,
barStrokeWidth?: number,
barProgress?: boolean,
barShadow?: number
}
export interface RadialGaugeOptions extends GenericOptions {
@@ -113,19 +129,14 @@ declare namespace CanvasGauges {
needleCircleSize?: number,
needleCircleInner?: boolean,
needleCircleOuter?: boolean,
animationTarget?: string
animationTarget?: string,
useMinPath?: boolean
}
export interface LinearGaugeOptions extends GenericOptions {
borderRadius?: number,
barBeginCircle?: number,
barWidth?: number,
barStrokeWidth?: number,
barProgress?: boolean,
colorBar?: string,
colorBarEnd?: string,
colorBarStroke?: string,
colorBarProgress?: string,
colorBarProgressEnd?: string,
tickSide?: string,
needleSide?: string,
@@ -230,6 +241,7 @@ declare namespace CanvasGauges {
public canvas: SmartCanvas;
public animation: Animation;
public value: number;
public static readonly version: number;
constructor(options: GenericOptions);
@@ -238,6 +250,8 @@ declare namespace CanvasGauges {
public abstract draw(): BaseGauge;
public static initialize(type: string, options: GenericOptions): any;
public static fromElement(element: HTMLElement): any;
public static ensureValue(value: number): number;
}
export class RadialGauge extends BaseGauge {
+5 -8
View File
@@ -1,14 +1,11 @@
import chai = require('chai');
import chaiSubset = require('chai-subset');
chai.use(chaiSubset);
var expect = chai.expect;
var assert = chai.assert;
const { assert, expect } = chai;
function test_containSubset() {
var obj = {
const obj = {
a: 'b',
c: 'd',
e: {
@@ -34,7 +31,7 @@ function test_containSubset() {
}
function test_notContainSubset() {
var obj = {
const obj = {
a: 'b',
c: 'd',
e: {
@@ -50,7 +47,7 @@ function test_notContainSubset() {
}
function test_arrayContainSubset() {
var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
const list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
expect(list).to.containSubset([{a: 'a', b: 'b'}]);
list.should.containSubset([{a: 'a', b: 'b'}]);
@@ -58,7 +55,7 @@ function test_arrayContainSubset() {
}
function test_arrayNotContainSubset() {
var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
const list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ];
expect(list).not.to.containSubset([{a: 'a', b: 'bd'}]);
list.should.not.containSubset([{a: 'a', b: 'bd'}]);
+2 -2
View File
@@ -250,7 +250,7 @@ interface CheerioElement {
tagName: string;
type: string;
name: string;
attribs: Object;
attribs: {[attr: string]: string};
children: CheerioElement[];
childNodes: CheerioElement[];
lastChild: CheerioElement;
@@ -272,4 +272,4 @@ declare var cheerio:CheerioAPI;
declare module "cheerio" {
export = cheerio;
}
}
+26
View File
@@ -3306,6 +3306,26 @@ declare namespace chrome.history {
* @since Chrome 5.
*/
declare namespace chrome.i18n {
/** Holds detected ISO language code and its percentage in the input string */
interface DetectedLanguage {
/** An ISO language code such as 'en' or 'fr'.
* For a complete list of languages supported by this method, see [kLanguageInfoTable]{@link https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc}.
* For an unknown language, 'und' will be returned, which means that [percentage] of the text is unknown to CLD */
language: string;
/** The percentage of the detected language */
percentage: number;
}
/** Holds detected language reliability and array of DetectedLanguage */
interface LanguageDetectionResult {
/** CLD detected language reliability */
isReliable: boolean;
/** Array of detectedLanguage */
languages: DetectedLanguage[];
}
/**
* Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage.
* @param callback The callback parameter should be a function that looks like this:
@@ -3324,6 +3344,12 @@ declare namespace chrome.i18n {
* @since Chrome 35.
*/
export function getUILanguage(): string;
/** Detects the language of the provided text using CLD.
* @param text User input string to be translated.
* @param callback The callback parameter should be a function that looks like this: function(object result) {...};
*/
export function detectLanguage(text: string, callback: (result: LanguageDetectionResult) => void): void;
}
////////////////////
+5 -6
View File
@@ -1,16 +1,16 @@
import * as Clipboard from 'clipboard';
var cb1 = new Clipboard('.btn');
var cb2 = new Clipboard(document.getElementById('id'), {
const cb1 = new Clipboard('.btn');
const cb2 = new Clipboard(document.getElementById('id'), {
action: elem => 'copy'
});
var cb3 = new Clipboard(document.querySelectorAll('query'), {
const cb3 = new Clipboard(document.querySelectorAll('query'), {
text: elem => null
});
var cb4 = new Clipboard('.btn', {
const cb4 = new Clipboard('.btn', {
target: elem => null
});
var cb5 = new Clipboard('.btn', {
const cb5 = new Clipboard('.btn', {
action: elem => 'copy',
target: elem => null
});
@@ -25,4 +25,3 @@ cb2.on('success', e => {
e.clearSelection();
});
cb2.on('error', e => { });
+1 -1
View File
@@ -54,4 +54,4 @@ declare namespace Clipboard {
export = Clipboard;
export as namespace Clipboard;
export as namespace Clipboard;
@@ -1,33 +1,21 @@
// examples taken from https://github.com/litehelpers/Cordova-sqlite-storage
function echoTestFunction() {
function successCallback(value: string) {
}
function errorCallback() {
}
function successCallback(value: string) {}
function errorCallback() {}
window.sqlitePlugin.echoTest(successCallback, errorCallback);
}
function selfTestFunction() {
function successCallback() {
}
function errorCallback() {
}
function successCallback() {}
function errorCallback() {}
window.sqlitePlugin.selfTest(successCallback, errorCallback);
}
function openingDatabase() {
function successcb(db: SQLitePlugin.Database) {
function successcb(db: SQLitePlugin.Database) {}
function errorcb(err: Error) {}
}
function errorcb(err: Error) {
}
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
var db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb);
let db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb);
}
function openingDatabase2() {
@@ -104,7 +92,7 @@ function sampleWithPRAGMA() {
// Cordova is ready
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
const db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
db.transaction(tx => {
tx.executeSql('DROP TABLE IF EXISTS test_table');
@@ -134,14 +122,13 @@ function sampleWithPRAGMA() {
}
}
function sampleWithTransactionLevelNesting() {
// Wait for Cordova to load
document.addEventListener('deviceready', onDeviceReady, false);
// Cordova is ready
function onDeviceReady() {
var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
const db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'});
db.transaction(tx => {
tx.executeSql('DROP TABLE IF EXISTS test_table');
@@ -155,7 +142,6 @@ function sampleWithTransactionLevelNesting() {
console.log("res.rows.length: " + res.rows.length + " -- should be 1");
console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1");
});
}, (tx, e) => {
console.log("ERROR: " + e.message);
});
@@ -163,18 +149,12 @@ function sampleWithTransactionLevelNesting() {
}
}
function dbClose(db: SQLitePlugin.Database) {
function successcb() {
}
function errorcb(err: Error) {
}
function successcb() {}
function errorcb(err: Error) {}
db.close(successcb, errorcb);
db.transaction(tx => {
tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], (tx, res) => {
console.log('got stringlength: ' + res.rows.item(0).stringlength);
@@ -193,21 +173,16 @@ function dbClose(db: SQLitePlugin.Database) {
}
function deleteDatabase() {
function successcb() {
}
function errorcb(err: Error) {
}
function successcb() {}
function errorcb(err: Error) {}
window.sqlitePlugin.deleteDatabase({name: 'my.db', location: 'default'}, successcb, errorcb);
}
function quickInstallationTest() {
window.sqlitePlugin.openDatabase({ name: 'hello-world.db', location: 'default' }, db => {
db.executeSql("select length('tenletters') as stringlength", [], res => {
var stringlength = res.rows.item(0).stringlength;
const stringlength = res.rows.item(0).stringlength;
console.log('got stringlength: ' + stringlength);
// document.getElementById('deviceready').querySelector('.received').innerHTML = 'stringlength: ' + stringlength;
});
-1
View File
@@ -65,4 +65,3 @@ declare namespace SQLitePlugin {
echoTest(ok?: (value: string) => void, error?: (msg: string) => void): void;
}
}
+13 -13
View File
@@ -1,20 +1,21 @@
import parse = require('csv-parse');
function callbackAPITest() {
var input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"';
const input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"';
parse(input, {comment: '#'}, (err, output) => {
output.should.eql([ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]);
});
}
function streamAPITest() {
let output: string[][] = [];
const output: string[][] = [];
// Create the parser
var parser = parse({delimiter: ':'});
let record: string[];
const parser = parse({delimiter: ':'});
// Use the writable stream api
parser.on('readable', () => {
while (record = parser.read()) {
while (true) {
const record = parser.read();
if (!record) break;
output.push(record);
}
});
@@ -35,12 +36,12 @@ function streamAPITest() {
import fs = require('fs');
function pipeFunctionTest() {
var transform = require('stream-transform');
const transform = require('stream-transform');
var output: any = [];
var parser = parse({delimiter: ':'})
var input = fs.createReadStream('/etc/passwd');
var transformer = transform((record: any[], callback: any) => {
const output: any = [];
const parser = parse({delimiter: ':'});
const input = fs.createReadStream('/etc/passwd');
const transformer = transform((record: any[], callback: any) => {
setTimeout(() => {
callback(null, record.join(' ') + '\n');
}, 500);
@@ -51,8 +52,7 @@ function pipeFunctionTest() {
import parseSync = require('csv-parse/lib/sync');
function syncApiTest() {
var input = '"key_1","key_2"\n"value 1","value 2"';
var records = parseSync(input, {columns: true});
const input = '"key_1","key_2"\n"value 1","value 2"';
const records = parseSync(input, {columns: true});
records.should.eql([{ key_1: 'value 1', key_2: 'value 2' }]);
}
+14 -14
View File
@@ -33,16 +33,16 @@ declare namespace parse {
* special constants are 'auto', 'unix', 'mac', 'windows', 'unicode';
* defaults to 'auto' (discovered in source or 'unix' if no source is specified).
*/
rowDelimiter?: string;
rowDelimiter?: string;
/**
* Optional character surrounding a field, one character only, defaults to double quotes.
*/
quote?: string
quote?: string;
/**
* Set the escape character, one character only, defaults to double quotes.
*/
escape?: string
escape?: string;
/**
* List of fields as an array,
@@ -55,62 +55,62 @@ declare namespace parse {
/**
* Treat all the characters after this one as a comment, default to '' (disabled).
*/
comment?: string
comment?: string;
/**
* Name of header-record title to name objects by.
*/
objname?: string
objname?: string;
/**
* Preserve quotes inside unquoted field.
*/
relax?: boolean
relax?: boolean;
/**
* Discard inconsistent columns count, default to false.
*/
relax_column_count?: boolean
relax_column_count?: boolean;
/**
* Dont generate empty values for empty lines.
*/
skip_empty_lines?: boolean
skip_empty_lines?: boolean;
/**
* Maximum numer of characters to be contained in the field and line buffers before an exception is raised,
* used to guard against a wrong delimiter or rowDelimiter,
* default to 128000 characters.
*/
max_limit_on_data_read?: number
max_limit_on_data_read?: number;
/**
* If true, ignore whitespace immediately around the delimiter, defaults to false.
* Does not remove whitespace in a quoted field.
*/
trim?: boolean
trim?: boolean;
/**
* If true, ignore whitespace immediately following the delimiter (i.e. left-trim all fields), defaults to false.
* Does not remove whitespace in a quoted field.
*/
ltrim?: boolean
ltrim?: boolean;
/**
* If true, ignore whitespace immediately preceding the delimiter (i.e. right-trim all fields), defaults to false.
* Does not remove whitespace in a quoted field.
*/
rtrim?: boolean
rtrim?: boolean;
/**
* If true, the parser will attempt to convert read data types to native types.
*/
auto_parse?: boolean
auto_parse?: boolean;
/**
* If true, the parser will attempt to convert read data types to dates. It requires the "auto_parse" option.
*/
auto_parse_date?: boolean
auto_parse_date?: boolean;
}
// TODO: what is this for?
+6 -1
View File
@@ -1 +1,6 @@
{ "extends": "../tslint.json" }
{
"extends": "../tslint.json",
"rules": {
"no-empty-interface": false
}
}
-8
View File
@@ -12,7 +12,6 @@ import * as d3Dsv from 'd3-dsv';
// Preperatory Steps
// ------------------------------------------------------------------------------------------
const csvTestString: string = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
const tsvTestString: string = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
const pipedTestString: string = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
@@ -34,7 +33,6 @@ let parseMappedArray: d3Dsv.DSVParsedArray<ParsedTestObject>;
let parseRowsArray: string[][];
let parseRowsMappedArray: ParsedTestObject[];
let columns: string[];
let num: number;
let date: Date;
@@ -77,14 +75,12 @@ str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// csvParseRows(...) ============================================================================
// without row mapper -----------------------------------------------------------------------
parseRowsArray = d3Dsv.csvParseRows(csvTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
@@ -158,14 +154,12 @@ str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// tsvParseRows(...) ============================================================================
// without row mapper -----------------------------------------------------------------------
parseRowsArray = d3Dsv.tsvParseRows(tsvTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
@@ -244,14 +238,12 @@ str = parseMappedArray[0].make;
str = parseMappedArray[0].model;
num = parseMappedArray[0].length;
// parseRows(...) ============================================================================
// without row mapper -----------------------------------------------------------------------
parseRowsArray = dsv.parseRows(pipedTestString);
str = parseRowsArray[0][0]; // 'Year' of first row
// date = parseRowsArray[0][0]; // fails, return value is string
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+2 -5
View File
@@ -1,8 +1,5 @@
import d3dsv = require("d3-dsv");
var csv = d3dsv(",");
var rows = csv.parse("a,b,c\n1,2,3\n4,5,6");
const csv = d3dsv(",");
const rows = csv.parse("a,b,c\n1,2,3\n4,5,6");
-35
View File
@@ -1,4 +1,3 @@
/**
* Typescript definition tests for d3/d3-selection module
*
@@ -9,7 +8,6 @@
import * as d3Selection from 'd3-selection';
// ---------------------------------------------------------------------------------------
// Some preparatory work for definition testing below
// ---------------------------------------------------------------------------------------
@@ -56,7 +54,6 @@ interface CircleDatumAlternative {
// Tests of Top-Level Selection Functions
// ---------------------------------------------------------------------------------------
// test top-level .selection() -----------------------------------------------------------
const topSelection: d3Selection.Selection<HTMLElement, any, null, undefined> = d3Selection.selection();
@@ -101,16 +98,13 @@ maybeSVG2 = d3Selection.select<SVGSVGElement | null, any>(maybeSVG1.node());
// fails, as node type mismatches selection type
// let body7: d3Selection.Selection<HTMLBodyElement | null, any, HTMLElement, undefined> = d3Selection.select<HTMLBodyElement | null, any>(maybeSVG1.node());
// test "special case DOM objects"
d3Selection.select(xDoc);
d3Selection.select(xWindow);
// test top-level selectAll() -------------------------------------------------------------
// Using selectAll(), selectAll(null) or selectAll(undefined) creates an empty selection
let emptyRootSelection: d3Selection.Selection<null, undefined, null, undefined> = d3Selection.selectAll();
@@ -137,7 +131,6 @@ const baseTypeElements2: d3Selection.Selection<d3Selection.BaseType, any, null,
// element types match, but datum is of type 'any' as it cannot be inferred from .nodes()
const divElements3: d3Selection.Selection<HTMLDivElement, any, null, undefined> = d3Selection.selectAll(divElements.nodes());
// Using selectAll(...) with node array argument and type parameters creates selection
// with Group element of type HTMLDivElement and datum of DivDatum type. The parent element is of type 'null' with datum of type 'undefined'
@@ -145,10 +138,8 @@ const divElements4: d3Selection.Selection<HTMLDivElement, DivDatum, null, undefi
// d3Selection.selectAll<HTMLDivElement, DivDatum>(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement
// selectAll(...) accepts NodeListOf<...> argument
const xSVGCircleElementList: NodeListOf<SVGCircleElement> = document.querySelectorAll('circle');
const circleSelection: d3Selection.Selection<SVGCircleElement, any, null, undefined> = d3Selection.selectAll(xSVGCircleElementList);
@@ -156,14 +147,10 @@ const circleSelection: d3Selection.Selection<SVGCircleElement, any, null, undefi
const documentLinks: d3Selection.Selection<HTMLAnchorElement | HTMLAreaElement, any, null, undefined> = d3Selection.selectAll(document.links);
// ---------------------------------------------------------------------------------------
// Tests of Sub-Selection Functions
// ---------------------------------------------------------------------------------------
// select(...) sub-selection --------------------------------------------------------------
// Expected: datum propagates down from selected element to sub-selected descendant element
@@ -211,12 +198,10 @@ firstG = svgEl.select(function(d, i, g) {
return this.querySelector('g')!; // this of type SVGSVGElement by type inference
});
// firstG = svgEl.select(function() {
// return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG
// });
// selectAll(...) sub-selection --------------------------------------------------------------
// Expected: datum from selected element(s) does not propagate down to sub-selected descendant elements.
@@ -234,14 +219,12 @@ let elementsUnknownData: d3Selection.Selection<d3Selection.BaseType, any, SVGSVG
let gElementsOldData: d3Selection.Selection<SVGGElement, CircleDatum, SVGSVGElement, SVGDatum> = svgEl.selectAll<SVGGElement, CircleDatum>('g');
// gElementsOldData = svgEl.selectAll('g'); // fails default type parameters of selectAll for group element type and datum type do not match
// Using selectAll(...) sub-selection with a selector function argument.
function svgGroupSelectorAll(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[]): NodeListOf<SVGGElement> {
return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied
}
gElementsOldData = svgEl.selectAll<SVGGElement, CircleDatum>(svgGroupSelectorAll);
function wrongSvgGroupSelectorAll(this: HTMLElement, d: SVGDatum, i: number, groups: HTMLElement[]): NodeListOf<SVGGElement> {
@@ -305,7 +288,6 @@ maybeG.selectAll(function(d, i, g) {
// selector(...) and selectorAll(...) ----------------------------------------------------
// d3Selection.select<SVGGElement>(d3Selection.selector<SVGGElement>('g')); // fails, selector as argument to top-level select not supported
// supported on sub-selection
@@ -352,12 +334,10 @@ filterdGElements2 = d3Selection.selectAll<SVGElement, any>('.any-svg-type').filt
// return that.tagName === 'g'|| that.tagName === 'G';
// }); // fails without using narrowing generic on filter method
// matcher() -----------------------------------------------------------------------------
filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level'));
// ---------------------------------------------------------------------------------------
// Tests of Modification
// ---------------------------------------------------------------------------------------
@@ -377,7 +357,6 @@ str = body.html();
// Setters tests -------------------------------------------------------------------------
let circles: d3Selection.Selection<SVGCircleElement, CircleDatumAlternative, HTMLElement, any>;
let divs: d3Selection.Selection<HTMLDivElement, DivDatum, HTMLElement, any>;
@@ -425,7 +404,6 @@ divs = divs
return d.padding === '0px'; // boolean return value
});
// style(...) Tests
divs = divs
@@ -451,7 +429,6 @@ divs = divs
// .style('color', function() { return 'green'; }, 'test') // fails, test: invalid priority value
.style('color', () => 'green', 'important'); // boolean return + test: priority = 'important';
// property(...) Tests
circles = circles
@@ -514,7 +491,6 @@ body = body
// Tests of Datum and Data Join
// ---------------------------------------------------------------------------------------
const data: CircleDatum[] = [
{ nodeId: 'c1', cx: 10, cy: 10, r: 5, name: 'foo', label: 'Foo' },
{ nodeId: 'c2', cx: 20, cy: 20, r: 5, name: 'bar', label: 'Bar' },
@@ -527,7 +503,6 @@ const data2: CircleDatumAlternative[] = [
{ nodeId: 'c4', cx: 10, cy: 15, r: 10, name: 'newbie', label: 'Newbie', color: 'red' }
];
// Tests of Datum -----------------------------------------------------------------------
// TEST GETTER
@@ -564,7 +539,6 @@ newBodyDatum = body.datum(function(d, i, g) {
// return { newFoo: 'new foo' };
// }).datum(); // inferred type
// SCENARIO 1: Fully type-parameterized
// object-based
@@ -616,10 +590,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la
return d.length > 0 && d[0].color === 'green';
});
// Tests of Data Join --------------------------------------------------------------------
const dimensions: SVGDatum = {
width: 500,
height: 300
@@ -741,7 +713,6 @@ circles2 = enterCircles.merge(circles2); // merge enter and update selections
// FURTHER DATA-JOIN TESTs (function argument, changes in data type between old and new data)
const matrix = [
[11975, 5871, 8916, 2868],
[1951, 10048, 2060, 6171],
@@ -876,7 +847,6 @@ newParagraph2 = body.insert(typeValueFunction, 'p.second-paragraph');
newParagraph2 = body.insert(typeValueFunction, beforeValueFunction);
newParagraph2 = body.insert(typeValueFunction);
// sort(...) -----------------------------------------------------------------------------
// NB: Return new selection of same type
@@ -932,12 +902,10 @@ circles = circles.each(function(d, i, g) { // check chaining return type by re-
// call() -------------------------------------------------------------------------------
function enforceMinRadius(selection: d3Selection.Selection<SVGCircleElement, CircleDatumAlternative, any, any>, minRadius: number): void {
selection.attr('r', function(d) {
const r: number = +d3Selection.select(this).attr('r');
return Math.max(r, minRadius);
});
}
// returns 'this' selection
@@ -959,7 +927,6 @@ circles = circles.call(enforceMinRadius, 40); // check chaining return type by r
let listener: undefined | ((this: HTMLBodyElement, datum: BodyDatum, index: number, group: HTMLBodyElement[] | ArrayLike<HTMLBodyElement>) => void);
body = body.on('click', function(d, i, g) {
const that: HTMLBodyElement = this;
// const that2: SVGElement = this; // fails, type mismatch
@@ -981,7 +948,6 @@ if (listener) {
// remove listener
body = body.on('click', null); // check chaining return type by re-assigning
// dispatch(...) -------------------------------------------------------------------------
const fooEventParam: d3Selection.CustomEventParameters = {
@@ -1009,7 +975,6 @@ body = body.dispatch('fooEvent', function(d, i, g) { // re-assign for chaining t
return eParam;
});
// event and customEvent() ----------------------------------------------------------------
// TODO: Tests of event are related to issue #3 (https://github.com/tomwanzek/d3-v4-definitelytyped/issues/3)
+3 -18
View File
@@ -44,7 +44,6 @@ export interface EnterElement {
*/
export type ContainerElement = HTMLElement | SVGSVGElement | SVGGElement;
/**
* Interface for optional parameters map, when dispatching custom events
* on a selection
@@ -69,7 +68,6 @@ export interface CustomEventParameters {
*/
export type ValueFn<T extends BaseType, Datum, Result> = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike<T>) => Result;
/**
* TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file.
* For example, whereever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()`
@@ -88,8 +86,6 @@ export interface TransitionLike<GElement extends BaseType, Datum> {
tween(name: string, tweenFn: ValueFn<GElement, Datum, ((t: number) => void)>): TransitionLike<GElement, Datum>;
}
// --------------------------------------------------------------------------
// All Selection related interfaces and function
// --------------------------------------------------------------------------
@@ -155,7 +151,6 @@ export function selectAll<GElement extends BaseType, OldDatum>(nodes: GElement[]
*/
export function selectAll<GElement extends BaseType, OldDatum>(nodes: ArrayLike<GElement>): Selection<GElement, OldDatum, null, undefined>;
/**
* A D3 Selection of elements.
*
@@ -165,7 +160,6 @@ export function selectAll<GElement extends BaseType, OldDatum>(nodes: ArrayLike<
* The fourth generic "PDatum" refers to the type of the datum of the parent element(s).
*/
interface Selection<GElement extends BaseType, Datum, PElement extends BaseType, PDatum> {
// Sub-selection -------------------------
/**
@@ -625,7 +619,6 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
*/
lower(): this;
// Data Join ---------------------------------
/**
@@ -853,8 +846,6 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
* Returns the total number of elements in this selection.
*/
size(): number;
}
/**
@@ -867,8 +858,7 @@ type SelectionFn = () => Selection<HTMLElement, any, null, undefined>;
* Selects the root element, document.documentElement. This function can also be used to test for selections
* (instanceof d3.selection) or to extend the selection prototype.
*/
export var selection: SelectionFn;
export const selection: SelectionFn;
// ---------------------------------------------------------------------------
// on.js event and customEvent related
@@ -899,7 +889,7 @@ interface BaseEvent {
* rather than from the generated UMD bundle; not all bundlers observe jsnext:main.
* Also beware of conflicts with the window.event global.
*/
export var event: any; // Could be of all sorts of types, too general: BaseEvent | Event | MouseEvent | TouchEvent | ... | OwnCustomEventType;
export const event: any; // Could be of all sorts of types, too general: BaseEvent | Event | MouseEvent | TouchEvent | ... | OwnCustomEventType;
/**
* Invokes the specified listener, using the specified "that" as "this" context and passing the specified arguments, if any.
@@ -984,7 +974,6 @@ export function touches(container: ContainerElement, touches?: TouchList): Array
// local.js related
// ---------------------------------------------------------------------------
export interface Local<T> {
/**
* Retrieves a local variable stored on the node (or one of its parents).
@@ -1050,7 +1039,6 @@ export interface NamespaceLocalObject {
*/
export function namespace(prefixedLocal: string): NamespaceLocalObject | string;
// ---------------------------------------------------------------------------
// namespaces.js related
// ---------------------------------------------------------------------------
@@ -1063,8 +1051,7 @@ export interface NamespaceMap { [prefix: string]: string; }
/**
* Map of namespace prefixes to corresponding fully qualified namespace strings
*/
export var namespaces: NamespaceMap;
export const namespaces: NamespaceMap;
// ---------------------------------------------------------------------------
// window.js related
@@ -1078,13 +1065,11 @@ export var namespaces: NamespaceMap;
*/
export function window(DOMNode: Window | Document | Element): Window;
// ---------------------------------------------------------------------------
// creator.js and matcher.js Complex helper closure generating functions
// for explicit bound-context dependent use
// ---------------------------------------------------------------------------
/**
* Given the specified element name, returns a function which creates an element of the given name,
* assuming that "this" is the parent element.
-1
View File
@@ -1,4 +1,3 @@
namespace DagreD3Tests {
const gDagre = new dagreD3.graphlib.Graph();
const graph = gDagre.graph();
-1
View File
@@ -1,4 +1,3 @@
import deepEqual = require("deep-equal");
const isDeepEqual1: boolean = deepEqual({}, {});
+9 -11
View File
@@ -1,32 +1,30 @@
const headertmpl = "<h1>{{=it.title}}</h1>";
var headertmpl = "<h1>{{=it.title}}</h1>";
var pagetmpl = "<h2>Here is the page using a header template< / h2 >\n"
const pagetmpl = "<h2>Here is the page using a header template< / h2 >\n"
+ "{{#def.header}}\n"
+ "{{=it.name}}";
var customizableheadertmpl = "{{#def.header}}"
const customizableheadertmpl = "{{#def.header}}"
+ "\n{{#def.mycustominjectionintoheader || ''} }";
var pagetmplwithcustomizableheader = "<h2>Here is the page with customized header template</h2>\n"
const pagetmplwithcustomizableheader = "<h2>Here is the page with customized header template</h2>\n"
+ "{{##def.mycustominjectionintoheader:\n"
+ " <div>{{=it.title}} is not {{=it.name}}</div>\n"
+ "#}}\n"
+ "{{#def.customheader}}\n"
+ "{{=it.name}}";
var def = {
const def = {
header: headertmpl,
customheader: customizableheadertmpl
};
var data = {
const data = {
title: "My title",
name: "My name"
};
var pagefn = doT.template(pagetmpl, undefined, def);
var content = pagefn(data);
let pagefn = doT.template(pagetmpl, undefined, def);
const content = pagefn(data);
pagefn = doT.template(pagetmplwithcustomizableheader, undefined, def);
var contentcustom = pagefn(data);
const contentcustom = pagefn(data);
+1 -1
View File
@@ -1264,7 +1264,7 @@ declare namespace Electron {
* Sets the menu as the window top menu.
* Note: This API is not available on macOS.
*/
setMenu(menu: Menu): void;
setMenu(menu: Menu | null): void;
/**
* Sets the progress value in the progress bar.
* On Linux platform, only supports Unity desktop environment, you need to
+3
View File
@@ -145,6 +145,9 @@ app.on('ready', () => {
mainWindow.webContents.capturePage({x: 0, y: 0, width: 100, height: 200}, image => {
console.log(image.toPNG());
});
mainWindow.setMenu(null);
mainWindow.setMenu(Menu.buildFromTemplate([]));
});
app.commandLine.appendSwitch('enable-web-bluetooth');
-7
View File
@@ -41,26 +41,22 @@ export {
* DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation.
**/
export abstract class DataSource {
/**
* The get method retrieves values from the DataSource's associated JSONGraph object.
**/
get(pathSets: PathSet[]): Observable<JSONGraphEnvelope>;
/**
* The set method accepts values to set in the DataSource's associated JSONGraph object.
**/
set(jsonGraphEnvelope: JSONGraphEnvelope): Observable<JSONGraphEnvelope>;
/**
* Invokes a function in the DataSource's JSONGraph object.
**/
call(functionPath: Path, args?: any[], refSuffixes?: PathSet[], thisPaths?: PathSet[]): Observable<JSONGraphEnvelope>;
}
/////////////////////////////////////////////////////
// Model
/////////////////////////////////////////////////////
@@ -215,7 +211,6 @@ export class Model {
getPath(): Path;
}
/////////////////////////////////////////////////////
// ModelResponse
/////////////////////////////////////////////////////
@@ -232,13 +227,11 @@ interface Thenable<T> {
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U> | void): Thenable<U>;
}
/////////////////////////////////////////////////////
// Observable
/////////////////////////////////////////////////////
export class Observable<T>{
/**
* The forEach method is a synonym for {@link Observable.prototype.subscribe} and triggers the execution of the Observable, causing the values within to be pushed to a callback.
* An Observable is like a pipe of water that is closed.
+1 -4
View File
@@ -1,6 +1,4 @@
var model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')});
const model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')});
model.get('greeting').then(response => {
document.write(response.json.greeting);
@@ -15,4 +13,3 @@ model.set({
});
model.set(falcor.pathValue('greeting', 'Hello, world'));
-1
View File
@@ -127,4 +127,3 @@ subscription.dispose();
modelResponse.then(res => res.json.items.length);
modelResponse.then(res => res, error => console.error.bind(error));
modelResponse.then<number>(res => res.json.items.length).then((l: number) => l + 1);
+16 -16
View File
@@ -4,45 +4,45 @@ import * as fetchJsonp from 'fetch-jsonp';
fetchJsonp('/users.jsonp')
.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
console.log('parsed json', json)
console.log('parsed json', json);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
console.log('parsing failed', ex);
});
fetchJsonp('/users.jsonp', {
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
console.log('parsed json', json)
console.log('parsed json', json);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
console.log('parsing failed', ex);
});
fetchJsonp('/users.jsonp', {
timeout: 3000,
jsonpCallback: 'custom_callback'
})
.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
console.log('parsed json', json)
console.log('parsed json', json);
}).catch(function(ex) {
console.log('parsing failed', ex)
})
console.log('parsing failed', ex);
});
// Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/examples/index.html
var result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', {
const result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', {
jsonpCallback: 'jsoncallback',
timeout: 3000
})
});
result.then(function(response) {
return response.json()
return response.json();
}).then(function(json) {
document.body.innerHTML = JSON.stringify(json);
})['catch'](function(ex) {
document.body.innerHTML = 'failed:' + ex;
})
});
+13 -22
View File
@@ -1,42 +1,33 @@
import * as Board from 'firmata'
import * as Board from 'firmata';
function test_basic_board()
{
let board = new Board('');
function test_basic_board() {
const board = new Board('');
}
function test_board_with_callback()
{
let board = new Board('', (error: any) =>
{
function test_board_with_callback() {
const board = new Board('', (error: any) => {
board.pinMode(13, board.MODES.OUTPUT);
board.pinMode(12, Board.PIN_MODE.OUTPUT);
});
}
function test_board_with_listener()
{
let board = new Board('');
function test_board_with_listener() {
const board = new Board('');
board.on('ready', () =>
{
board.on('ready', () => {
board.pinMode(13, board.MODES.OUTPUT);
board.pinMode(12, Board.PIN_MODE.OUTPUT);
});
}
function test_class_extension()
{
class MyBoard extends Board
{
Disconnect()
{
function test_class_extension() {
class MyBoard extends Board {
Disconnect() {
this.transport.close((error: any) => {});
}
}
let myBoard: MyBoard = new MyBoard('', () =>
{
const myBoard: MyBoard = new MyBoard('', () => {
myBoard.Disconnect();
});
}
}
+134 -90
View File
@@ -5,7 +5,7 @@
/// <reference types="node" />
import * as SerialPort from 'serialport'
import * as SerialPort from 'serialport';
export = Board;
@@ -15,8 +15,7 @@ export = Board;
* This is a starting point that appeared to work fine for months within a project of my company, but I give no
* guarantee that it cannot be improved.
*/
declare class Board extends NodeJS.EventEmitter
{
declare class Board extends NodeJS.EventEmitter {
constructor(serialPort: string, callback?: (error: any) => void)
MODES: Board.PinModes;
STEPPER: Board.StepperConstants;
@@ -84,7 +83,11 @@ declare class Board extends NodeJS.EventEmitter
// TODO untested --- TWW
sendOneWireDelay(pin: number, delay: number): void
// TODO untested --- TWW
sendOneWireWriteAndRead(pin: number, device: number, data: number|number[], numBytesToRead: number,
sendOneWireWriteAndRead(
pin: number,
device: number,
data: number|number[],
numBytesToRead: number,
callback: (error?: Error, data?: number) => void): void
setSamplingInterval(interval: number): void
getSamplingInterval(): number
@@ -92,124 +95,165 @@ declare class Board extends NodeJS.EventEmitter
reportDigitalPin(pin: number, value: Board.REPORTING): void
// TODO untested/incomplete --- TWW
pingRead(opts: any, callback: () => void): void
stepperConfig(deviceNum: number, type: number, stepsPerRev: number, dirOrMotor1Pin: number,
stepOrMotor2Pin: number, motor3Pin?: number, motor4Pin?: number): void
stepperStep(deviceNum: number, direction: Board.STEPPER_DIRECTION, steps: number, speed: number,
accel: number|((bool?: boolean) => void), decel?: number, callback?: (bool?: boolean) => void): void
stepperConfig(
deviceNum: number,
type: number,
stepsPerRev: number,
dirOrMotor1Pin: number,
stepOrMotor2Pin: number,
motor3Pin?: number,
motor4Pin?: number): void
stepperStep(
deviceNum: number,
direction: Board.STEPPER_DIRECTION,
steps: number,
speed: number,
accel: number|((bool?: boolean) => void),
decel?: number,
callback?: (bool?: boolean) => void): void;
// TODO untested --- TWW
serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void
serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void;
// TODO untested --- TWW
serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void
serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void;
// TODO untested --- TWW
serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void
serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void;
// TODO untested --- TWW
serialStop(portId: Board.SERIAL_PORT_ID): void
serialStop(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
serialClose(portId: Board.SERIAL_PORT_ID): void
serialClose(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
serialFlush(portId: Board.SERIAL_PORT_ID): void
serialFlush(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
serialListen(portId: Board.SERIAL_PORT_ID): void
serialListen(portId: Board.SERIAL_PORT_ID): void;
// TODO untested --- TWW
sysexResponse(commandByte: number, handler: (data: number[]) => void): void
sysexResponse(commandByte: number, handler: (data: number[]) => void): void;
// TODO untested --- TWW
sysexCommand(message: number[]): void
reset(): void
static isAcceptablePort(port: Board.Port): boolean
static requestPort(callback: (error: any, port: Board.Port) => any): void
sysexCommand(message: number[]): void;
reset(): void;
static isAcceptablePort(port: Board.Port): boolean;
static requestPort(callback: (error: any, port: Board.Port) => any): void;
// TODO untested --- TWW
static encode(data: number[]): number[]
static encode(data: number[]): number[];
// TODO untested --- TWW
static decode(data: number[]): number[]
static decode(data: number[]): number[];
// TODO untested/incomplete --- TWW
protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void
protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void;
// TODO untested/incomplete --- TWW
protected _sendOneWireRequest(pin: number, subcommand: any, device: any, numBytesToRead: any, correlationId: any,
delay: number, dataToWrite: any, event: any, callback: () => void): void
protected _sendOneWireRequest(
pin: number,
subcommand: any,
device: any,
numBytesToRead: any,
correlationId: any,
delay: number,
dataToWrite: any,
event: any, callback: () => void): void;
}
declare namespace Board
{
export interface PinModes
{
INPUT: PIN_MODE, OUTPUT: PIN_MODE, ANALOG: PIN_MODE, PWM: PIN_MODE, SERVO: PIN_MODE, SHIFT: PIN_MODE,
I2C: PIN_MODE, ONEWIRE: PIN_MODE, STEPPER: PIN_MODE, SERIAL: PIN_MODE, PULLUP: PIN_MODE, IGNORE: PIN_MODE,
PING_READ: PIN_MODE, UNKOWN: PIN_MODE
declare namespace Board {
interface PinModes {
INPUT: PIN_MODE;
OUTPUT: PIN_MODE;
ANALOG: PIN_MODE;
PWM: PIN_MODE;
SERVO: PIN_MODE;
SHIFT: PIN_MODE;
I2C: PIN_MODE;
ONEWIRE: PIN_MODE;
STEPPER: PIN_MODE;
SERIAL: PIN_MODE;
PULLUP: PIN_MODE;
IGNORE: PIN_MODE;
PING_READ: PIN_MODE;
UNKOWN: PIN_MODE;
}
export interface StepperConstants
{
TYPE: { DRIVER: STEPPER_TYPE, TWO_WIRE: STEPPER_TYPE, FOUR_WIRE: STEPPER_TYPE },
interface StepperConstants {
TYPE: {
DRIVER: STEPPER_TYPE,
TWO_WIRE: STEPPER_TYPE,
FOUR_WIRE: STEPPER_TYPE,
};
RUNSTATE: {
STOP: STEPPER_RUN_STATE, ACCEL: STEPPER_RUN_STATE, DECEL: STEPPER_RUN_STATE, RUN: STEPPER_RUN_STATE
},
DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION }
STOP: STEPPER_RUN_STATE,
ACCEL: STEPPER_RUN_STATE,
DECEL: STEPPER_RUN_STATE,
RUN: STEPPER_RUN_STATE,
};
DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION };
}
// tslint:disable-next-line interface-name
export interface I2cModes
{
WRITE: I2C_MODE, READ: I2C_MODE, CONTINUOUS_READ: I2C_MODE, STOP_READING: I2C_MODE
interface I2cModes {
WRITE: I2C_MODE;
READ: I2C_MODE;
CONTINUOUS_READ: I2C_MODE;
STOP_READING: I2C_MODE;
}
export interface SerialModes
{
CONTINUOUS_READ: SERIAL_MODE, STOP_READING: SERIAL_MODE
interface SerialModes {
CONTINUOUS_READ: SERIAL_MODE;
STOP_READING: SERIAL_MODE;
}
export interface SerialPortIds
{
HW_SERIAL0: SERIAL_PORT_ID, HW_SERIAL1: SERIAL_PORT_ID, HW_SERIAL2: SERIAL_PORT_ID,
HW_SERIAL3: SERIAL_PORT_ID, SW_SERIAL0: SERIAL_PORT_ID, SW_SERIAL1: SERIAL_PORT_ID,
SW_SERIAL2: SERIAL_PORT_ID, SW_SERIAL3: SERIAL_PORT_ID, DEFAULT: SERIAL_PORT_ID,
interface SerialPortIds {
HW_SERIAL0: SERIAL_PORT_ID;
HW_SERIAL1: SERIAL_PORT_ID;
HW_SERIAL2: SERIAL_PORT_ID;
HW_SERIAL3: SERIAL_PORT_ID;
SW_SERIAL0: SERIAL_PORT_ID;
SW_SERIAL1: SERIAL_PORT_ID;
SW_SERIAL2: SERIAL_PORT_ID;
SW_SERIAL3: SERIAL_PORT_ID;
DEFAULT: SERIAL_PORT_ID;
}
export interface SerialPinTypes
{
RES_RX0: SERIAL_PIN_TYPE, RES_TX0: SERIAL_PIN_TYPE, RES_RX1: SERIAL_PIN_TYPE, RES_TX1: SERIAL_PIN_TYPE,
RES_RX2: SERIAL_PIN_TYPE, RES_TX2: SERIAL_PIN_TYPE, RES_RX3: SERIAL_PIN_TYPE, RES_TX3: SERIAL_PIN_TYPE,
interface SerialPinTypes {
RES_RX0: SERIAL_PIN_TYPE;
RES_TX0: SERIAL_PIN_TYPE;
RES_RX1: SERIAL_PIN_TYPE;
RES_TX1: SERIAL_PIN_TYPE;
RES_RX2: SERIAL_PIN_TYPE;
RES_TX2: SERIAL_PIN_TYPE;
RES_RX3: SERIAL_PIN_TYPE;
RES_TX3: SERIAL_PIN_TYPE;
}
export interface Pins
{
mode: PIN_MODE,
value: PIN_STATE|number,
supportedModes: PIN_MODE[],
analogChannel: number,
report: REPORTING,
state: PIN_STATE|PULLUP_STATE, // TODO not sure if this exists anymore... --- TWW
interface Pins {
mode: PIN_MODE;
value: PIN_STATE | number;
supportedModes: PIN_MODE[];
analogChannel: number;
report: REPORTING;
state: PIN_STATE | PULLUP_STATE; // TODO not sure if this exists anymore... --- TWW
}
export interface Firmware
{
name: string,
version: Version,
interface Firmware {
name: string;
version: Version;
}
export interface Settings
{
reportVersionTimeout: number,
samplingInterval: number,
interface Settings {
reportVersionTimeout: number;
samplingInterval: number;
serialport: {
baudRate: number,
bufferSize: number
}
bufferSize: number,
};
}
export interface Port
{
comName: string,
interface Port {
comName: string;
}
export interface Version
{
major: number,
minor: number
interface Version {
major: number;
minor: number;
}
// TODO these enums could actually be non-const in the future (provides some benefits) --- TWW
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L449-L464
export const enum PIN_MODE {
const enum PIN_MODE {
INPUT = 0x00,
OUTPUT = 0x01,
ANALOG = 0x02,
@@ -226,30 +270,30 @@ declare namespace Board
UNKNOWN = 0x10,
}
export const enum PIN_STATE {
const enum PIN_STATE {
LOW = 0,
HIGH = 1
}
export const enum REPORTING {
const enum REPORTING {
ON = 1,
OFF = 0,
}
export const enum PULLUP_STATE {
const enum PULLUP_STATE {
ENABLED = 1,
DISABLED = 0,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L474-L478
export const enum STEPPER_TYPE {
const enum STEPPER_TYPE {
DRIVER = 1,
TWO_WIRE = 2,
FOUR_WIRE = 4,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L479-L484
export const enum STEPPER_RUN_STATE {
const enum STEPPER_RUN_STATE {
STOP = 0,
ACCEL = 1,
DECEL = 2,
@@ -257,13 +301,13 @@ declare namespace Board
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L485-L488
export const enum STEPPER_DIRECTION {
const enum STEPPER_DIRECTION {
CCW = 0,
CW = 1,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L466-L471
export const enum I2C_MODE {
const enum I2C_MODE {
WRITE = 0,
READ = 1,
CONTINUOUS_READ = 2,
@@ -271,13 +315,13 @@ declare namespace Board
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L491-L494
export const enum SERIAL_MODE {
const enum SERIAL_MODE {
CONTINUOUS_READ = 0x00,
STOP_READING = 0x01,
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L497-L512
export const enum SERIAL_PORT_ID {
const enum SERIAL_PORT_ID {
HW_SERIAL0 = 0x00,
HW_SERIAL1 = 0x01,
HW_SERIAL2 = 0x02,
@@ -290,7 +334,7 @@ declare namespace Board
}
// https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L515-L524
export const enum SERIAL_PIN_TYPE {
const enum SERIAL_PIN_TYPE {
RES_RX0 = 0x00,
RES_TX0 = 0x01,
RES_RX1 = 0x02,
@@ -300,4 +344,4 @@ declare namespace Board
RES_RX3 = 0x06,
RES_TX3 = 0x07,
}
}
}
-1
View File
@@ -12,4 +12,3 @@ if (input != null) {
}
picker1.destroy();
-1
View File
@@ -1,4 +1,3 @@
import freeport = require('freeport');
let num: number,
+2 -4
View File
@@ -4,9 +4,7 @@ FusionCharts.addEventListener('ready', (eventObject) => {
eventObject.stopPropagation();
});
FusionCharts.ready((fusioncharts) => {
});
FusionCharts.ready((fusioncharts) => {});
FusionCharts.version;
@@ -48,4 +46,4 @@ chart.clone();
chart.zoomTo(0, 3);
chart.zoomOut();
chart.setJSONData(chartData);
chart.ref;
chart.ref;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var charts: (H: FusionChartStatic) => FusionChartStatic;
export = charts;
export as namespace charts;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var gantt: (H: FusionChartStatic) => FusionChartStatic;
export = gantt;
export as namespace gantt;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var maps: (H: FusionChartStatic) => FusionChartStatic;
export = maps;
export as namespace maps;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var powercharts: (H: FusionChartStatic) => FusionChartStatic;
export = powercharts;
export as namespace powercharts;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var ssgrid: (H: FusionChartStatic) => FusionChartStatic;
export = ssgrid;
export as namespace ssgrid;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var treemap: (H: FusionChartStatic) => FusionChartStatic;
export = treemap;
export as namespace treemap;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var widgets: (H: FusionChartStatic) => FusionChartStatic;
export = widgets;
export as namespace widgets;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var zoomscatter: (H: FusionChartStatic) => FusionChartStatic;
export = zoomscatter;
export as namespace zoomscatter;
-7
View File
@@ -3,9 +3,7 @@
// Definitions by: Rohit Kumar <https://github.com/rohitkr>, Shivaraj KV <https://github.com/shivarajkv>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace FusionCharts {
type ChartDataFormats = 'json' | 'jsonurl' | 'csv' | 'xml' | 'xmlurl';
type ImageHAlign = 'left' | 'right' | 'middle';
@@ -33,7 +31,6 @@ declare namespace FusionCharts {
}
interface ChartObject {
type?: string;
id?: string;
@@ -251,7 +248,6 @@ declare namespace FusionCharts {
configure(options: {}): void;
ref: {};
}
interface FusionChartStatic {
@@ -286,10 +282,7 @@ declare namespace FusionCharts {
options: {};
debugger: Debugger;
}
}
declare var FusionCharts: FusionCharts.FusionChartStatic;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var usa: (H: FusionChartStatic) => FusionChartStatic;
export = usa;
export as namespace usa;
-2
View File
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var world: (H: FusionChartStatic) => FusionChartStatic;
export = world;
export as namespace world;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var carbon: (H: FusionChartStatic) => FusionChartStatic;
export = carbon;
export as namespace carbon;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var fint: (H: FusionChartStatic) => FusionChartStatic;
export = fint;
export as namespace fint;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var ocean: (H: FusionChartStatic) => FusionChartStatic;
export = ocean;
export as namespace ocean;
@@ -1,7 +1,5 @@
import { FusionChartStatic } from "fusioncharts";
declare var zune: (H: FusionChartStatic) => FusionChartStatic;
export = zune;
export as namespace zune;
-1
View File
@@ -25,4 +25,3 @@ const dest = mappings[0].dest;
mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
mappings = globule.mapping(['*.js'], ['*.less']);
-1
View File
@@ -84,4 +84,3 @@ interface GlobuleStatic {
declare var globule: GlobuleStatic;
export = globule;
+3 -3
View File
@@ -21,8 +21,8 @@ export class Api extends jspb.Message {
hasSourceContext(): boolean;
clearSourceContext(): void;
getSourceContext(): google_protobuf_source_context_pb.SourceContext;
setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void;
getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined;
setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void;
clearMixinsList(): void;
getMixinsList(): Array<Mixin>;
@@ -48,7 +48,7 @@ export namespace Api {
methodsList: Array<Method.AsObject>,
optionsList: Array<google_protobuf_type_pb.Option.AsObject>,
version: string,
sourceContext: google_protobuf_source_context_pb.SourceContext.AsObject,
sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject,
mixinsList: Array<Mixin.AsObject>,
syntax: google_protobuf_type_pb.Syntax,
}
+10 -10
View File
@@ -34,10 +34,10 @@ export class Version extends jspb.Message {
export namespace Version {
export type AsObject = {
major: number,
minor: number,
patch: number,
suffix: string,
major?: number,
minor?: number,
patch?: number,
suffix?: string,
}
}
@@ -60,7 +60,7 @@ export class CodeGeneratorRequest extends jspb.Message {
hasCompilerVersion(): boolean;
clearCompilerVersion(): void;
getCompilerVersion(): Version;
setCompilerVersion(value: Version): void;
setCompilerVersion(value?: Version): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CodeGeneratorRequest.AsObject;
@@ -75,7 +75,7 @@ export class CodeGeneratorRequest extends jspb.Message {
export namespace CodeGeneratorRequest {
export type AsObject = {
fileToGenerateList: Array<string>,
parameter: string,
parameter?: string,
protoFileList: Array<google_protobuf_descriptor_pb.FileDescriptorProto.AsObject>,
compilerVersion: Version.AsObject,
}
@@ -104,7 +104,7 @@ export class CodeGeneratorResponse extends jspb.Message {
export namespace CodeGeneratorResponse {
export type AsObject = {
error: string,
error?: string,
fileList: Array<CodeGeneratorResponse.File.AsObject>,
}
@@ -136,9 +136,9 @@ export namespace CodeGeneratorResponse {
export namespace File {
export type AsObject = {
name: string,
insertionPoint: string,
content: string,
name?: string,
insertionPoint?: string,
content?: string,
}
}
}
+81 -79
View File
@@ -71,12 +71,12 @@ export class FileDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): FileOptions;
setOptions(value: FileOptions): void;
setOptions(value?: FileOptions): void;
hasSourceCodeInfo(): boolean;
clearSourceCodeInfo(): void;
getSourceCodeInfo(): SourceCodeInfo;
setSourceCodeInfo(value: SourceCodeInfo): void;
setSourceCodeInfo(value?: SourceCodeInfo): void;
hasSyntax(): boolean;
clearSyntax(): void;
@@ -95,8 +95,8 @@ export class FileDescriptorProto extends jspb.Message {
export namespace FileDescriptorProto {
export type AsObject = {
name: string,
package: string,
name?: string,
package?: string,
dependencyList: Array<string>,
publicDependencyList: Array<number>,
weakDependencyList: Array<number>,
@@ -106,7 +106,7 @@ export namespace FileDescriptorProto {
extensionList: Array<FieldDescriptorProto.AsObject>,
options: FileOptions.AsObject,
sourceCodeInfo: SourceCodeInfo.AsObject,
syntax: string,
syntax?: string,
}
}
@@ -149,7 +149,7 @@ export class DescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): MessageOptions;
setOptions(value: MessageOptions): void;
setOptions(value?: MessageOptions): void;
clearReservedRangeList(): void;
getReservedRangeList(): Array<DescriptorProto.ReservedRange>;
@@ -173,7 +173,7 @@ export class DescriptorProto extends jspb.Message {
export namespace DescriptorProto {
export type AsObject = {
name: string,
name?: string,
fieldList: Array<FieldDescriptorProto.AsObject>,
extensionList: Array<FieldDescriptorProto.AsObject>,
nestedTypeList: Array<DescriptorProto.AsObject>,
@@ -208,8 +208,8 @@ export namespace DescriptorProto {
export namespace ExtensionRange {
export type AsObject = {
start: number,
end: number,
start?: number,
end?: number,
}
}
@@ -236,8 +236,8 @@ export namespace DescriptorProto {
export namespace ReservedRange {
export type AsObject = {
start: number,
end: number,
start?: number,
end?: number,
}
}
}
@@ -291,7 +291,7 @@ export class FieldDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): FieldOptions;
setOptions(value: FieldOptions): void;
setOptions(value?: FieldOptions): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FieldDescriptorProto.AsObject;
@@ -305,15 +305,15 @@ export class FieldDescriptorProto extends jspb.Message {
export namespace FieldDescriptorProto {
export type AsObject = {
name: string,
number: number,
label: FieldDescriptorProto.Label,
type: FieldDescriptorProto.Type,
typeName: string,
extendee: string,
defaultValue: string,
oneofIndex: number,
jsonName: string,
name?: string,
number?: number,
label?: FieldDescriptorProto.Label,
type?: FieldDescriptorProto.Type,
typeName?: string,
extendee?: string,
defaultValue?: string,
oneofIndex?: number,
jsonName?: string,
options: FieldOptions.AsObject,
}
@@ -337,6 +337,7 @@ export namespace FieldDescriptorProto {
TYPE_SINT32 = 17,
TYPE_SINT64 = 18,
}
export enum Label {
LABEL_OPTIONAL = 1,
LABEL_REQUIRED = 2,
@@ -353,7 +354,7 @@ export class OneofDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): OneofOptions;
setOptions(value: OneofOptions): void;
setOptions(value?: OneofOptions): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): OneofDescriptorProto.AsObject;
@@ -367,7 +368,7 @@ export class OneofDescriptorProto extends jspb.Message {
export namespace OneofDescriptorProto {
export type AsObject = {
name: string,
name?: string,
options: OneofOptions.AsObject,
}
}
@@ -386,7 +387,7 @@ export class EnumDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): EnumOptions;
setOptions(value: EnumOptions): void;
setOptions(value?: EnumOptions): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): EnumDescriptorProto.AsObject;
@@ -400,7 +401,7 @@ export class EnumDescriptorProto extends jspb.Message {
export namespace EnumDescriptorProto {
export type AsObject = {
name: string,
name?: string,
valueList: Array<EnumValueDescriptorProto.AsObject>,
options: EnumOptions.AsObject,
}
@@ -420,7 +421,7 @@ export class EnumValueDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): EnumValueOptions;
setOptions(value: EnumValueOptions): void;
setOptions(value?: EnumValueOptions): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): EnumValueDescriptorProto.AsObject;
@@ -434,8 +435,8 @@ export class EnumValueDescriptorProto extends jspb.Message {
export namespace EnumValueDescriptorProto {
export type AsObject = {
name: string,
number: number,
name?: string,
number?: number,
options: EnumValueOptions.AsObject,
}
}
@@ -454,7 +455,7 @@ export class ServiceDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): ServiceOptions;
setOptions(value: ServiceOptions): void;
setOptions(value?: ServiceOptions): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ServiceDescriptorProto.AsObject;
@@ -468,7 +469,7 @@ export class ServiceDescriptorProto extends jspb.Message {
export namespace ServiceDescriptorProto {
export type AsObject = {
name: string,
name?: string,
methodList: Array<MethodDescriptorProto.AsObject>,
options: ServiceOptions.AsObject,
}
@@ -493,7 +494,7 @@ export class MethodDescriptorProto extends jspb.Message {
hasOptions(): boolean;
clearOptions(): void;
getOptions(): MethodOptions;
setOptions(value: MethodOptions): void;
setOptions(value?: MethodOptions): void;
hasClientStreaming(): boolean;
clearClientStreaming(): void;
@@ -517,12 +518,12 @@ export class MethodDescriptorProto extends jspb.Message {
export namespace MethodDescriptorProto {
export type AsObject = {
name: string,
inputType: string,
outputType: string,
name?: string,
inputType?: string,
outputType?: string,
options: MethodOptions.AsObject,
clientStreaming: boolean,
serverStreaming: boolean,
clientStreaming?: boolean,
serverStreaming?: boolean,
}
}
@@ -619,21 +620,21 @@ export class FileOptions extends jspb.Message {
export namespace FileOptions {
export type AsObject = {
javaPackage: string,
javaOuterClassname: string,
javaMultipleFiles: boolean,
javaGenerateEqualsAndHash: boolean,
javaStringCheckUtf8: boolean,
optimizeFor: FileOptions.OptimizeMode,
goPackage: string,
ccGenericServices: boolean,
javaGenericServices: boolean,
pyGenericServices: boolean,
deprecated: boolean,
ccEnableArenas: boolean,
objcClassPrefix: string,
csharpNamespace: string,
swiftPrefix: string,
javaPackage?: string,
javaOuterClassname?: string,
javaMultipleFiles?: boolean,
javaGenerateEqualsAndHash?: boolean,
javaStringCheckUtf8?: boolean,
optimizeFor?: FileOptions.OptimizeMode,
goPackage?: string,
ccGenericServices?: boolean,
javaGenericServices?: boolean,
pyGenericServices?: boolean,
deprecated?: boolean,
ccEnableArenas?: boolean,
objcClassPrefix?: string,
csharpNamespace?: string,
swiftPrefix?: string,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
@@ -682,10 +683,10 @@ export class MessageOptions extends jspb.Message {
export namespace MessageOptions {
export type AsObject = {
messageSetWireFormat: boolean,
noStandardDescriptorAccessor: boolean,
deprecated: boolean,
mapEntry: boolean,
messageSetWireFormat?: boolean,
noStandardDescriptorAccessor?: boolean,
deprecated?: boolean,
mapEntry?: boolean,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
}
@@ -738,12 +739,12 @@ export class FieldOptions extends jspb.Message {
export namespace FieldOptions {
export type AsObject = {
ctype: FieldOptions.CType,
packed: boolean,
jstype: FieldOptions.JSType,
lazy: boolean,
deprecated: boolean,
weak: boolean,
ctype?: FieldOptions.CType,
packed?: boolean,
jstype?: FieldOptions.JSType,
lazy?: boolean,
deprecated?: boolean,
weak?: boolean,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
@@ -752,6 +753,7 @@ export namespace FieldOptions {
CORD = 1,
STRING_PIECE = 2,
}
export enum JSType {
JS_NORMAL = 0,
JS_STRING = 1,
@@ -809,8 +811,8 @@ export class EnumOptions extends jspb.Message {
export namespace EnumOptions {
export type AsObject = {
allowAlias: boolean,
deprecated: boolean,
allowAlias?: boolean,
deprecated?: boolean,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
}
@@ -838,7 +840,7 @@ export class EnumValueOptions extends jspb.Message {
export namespace EnumValueOptions {
export type AsObject = {
deprecated: boolean,
deprecated?: boolean,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
}
@@ -866,7 +868,7 @@ export class ServiceOptions extends jspb.Message {
export namespace ServiceOptions {
export type AsObject = {
deprecated: boolean,
deprecated?: boolean,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
}
@@ -899,8 +901,8 @@ export class MethodOptions extends jspb.Message {
export namespace MethodOptions {
export type AsObject = {
deprecated: boolean,
idempotencyLevel: MethodOptions.IdempotencyLevel,
deprecated?: boolean,
idempotencyLevel?: MethodOptions.IdempotencyLevel,
uninterpretedOptionList: Array<UninterpretedOption.AsObject>,
}
@@ -962,12 +964,12 @@ export class UninterpretedOption extends jspb.Message {
export namespace UninterpretedOption {
export type AsObject = {
nameList: Array<UninterpretedOption.NamePart.AsObject>,
identifierValue: string,
positiveIntValue: number,
negativeIntValue: number,
doubleValue: number,
identifierValue?: string,
positiveIntValue?: number,
negativeIntValue?: number,
doubleValue?: number,
stringValue: Uint8Array | string,
aggregateValue: string,
aggregateValue?: string,
}
export class NamePart extends jspb.Message {
@@ -993,8 +995,8 @@ export namespace UninterpretedOption {
export namespace NamePart {
export type AsObject = {
namePart: string,
isExtension: boolean,
namePart?: string,
isExtension?: boolean,
}
}
}
@@ -1060,8 +1062,8 @@ export namespace SourceCodeInfo {
export type AsObject = {
pathList: Array<number>,
spanList: Array<number>,
leadingComments: string,
trailingComments: string,
leadingComments?: string,
trailingComments?: string,
leadingDetachedCommentsList: Array<string>,
}
}
@@ -1122,9 +1124,9 @@ export namespace GeneratedCodeInfo {
export namespace Annotation {
export type AsObject = {
pathList: Array<number>,
sourceFile: string,
begin: number,
end: number,
sourceFile?: string,
begin?: number,
end?: number,
}
}
}
+6 -6
View File
@@ -46,13 +46,13 @@ export class Value extends jspb.Message {
hasStructValue(): boolean;
clearStructValue(): void;
getStructValue(): Struct;
setStructValue(value: Struct): void;
getStructValue(): Struct | undefined;
setStructValue(value?: Struct): void;
hasListValue(): boolean;
clearListValue(): void;
getListValue(): ListValue;
setListValue(value: ListValue): void;
getListValue(): ListValue | undefined;
setListValue(value?: ListValue): void;
getKindCase(): Value.KindCase;
@@ -75,8 +75,8 @@ export namespace Value {
numberValue: number,
stringValue: string,
boolValue: boolean,
structValue: Struct.AsObject,
listValue: ListValue.AsObject,
structValue?: Struct.AsObject,
listValue?: ListValue.AsObject,
}
export enum KindCase {
+10 -9
View File
@@ -23,8 +23,8 @@ export class Type extends jspb.Message {
hasSourceContext(): boolean;
clearSourceContext(): void;
getSourceContext(): google_protobuf_source_context_pb.SourceContext;
setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void;
getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined;
setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void;
getSyntax(): Syntax;
setSyntax(value: Syntax): void;
@@ -45,7 +45,7 @@ export namespace Type {
fieldsList: Array<Field.AsObject>,
oneofsList: Array<string>,
optionsList: Array<Option.AsObject>,
sourceContext: google_protobuf_source_context_pb.SourceContext.AsObject,
sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject,
syntax: Syntax,
}
}
@@ -128,6 +128,7 @@ export namespace Field {
TYPE_SINT32 = 17,
TYPE_SINT64 = 18,
}
export enum Cardinality {
CARDINALITY_UNKNOWN = 0,
CARDINALITY_OPTIONAL = 1,
@@ -152,8 +153,8 @@ export class Enum extends jspb.Message {
hasSourceContext(): boolean;
clearSourceContext(): void;
getSourceContext(): google_protobuf_source_context_pb.SourceContext;
setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void;
getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined;
setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void;
getSyntax(): Syntax;
setSyntax(value: Syntax): void;
@@ -173,7 +174,7 @@ export namespace Enum {
name: string,
enumvalueList: Array<EnumValue.AsObject>,
optionsList: Array<Option.AsObject>,
sourceContext: google_protobuf_source_context_pb.SourceContext.AsObject,
sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject,
syntax: Syntax,
}
}
@@ -214,8 +215,8 @@ export class Option extends jspb.Message {
hasValue(): boolean;
clearValue(): void;
getValue(): google_protobuf_any_pb.Any;
setValue(value: google_protobuf_any_pb.Any): void;
getValue(): google_protobuf_any_pb.Any | undefined;
setValue(value?: google_protobuf_any_pb.Any): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Option.AsObject;
@@ -230,7 +231,7 @@ export class Option extends jspb.Message {
export namespace Option {
export type AsObject = {
name: string,
value: google_protobuf_any_pb.Any.AsObject,
value?: google_protobuf_any_pb.Any.AsObject,
}
}
+7 -6
View File
@@ -170,13 +170,14 @@ export class Map<K, V> {
arr: Array<[K, V]>,
valueCtor?: {new(init: any): V});
toArray(): Array<[K, V]>;
toObject(
toObject(includeInstance?: boolean): Array<[K, V]>;
toObject<VO>(
includeInstance: boolean,
valueToObject: (includeInstance: boolean) => any): Array<[K, V]>;
static fromObject<K, V>(
entries: Array<[K, V]>,
valueToObject: (includeInstance: boolean, valueWrapper: V) => VO): Array<[K, VO]>;
static fromObject<TK, TV>(
entries: Array<[TK, TV]>,
valueCtor: any,
valueFromObject: any): Map<K, V>;
valueFromObject: any): Map<TK, TV>;
getLength(): number;
clear(): void;
del(key: K): boolean;
@@ -186,7 +187,7 @@ export class Map<K, V> {
forEach(
callback: (entry: V, key: K) => void,
thisArg?: {}): void;
set(key: K, value: V): void;
set(key: K, value: V): this;
get(key: K): (V | undefined);
has(key: K): boolean;
}
+5 -5
View File
@@ -27,7 +27,7 @@ export class GraphQLError extends Error {
*
* Enumerable, and appears in the result of JSON.stringify().
*/
locations?: Array<{ line: number, column: number }> | void;
locations?: Array<{ line: number, column: number }> | undefined;
/**
* An array describing the JSON-path into the execution response which
@@ -35,23 +35,23 @@ export class GraphQLError extends Error {
*
* Enumerable, and appears in the result of JSON.stringify().
*/
path?: Array<string | number> | void;
path?: Array<string | number> | undefined;
/**
* An array of GraphQL AST Nodes corresponding to this error.
*/
nodes?: Array<ASTNode> | void;
nodes?: Array<ASTNode> | undefined;
/**
* The source GraphQL document corresponding to this error.
*/
source?: Source | void;
source?: Source | undefined;
/**
* An array of character offsets within the source GraphQL document
* which correspond to this error.
*/
positions?: Array<number> | void;
positions?: Array<number> | undefined;
/**
* The original error thrown from a field resolver during execution.
+8 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for graphql v0.8.2
// Type definitions for graphql 0.9
// Project: https://www.npmjs.com/package/graphql
// Definitions by: TonyYang <https://github.com/TonyPythoneer>, Caleb Meredith <https://github.com/calebmer>, Dominic Watson <https://github.com/intellix>
// Definitions by: TonyYang <https://github.com/TonyPythoneer>, Caleb Meredith <https://github.com/calebmer>, Dominic Watson <https://github.com/intellix>, Firede <https://github.com/firede>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -105,6 +105,12 @@ export {
// Asserts a string is a valid GraphQL name.
assertValidName,
// Compares two GraphQLSchemas and detects breaking changes.
findBreakingChanges,
// Report all deprecated usage within a GraphQL document.
findDeprecatedUsages,
BreakingChange,
IntrospectionDirective,
+1 -1
View File
@@ -85,7 +85,7 @@ export type Token = {
/**
* For non-punctuation tokens, represents the interpreted value of the token.
*/
value: string | void;
value: string | undefined;
/**
* Tokens exist as nodes in a double-linked-list amongst all tokens
+1 -1
View File
@@ -42,7 +42,7 @@ export const QueryDocumentKeys: {
export const BREAK: any;
export function visit(root: any, visitor: any, keyMap: any): any;
export function visit(root: any, visitor: any, keyMap?: any): any;
export function visitInParallel(visitors: any): any;
+8 -3
View File
@@ -126,6 +126,10 @@ export type GraphQLNamedType =
GraphQLEnumType |
GraphQLInputObjectType;
export function isNamedType(type: GraphQLType): boolean;
export function assertNamedType(type: GraphQLType): GraphQLNamedType;
export function getNamedType(type: GraphQLType): GraphQLNamedType;
/**
@@ -237,13 +241,13 @@ export type GraphQLTypeResolver<TSource, TContext> = (
value: TSource,
context: TContext,
info: GraphQLResolveInfo
) => GraphQLObjectType;
) => GraphQLObjectType | string | Promise<GraphQLObjectType | string>;
export type GraphQLIsTypeOfFn<TSource, TContext> = (
source: TSource,
context: TContext,
info: GraphQLResolveInfo
) => boolean;
) => boolean | Promise<boolean>;
export type GraphQLFieldResolver<TSource, TContext> = (
source: TSource,
@@ -265,7 +269,7 @@ export interface GraphQLResolveInfo {
variableValues: { [variableName: string]: any };
}
export type ResponsePath = { prev: ResponsePath, key: string | number } | void;
export type ResponsePath = { prev: ResponsePath, key: string | number } | undefined;
export interface GraphQLFieldConfig<TSource, TContext> {
type: GraphQLOutputType;
@@ -426,6 +430,7 @@ export class GraphQLEnumType {
constructor(config: GraphQLEnumTypeConfig);
getValues(): Array<GraphQLEnumValue>;
getValue(name: string): GraphQLEnumValue;
serialize(value: any): string;
parseValue(value: any): any;
parseLiteral(valueNode: ValueNode): any;
+3 -1
View File
@@ -5,6 +5,7 @@ import {
GraphQLInputType,
GraphQLField,
GraphQLArgument,
GraphQLEnumValue,
GraphQLType,
} from '../type/definition';
import { GraphQLDirective } from '../type/directives';
@@ -30,6 +31,7 @@ export class TypeInfo {
getFieldDef(): GraphQLField<any, any>;
getDirective(): GraphQLDirective;
getArgument(): GraphQLArgument;
getEnumValue(): GraphQLEnumValue;
enter(node: ASTNode): any;
leave(node: ASTNode): any;
}
@@ -40,4 +42,4 @@ export interface getFieldDef {
parentType: GraphQLType,
fieldNode: FieldNode
): GraphQLField<any, any>
}
}
-12
View File
@@ -26,15 +26,3 @@ export function getDescription(node: { loc?: Location }): string;
* document.
*/
export function buildSchema(source: string | Source): GraphQLSchema;
/**
* Given an ast node, returns its string description based on a contiguous
* block full-line of comments preceding it.
*/
export function getDescription(node: { loc?: Location }): string;
/**
* A helper function to build a GraphQLSchema directly from a source
* document.
*/
export function buildSchema(source: string | Source): GraphQLSchema;
+13
View File
@@ -0,0 +1,13 @@
import { GraphQLSchema } from '../type/schema';
import { DocumentNode } from '../language/ast';
import { GraphQLError } from '../error/GraphQLError';
/**
* A validation rule which reports deprecated usages.
*
* Returns a list of GraphQLError instances describing each deprecated use.
*/
export function findDeprecatedUsages(
schema: GraphQLSchema,
ast: DocumentNode
): Array<GraphQLError>
+1 -1
View File
@@ -7,5 +7,5 @@ import { DocumentNode, OperationDefinitionNode } from '../language/ast';
*/
export function getOperationAST(
documentAST: DocumentNode,
operationName: string
operationName?: string
): OperationDefinitionNode;
+3
View File
@@ -73,3 +73,6 @@ export { assertValidName } from './assertValidName';
// Compares two GraphQLSchemas and detects breaking changes.
export { findBreakingChanges } from './findBreakingChanges';
export { BreakingChange } from './findBreakingChanges';
// Report all deprecated usage within a GraphQL document.
export { findDeprecatedUsages } from './findDeprecatedUsages';
+1 -1
View File
@@ -11,7 +11,7 @@ interface HowlerGlobal {
unload(): void;
usingWebAudio: boolean;
noAudio: boolean;
mobileAudioEnable: boolean;
mobileAutoEnable: boolean;
autoSuspend: boolean;
ctx: AudioContext;
masterGain: GainNode;
-1
View File
@@ -34,4 +34,3 @@ interface Options {
}
export function klawSync(root: string, options?: Options): ReadonlyArray<Item>
-1
View File
@@ -3,7 +3,6 @@
// Definitions by: jKey Lu <https://github.com/jkeylu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function compose<T>(middleware: Array<compose.Middleware<T>>): compose.ComposedMiddleware<T>;
declare namespace compose {
+3 -5
View File
@@ -1,15 +1,13 @@
import compose = require('koa-compose');
var fn1: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
const fn1: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
Promise
.resolve(console.log('in fn1'))
.then(() => next());
var fn2: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
const fn2: compose.Middleware<any> = (context: any, next: () => Promise<void>): Promise<any> =>
Promise
.resolve(console.log('in fn2'))
.then(() => next());
var fn = compose([fn1, fn2]);
const fn = compose([fn1, fn2]);
+79 -82
View File
@@ -38,60 +38,60 @@ declare namespace L {
}
namespace LineUtil {
function simplify(points: PointExpression[], tolerance: number): Point[];
function simplify(points: Point[], tolerance: number): Point[];
function pointToSegmentDistance(p: PointExpression, p1: PointExpression, p2: PointExpression): number;
function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number;
function closestPointOnSegment(p: PointExpression, p1: PointExpression, p2: PointExpression): Point;
function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
}
namespace PolyUtil {
function clipPolygon(points: PointExpression[], bounds: BoundsExpression, round?: boolean): Point[];
function clipPolygon(points: Point[], bounds: BoundsExpression, round?: boolean): Point[];
}
class DomUtil {
module DomUtil {
/**
* Get Element by its ID or with the given HTML-Element
*/
static get(element: string | HTMLElement): HTMLElement;
static getStyle(el: HTMLElement, styleAttrib: string): string;
static create(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
static remove(el: HTMLElement): void;
static empty(el: HTMLElement): void;
static toFront(el: HTMLElement): void;
static toBack(el: HTMLElement): void;
static hasClass(el: HTMLElement, name: string): boolean;
static addClass(el: HTMLElement, name: string): void;
static removeClass(el: HTMLElement, name: string): void;
static setClass(el: HTMLElement, name: string): void;
static getClass(el: HTMLElement): string;
static setOpacity(el: HTMLElement, opacity: number): void;
static testProp(props: string[]): string | boolean/*=false*/;
static setTransform(el: HTMLElement, offset: Point, scale?: number): void;
static setPosition(el: HTMLElement, position: Point): void;
static getPosition(el: HTMLElement): Point;
static disableTextSelection(): void;
static enableTextSelection(): void;
static disableImageDrag(): void;
static enableImageDrag(): void;
static preventOutline(el: HTMLElement): void;
static restoreOutline(): void;
function get(element: string | HTMLElement): HTMLElement | null;
function getStyle(el: HTMLElement, styleAttrib: string): string | null;
function create(tagName: string, className?: string, container?: HTMLElement): HTMLElement;
function remove(el: HTMLElement): void;
function empty(el: HTMLElement): void;
function toFront(el: HTMLElement): void;
function toBack(el: HTMLElement): void;
function hasClass(el: HTMLElement, name: string): boolean;
function addClass(el: HTMLElement, name: string): void;
function removeClass(el: HTMLElement, name: string): void;
function setClass(el: HTMLElement, name: string): void;
function getClass(el: HTMLElement): string;
function setOpacity(el: HTMLElement, opacity: number): void;
function testProp(props: string[]): string | false;
function setTransform(el: HTMLElement, offset: Point, scale?: number): void;
function setPosition(el: HTMLElement, position: Point): void;
function getPosition(el: HTMLElement): Point;
function disableTextSelection(): void;
function enableTextSelection(): void;
function disableImageDrag(): void;
function enableImageDrag(): void;
function preventOutline(el: HTMLElement): void;
function restoreOutline(): void;
}
abstract class CRS {
interface CRS {
latLngToPoint(latlng: LatLngExpression, zoom: number): Point;
pointToLatLng(point: PointExpression, zoom: number): LatLng;
project(latlng: LatLngExpression): Point;
project(latlng: LatLng | LatLngLiteral): Point;
unproject(point: PointExpression): LatLng;
scale(zoom: number): number;
zoom(scale: number): number;
getProjectedBounds(zoom: number): Bounds;
distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number;
wrapLatLng(latlng: LatLngExpression): LatLng;
wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng;
code: string;
wrapLng: [number, number];
wrapLat: [number, number];
code?: string;
wrapLng?: [number, number];
wrapLat?: [number, number];
infinite: boolean;
}
@@ -104,10 +104,10 @@ declare namespace L {
}
interface Projection {
project(latlng: LatLngExpression): Point;
project(latlng: LatLng | LatLngLiteral): Point;
unproject(point: PointExpression): LatLng;
bounds: LatLngBounds;
bounds: Bounds;
}
namespace Projection {
@@ -118,7 +118,6 @@ declare namespace L {
class LatLng {
constructor(latitude: number, longitude: number, altitude?: number);
constructor(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number});
equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean;
toString(): string;
distanceTo(otherLatLng: LatLngExpression): number;
@@ -127,7 +126,7 @@ declare namespace L {
lat: number;
lng: number;
alt: number;
alt?: number;
}
interface LatLngLiteral {
@@ -177,9 +176,8 @@ declare namespace L {
class Point {
constructor(x: number, y: number, round?: boolean);
constructor(coords: PointTuple | {x: number, y: number});
clone(): Point;
add(otherPoint: PointExpression): Point; // investigate if this mutates or returns a new instance
add(otherPoint: PointExpression): Point; // non-destructive, returns a new point
subtract(otherPoint: PointExpression): Point;
divideBy(num: number): Point;
multiplyBy(num: number): Point;
@@ -216,8 +214,8 @@ declare namespace L {
intersects(otherBounds: BoundsExpression): boolean;
overlaps(otherBounds: BoundsExpression): boolean;
min: Point;
max: Point;
min?: Point;
max?: Point;
}
type BoundsExpression = Bounds | BoundsLiteral;
@@ -403,7 +401,7 @@ declare namespace L {
addTo(map: Map): this;
remove(): this;
removeFrom(map: Map): this;
getPane(name?: string): HTMLElement;
getPane(name?: string): HTMLElement | undefined;
// Popup methods
bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this;
@@ -413,7 +411,7 @@ declare namespace L {
togglePopup(): this;
isPopupOpen(): boolean;
setPopupContent(content: Content | Popup): this;
getPopup(): Popup;
getPopup(): Popup | undefined;
// Tooltip methods
bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this;
@@ -423,14 +421,14 @@ declare namespace L {
toggleTooltip(): this;
isTooltipOpen(): boolean;
setTooltipContent(content: Content | Tooltip): this;
getTooltip(): Tooltip;
getTooltip(): Tooltip | undefined;
// Extension methods
onAdd(map: Map): this;
onRemove(map: Map): this;
getEvents(): {[name: string]: (event: Event) => void};
getAttribution(): string;
beforeAdd(map: Map): this;
onAdd?: (map: Map) => this;
onRemove?: (map: Map) => this;
getEvents?: () => {[name: string]: (event: Event) => void};
getAttribution?: () => string | null;
beforeAdd?: (map: Map) => this;
}
interface GridLayerOptions {
@@ -454,8 +452,7 @@ declare namespace L {
constructor(options?: GridLayerOptions);
bringToFront(): this;
bringToBack(): this;
getAttribution(): string;
getContainer(): HTMLElement;
getContainer(): HTMLElement | null;
setOpacity(opacity: number): this;
setZIndex(zIndex: number): this;
isLoading(): boolean;
@@ -500,7 +497,7 @@ declare namespace L {
}
interface WMSOptions extends TileLayerOptions {
layers: string;
layers?: string;
styles?: string;
format?: string;
transparent?: boolean;
@@ -547,7 +544,7 @@ declare namespace L {
getBounds(): LatLngBounds;
/** Get the img element that represents the ImageOverlay on the map */
getElement(): HTMLImageElement;
getElement(): HTMLImageElement | undefined;
options: ImageOverlayOptions;
}
@@ -582,7 +579,7 @@ declare namespace L {
setStyle(style: PathOptions): this;
bringToFront(): this;
bringToBack(): this;
getElement(): HTMLElement;
getElement(): Element | undefined;
options: PathOptions;
}
@@ -607,7 +604,7 @@ declare namespace L {
constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
toGeoJSON(): GeoJSONFeature<GeoJSONLineString | GeoJSONMultiLineString>;
feature: GeoJSONFeature<GeoJSONLineString | GeoJSONMultiLineString>;
feature?: GeoJSONFeature<GeoJSONLineString | GeoJSONMultiLineString>;
}
function polyline(latlngs: LatLngExpression[], options?: PolylineOptions): Polyline;
@@ -616,7 +613,7 @@ declare namespace L {
constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
toGeoJSON(): GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;
feature: GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;
feature?: GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;
}
function polygon(latlngs: LatLngExpression[], options?: PolylineOptions): Polygon;
@@ -641,7 +638,7 @@ declare namespace L {
getRadius(): number;
options: CircleMarkerOptions;
feature: GeoJSONFeature<GeoJSONPoint>;
feature?: GeoJSONFeature<GeoJSONPoint>;
}
function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker;
@@ -726,7 +723,7 @@ declare namespace L {
/**
* Returns the layer with the given internal ID.
*/
getLayer(id: number): Layer;
getLayer(id: number): Layer | undefined;
/**
* Returns an array of all the layers added to the group.
@@ -743,7 +740,7 @@ declare namespace L {
*/
getLayerId(layer: Layer): number;
feature: GeoJSONFeatureCollection<GeoJSONGeometryObject> | GeoJSONFeature<GeoJSONMultiPoint> | GeoJSONGeometryCollection;
feature?: GeoJSONFeatureCollection<GeoJSONGeometryObject> | GeoJSONFeature<GeoJSONMultiPoint> | GeoJSONGeometryCollection;
}
/**
@@ -783,7 +780,7 @@ declare namespace L {
*/
function featureGroup(layers?: Layer[]): FeatureGroup;
type StyleFunction = (feature: GeoJSONFeature<GeoJSONGeometryObject>) => PathOptions;
type StyleFunction = (feature?: GeoJSONFeature<GeoJSONGeometryObject>) => PathOptions;
interface GeoJSONOptions extends LayerOptions {
/**
@@ -878,7 +875,7 @@ declare namespace L {
/**
* Reverse of coordsToLatLng
*/
static latLngToCoords(latlng: LatLng): [number, number, number]; // A three tuple can be assigned to a two or three tuple
static latLngToCoords(latlng: LatLng): [number, number] | [number, number, number];
/**
* Reverse of coordsToLatLngs closed determines whether the first point should be
@@ -990,13 +987,13 @@ declare namespace L {
constructor(options?: ControlOptions);
getPosition(): ControlPosition;
setPosition(position: ControlPosition): this;
getContainer(): HTMLElement;
getContainer(): HTMLElement | undefined;
addTo(map: Map): this;
remove(): this;
// Extension methods
onAdd(map: Map): HTMLElement;
onRemove(map: Map): void;
onAdd?: (map: Map) => HTMLElement;
onRemove?: (map: Map) => void;
options: ControlOptions;
}
@@ -1094,11 +1091,11 @@ declare namespace L {
class Popup extends Layer {
constructor(options?: PopupOptions, source?: Layer);
getLatLng(): LatLng;
getLatLng(): LatLng | undefined;
setLatLng(latlng: LatLngExpression): this;
getContent(): Content;
getContent(): Content | ((source: Layer) => Content) | undefined;
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
getElement(): HTMLElement;
getElement(): HTMLElement | undefined;
update(): void;
isOpen(): boolean;
bringToFront(): this;
@@ -1125,11 +1122,11 @@ declare namespace L {
class Tooltip extends Layer {
constructor(options?: TooltipOptions, source?: Layer);
setOpacity(val: number): void;
getLatLng(): LatLng;
getLatLng(): LatLng | undefined;
setLatLng(latlng: LatLngExpression): this;
getContent(): Content;
getContent(): Content | undefined;
setContent(htmlContent: ((source: Layer) => Content) | Content): this;
getElement(): HTMLElement;
getElement(): HTMLElement | undefined;
update(): void;
isOpen(): boolean;
bringToFront(): this;
@@ -1178,8 +1175,8 @@ declare namespace L {
enabled(): boolean;
// Extension methods
addHooks(): void;
removeHooks(): void;
addHooks?: () => void;
removeHooks?: () => void;
}
interface Event {
@@ -1280,7 +1277,7 @@ declare namespace L {
function stop(ev: Event): typeof DomEvent;
function getMousePosition(ev: Event, container?: HTMLElement): Point;
function getMousePosition(ev: {clientX: number, clientY: number} /*MouseEvent from lib.d.ts*/, container?: HTMLElement): Point;
function getWheelDelta(ev: Event): number;
@@ -1350,7 +1347,7 @@ declare namespace L {
/**
* Name of the pane or the pane as HTML-Element
*/
getPane(pane: string | HTMLElement): HTMLElement;
getPane(pane: string | HTMLElement): HTMLElement | undefined;
getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes;
getContainer(): HTMLElement;
whenReady(fn: () => void, context?: any): this;
@@ -1393,7 +1390,7 @@ declare namespace L {
dragging: Handler;
keyboard: Handler;
scrollWheelZoom: Handler;
tap: Handler;
tap?: Handler;
touchZoom: Handler;
options: MapOptions;
@@ -1449,7 +1446,7 @@ declare namespace L {
function icon(options: IconOptions): Icon;
interface DivIconOptions extends BaseIconOptions {
html?: string;
html?: string | false;
bgPos?: PointExpression;
iconSize?: PointExpression;
iconAnchor?: PointExpression;
@@ -1484,11 +1481,11 @@ declare namespace L {
setZIndexOffset(offset: number): this;
setIcon(icon: Icon | DivIcon): this;
setOpacity(opacity: number): this;
getElement(): HTMLElement;
getElement(): HTMLElement | undefined;
// Properties
options: MarkerOptions;
dragging: Handler;
dragging?: Handler;
}
function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker;
@@ -1511,7 +1508,7 @@ declare namespace L {
const any3d: boolean;
const mobile: boolean;
const mobileWebkit: boolean;
const mobiWebkit3d: boolean;
const mobileWebkit3d: boolean;
const mobileOpera: boolean;
const mobileGecko: boolean;
const touch: boolean;
@@ -1530,7 +1527,7 @@ declare namespace L {
function stamp(obj: any): number;
function throttle(fn: () => void, time: number, context: any): () => void;
function wrapNum(num: number, range: number[], includeMax?: boolean): number;
function falseFn(): () => false;
function falseFn(): false;
function formatNum(num: number, digits?: number): number;
function trim(str: string): string;
function splitWords(str: string): string[];
@@ -1541,7 +1538,7 @@ declare namespace L {
function indexOf(array: any[], el: any): number;
function requestAnimFrame(fn: () => void, context?: any, immediate?: boolean): number;
function cancelAnimFrame(id: number): void;
let lastId: string;
let lastId: number;
let emptyImageUrl: string;
}
}
+3 -14
View File
@@ -13,10 +13,6 @@ latLng = L.latLng([12, 13, 0]);
latLng = new L.LatLng(12, 13);
latLng = new L.LatLng(12, 13, 0);
latLng = new L.LatLng(latLngLiteral);
latLng = new L.LatLng({lat: 12, lng: 13, alt: 0});
latLng = new L.LatLng(latLngTuple);
latLng = new L.LatLng([12, 13, 0]);
const latLngBoundsLiteral: L.LatLngBoundsLiteral = [[12, 13], latLngTuple];
@@ -39,8 +35,6 @@ point = L.point({x: 12, y: 13});
point = new L.Point(12, 13);
point = new L.Point(12, 13, true);
point = new L.Point(pointTuple);
point = new L.Point({x: 12, y: 13});
let distance: number;
point.distanceTo(point);
@@ -67,18 +61,13 @@ bounds = new L.Bounds(boundsLiteral);
let points: L.Point[];
points = L.LineUtil.simplify([point, point], 1);
points = L.LineUtil.simplify([pointTuple, pointTuple], 2);
distance = L.LineUtil.pointToSegmentDistance(point, point, point);
distance = L.LineUtil.pointToSegmentDistance(pointTuple, pointTuple, pointTuple);
point = L.LineUtil.closestPointOnSegment(point, point, point);
point = L.LineUtil.closestPointOnSegment(pointTuple, pointTuple, pointTuple);
points = L.PolyUtil.clipPolygon(points, bounds);
points = L.PolyUtil.clipPolygon(points, bounds, true);
points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral);
points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral, true);
let mapOptions: L.MapOptions = {};
mapOptions = {
@@ -275,8 +264,8 @@ L.DomEvent
.disableClickPropagation(htmlElement)
.preventDefault(domEvent)
.stop(domEvent);
point = L.DomEvent.getMousePosition(domEvent);
point = L.DomEvent.getMousePosition(domEvent, htmlElement);
point = L.DomEvent.getMousePosition(domEvent as MouseEvent);
point = L.DomEvent.getMousePosition(domEvent as MouseEvent, htmlElement);
const wheelDelta: number = L.DomEvent.getWheelDelta(domEvent);
map = map
@@ -391,7 +380,7 @@ let twoCoords: [number, number] = [1, 2];
latLng = L.GeoJSON.coordsToLatLng(twoCoords);
twoCoords = L.GeoJSON.latLngToCoords(latLng);
let threeCoords: [number, number, number] = [1, 2, 3];
let threeCoords: [number, number] = [1, 2];
latLng = L.GeoJSON.coordsToLatLng(threeCoords);
threeCoords = L.GeoJSON.latLngToCoords(latLng);
+1 -2
View File
@@ -1,8 +1,7 @@
import leven = require('leven');
leven('baz', 'bar');
// => "1"
leven('foo', 'bar');
// => "3"
// => "3"
@@ -1,4 +1,3 @@
declare const cordovaSQLiteDriver: LocalForageDriver;
() => {
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for lodash.nth 4.0
// Project: http://lodash.com/
// Definitions by: Brian Zengel <https://github.com/bczengel>, Ilya Mochalov <https://github.com/chrootsu>, Stepan Mikhaylyuk <https://github.com/stepancar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import { nth } from "lodash";
export = nth;
+21
View File
@@ -0,0 +1,21 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
-200
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -16,4 +16,4 @@ class Server {
// start the web server
};
}
}
}
+5 -7
View File
@@ -1,9 +1,7 @@
var input = "Someting to compress";
var encoded: string;
var decoded: string;
var encodedU8: Uint8Array;
const input = "Someting to compress";
let encoded: string;
let decoded: string;
let encodedU8: Uint8Array;
encoded = LZString.compress(input);
decoded = LZString.decompress(encoded);
@@ -14,4 +12,4 @@ decoded = LZString.decompressFromBase64(encoded);
encoded = LZString.compressToEncodedURIComponent(input);
decoded = LZString.compressToEncodedURIComponent(encoded);
encodedU8 = LZString.compressToUint8Array(input);
decoded = LZString.decompressFromUint8Array(encodedU8);
decoded = LZString.decompressFromUint8Array(encodedU8);
+14 -17
View File
@@ -1,13 +1,11 @@
declare var $: any;
declare const $: any;
window.alert = (thing?: string) => {
$('#content').append('<div>' + thing + '</div>');
};
$(() => {
var audio = new Audio();
const audio = new Audio();
audio.src = Modernizr.audio.ogg ? 'background.ogg' :
Modernizr.audio.mp3 ? 'background.mp3' :
'background.m4a';
@@ -15,13 +13,13 @@ $(() => {
if (Modernizr.webgl) {
// loadAllWebGLScripts();
} else {
var msg = 'With a different browser youll get to see the WebGL experience here: get.webgl.org.';
const msg = 'With a different browser youll get to see the WebGL experience here: get.webgl.org.';
document.getElementById('#notice').innerHTML = msg;
}
Modernizr.prefixed('boxSizing');
Modernizr.prefixed('requestAnimationFrame', window);
var ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true);
const ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true);
Modernizr.prefixed('requestAnimationFrame', window, false);
Modernizr.mq('only all and (max-width: 400px)');
@@ -29,7 +27,7 @@ $(() => {
Modernizr.mq('only screen and (max-width: 768px)');
Modernizr.addTest('track', () => {
var video = document.createElement('video');
const video = document.createElement('video');
return typeof video.addTextTrack === 'function';
});
@@ -45,7 +43,7 @@ $(() => {
Modernizr.testAllProps('boxSizing');
var elem: Element;
const elem: Element = null as any;
Modernizr.hasEvent('gesturestart', elem);
if (!Modernizr.input.autofocus) {
@@ -53,7 +51,6 @@ $(() => {
}
});
Modernizr.on('flash', result => {
if (result) {
// the browser has flash
@@ -63,22 +60,22 @@ Modernizr.on('flash', result => {
});
Modernizr.addTest('itsTuesday', () => {
var d = new Date();
const d = new Date();
return d.getDay() === 2;
});
Modernizr.addTest('hasJquery', 'jQuery' in window);
var detects = {
const detects = {
hasjquery: 'jQuery' in window,
itstuesday: () => {
var d = new Date();
const d = new Date();
return d.getDay() === 2;
}
};
Modernizr.addTest(detects);
var keyframes = Modernizr.atRule('@keyframes');
const keyframes = Modernizr.atRule('@keyframes');
if (keyframes) {
// keyframes are supported
// could be `@-webkit-keyframes` or `@keyframes`
@@ -92,25 +89,25 @@ Modernizr.hasEvent('blur'); // true;
Modernizr.hasEvent('devicelight', window); // true;
var query = Modernizr.mq('(min-width: 900px)');
const query = Modernizr.mq('(min-width: 900px)');
if (query) {
// the browser window is larger than 900px
}
Modernizr.prefixed('boxSizing');
var raf = Modernizr.prefixed('requestAnimationFrame', window);
const raf = Modernizr.prefixed('requestAnimationFrame', window);
raf(() => {
});
var rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false);
const rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false);
rAFProp === 'WebkitRequestAnimationFrame'; // in older webkit
Modernizr.prefixedCSS('transition'); // '-moz-transition' in old Firefox
Modernizr.prefixedCSSValue('background', 'linear-gradient(left, red, red)');
var rule = Modernizr._prefixes.join('transform: rotate(20deg); ');
let rule = Modernizr._prefixes.join('transform: rotate(20deg); ');
rule === 'transform: rotate(20deg); webkit-transform: rotate(20deg); moz-transform: rotate(20deg); o-transform: rotate(20deg); ms-transform: rotate(20deg);';
rule = 'display:' + Modernizr._prefixes.join('flex; display:') + 'flex';
-1
View File
@@ -104,4 +104,3 @@ export class Server extends EventEmitter {
export function eslSetLogLevel(level: any): void;
export function setLogLevel(level: any): void;
-2
View File
@@ -4,7 +4,6 @@ const freeswitchListener = new modesl.Server(() => {
// console.log('Server listening on localhost at port 8022');
});
const freeswitchConnection = new modesl.Connection("freeswitch-host", 8021, 'password', () => {
// console.log('connection initialized');
@@ -31,4 +30,3 @@ const freeswitchConnection = new modesl.Connection("freeswitch-host", 8021, 'pas
});
});
});
+8 -10
View File
@@ -2,14 +2,12 @@
// Project: https://github.com/jmeas/moment-business
// Definitions by: Greg Sieranski <https://github.com/wonbyte/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as moment from "moment";
declare module "moment-business" {
export function weekDays(startMoment: moment.Moment, endMoment: moment.Moment): number
export function weekendDays(startMoment: moment.Moment, endMoment: moment.Moment): number
export function addWeekDays(moment: moment.Moment, amount: number): moment.Moment
export function subtractWeekDays(moment: moment.Moment, amount: number): moment.Moment
export function isWeekDay(moment: moment.Moment): boolean
export function isWeekendDay(moment: moment.Moment): boolean
}
export function weekDays(startMoment: moment.Moment, endMoment: moment.Moment): number;
export function weekendDays(startMoment: moment.Moment, endMoment: moment.Moment): number;
export function addWeekDays(moment: moment.Moment, amount: number): moment.Moment;
export function subtractWeekDays(moment: moment.Moment, amount: number): moment.Moment;
export function isWeekDay(moment: moment.Moment): boolean;
export function isWeekendDay(moment: moment.Moment): boolean;
@@ -1,9 +1,9 @@
import * as moment from "moment";
import * as mb from "moment-business";
let a = mb.isWeekDay(moment())
let b = mb.isWeekendDay(moment());
let c = mb.addWeekDays(moment(), 1);
let d = mb.subtractWeekDays(moment(), 1);
let e = mb.weekDays(moment(), moment());
let f = mb.weekendDays(moment(), moment());
mb.isWeekDay(moment());
mb.isWeekendDay(moment());
mb.addWeekDays(moment(), 1);
mb.subtractWeekDays(moment(), 1);
mb.weekDays(moment(), moment());
mb.weekendDays(moment(), moment());
+9 -12
View File
@@ -1,18 +1,16 @@
import moment = require('moment-timezone');
var june = moment("2014-06-01T12:00:00Z");
const june = moment("2014-06-01T12:00:00Z");
june.tz('America/Los_Angeles').format('ha z');
var a = moment.tz("2013-11-18 11:55", "America/Toronto");
var b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto");
var c = moment.tz(1403454068850, "America/Toronto");
var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto");
const a = moment.tz("2013-11-18 11:55", "America/Toronto");
const b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto");
const c = moment.tz(1403454068850, "America/Toronto");
const d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto");
a.tz();
var num = 1367337600000,
const num = 1367337600000,
arr = [2013, 5, 1],
str = "2013-12-01",
date = new Date(2013, 4, 1),
@@ -53,7 +51,7 @@ moment.tz(obj, "America/Los_Angeles");
moment.tz.zone('America/Los_Angeles').abbr(1403465838805);
moment.tz.zone('America/Los_Angeles').offset(1403465838805);
var zone = moment.tz.zone('America/New_York');
const zone = moment.tz.zone('America/New_York');
zone.parse(Date.UTC(2012, 2, 19, 8, 30)); // 240
moment.tz.add('America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0');
@@ -80,7 +78,6 @@ moment.tz.setDefault('America/Los_Angeles');
moment.tz.guess();
var zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr();
var zoneName: string = moment.tz('America/Los_Angeles').zoneName();
const zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr();
const zoneName: string = moment.tz('America/Los_Angeles').zoneName();
+76 -71
View File
@@ -3,81 +3,86 @@
// Definitions by: Shinya Mochizuki <https://github.com/enrapt-mochizuki/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface MsgPackStatic {
/**
* @param data string or ByteArray.
* @param toString return string value if true.
*
* @return string or ByteArray or false. pack failed if false.
*/
pack(data: any, toString?: boolean): any;
declare namespace msgpack {
interface MsgPackStatic {
/**
* @param data string or ByteArray.
* @param toString return string value if true.
*
* @return string or ByteArray or false. pack failed if false.
*/
pack(data: any, toString?: boolean): any;
/**
* @param data string or ByteArray.
*
* @return string or ByteArray or undefined. unpack failed if undefined.
*/
unpack(data: any): any;
/**
* @param data string or ByteArray.
*
* @return string or ByteArray or undefined. unpack failed if undefined.
*/
unpack(data: any): any;
worker: string;
worker: string;
upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void;
upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void;
download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void;
download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void;
}
interface MsgPackUploadOption {
/**
* string or ByteArray
*/
data: any;
/**
* use WebWorker if true.
*/
worker?: boolean;
/**
* timeout sec.
*/
timeout?: number;
before?: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => void;
after?: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void;
}
interface MsgPackUploadCallback {
(data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void;
}
interface MsgPackDownloadOption {
/**
* use WebWorker if true.
*/
worker?: boolean;
/**
* timeout sec.
*/
timeout?: number;
before?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void;
after?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void;
}
interface MsgPackDownloadCallback {
/**
* @param data string or ByteArray
*/
(data: any, option: MsgPackDownloadCallback, result: MsgPackCallbackResult): void;
}
interface MsgPackCallbackResult {
status: number;
ok: boolean;
}
}
interface MsgPackUploadOption {
/**
* string or ByteArray
*/
data: any;
declare var msgpack: msgpack.MsgPackStatic;
/**
* use WebWorker if true.
*/
worker?: boolean;
/**
* timeout sec.
*/
timeout?: number;
before?: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => void;
after?: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void;
}
interface MsgPackUploadCallback {
(data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void;
}
interface MsgPackDownloadOption {
/**
* use WebWorker if true.
*/
worker?: boolean;
/**
* timeout sec.
*/
timeout?: number;
before?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void;
after?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void;
}
interface MsgPackDownloadCallback {
/**
* @param data string or ByteArray
*/
(data: any, option: MsgPackDownloadCallback, result: MsgPackCallbackResult): void;
}
interface MsgPackCallbackResult {
status: number;
ok: boolean;
}
declare var msgpack: MsgPackStatic;
export = msgpack;
export as namespace msgpack;
+6 -8
View File
@@ -1,5 +1,3 @@
var packed = msgpack.pack("");
msgpack.unpack(packed);
@@ -12,17 +10,17 @@ var uploadOption = {
data: "",
worker: false,
timeout: 10,
before: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => { },
after: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => { }
before: (xhr: XMLHttpRequest, option: msgpack.MsgPackUploadOption) => { },
after: (xhr: XMLHttpRequest, option: msgpack.MsgPackUploadOption, result: msgpack.MsgPackCallbackResult) => { }
};
var uploadCallback = (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult) => { };
var uploadCallback = (data: string, option: msgpack.MsgPackUploadOption, result: msgpack.MsgPackCallbackResult) => { };
msgpack.upload(url, uploadOption, uploadCallback);
var downloadOption = {
worker: false,
timeout: 10,
before: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => { },
after: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => { }
before: (xhr: XMLHttpRequest, option: msgpack.MsgPackDownloadOption) => { },
after: (xhr: XMLHttpRequest, option: msgpack.MsgPackDownloadOption, result: msgpack.MsgPackCallbackResult) => { }
};
var downloadCallback = (data: any, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => { };
var downloadCallback = (data: any, option: msgpack.MsgPackDownloadOption, result: msgpack.MsgPackCallbackResult) => { };
msgpack.download(url, downloadOption, downloadCallback);
-1
View File
@@ -21,7 +21,6 @@ export interface WavesConfig {
}
export interface RippleOptions {
/**
* Specify how long to wait between starting and stopping the ripple.
*
-1
View File
@@ -1,4 +1,3 @@
import { init, ripple, attach, calm } from "node-waves";
init({ delay: 300 });
+2 -2
View File
@@ -1209,7 +1209,7 @@ declare module "os" {
export function userInfo(options?: { encoding: string }): { username: string, uid: number, gid: number, shell: any, homedir: string }
export var constants: {
UV_UDP_REUSEADDR: number,
errno: {
signals: {
SIGHUP: number;
SIGINT: number;
SIGQUIT: number;
@@ -1245,7 +1245,7 @@ declare module "os" {
SIGSYS: number;
SIGUNUSED: number;
},
signals: {
errno: {
E2BIG: number;
EACCES: number;
EADDRINUSE: number;

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