Skip to content

Commit

Permalink
Merge pull request #595 from recurly/dt-changes
Browse files Browse the repository at this point in the history
Restructures types for DT
  • Loading branch information
chrissrogers authored Apr 15, 2020
2 parents 438785c + 4edc81d commit c1f2546
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 41 deletions.
5 changes: 5 additions & 0 deletions test/types/paypal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ export default function paypal() {
paypal.on('fake-event', () => {});

paypal.start();
paypal.start({
options: {
description: "description"
}
});
paypal.destroy();
}
8 changes: 0 additions & 8 deletions types/emitter.ts

This file was deleted.

38 changes: 20 additions & 18 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,30 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1

import { Recurly } from './recurly';
import { Recurly } from './lib/recurly';

declare global {
interface Window {
recurly: Recurly;
}

const recurly: Recurly;
}

export * from './pricing/checkout';
export * from './pricing/promise';
export * from './pricing/subscription';
export * from './pricing';
export * from './3d-secure';
export * from './address';
export * from './adyen';
export * from './apple-pay';
export * from './bank-account';
export * from './configure';
export * from './elements';
export * from './error';
export * from './gift-card';
export * from './paypal';
export * from './recurly';
export * from './token';
export * from './validate';
export * from './lib/pricing/checkout';
export * from './lib/pricing/promise';
export * from './lib/pricing/subscription';
export * from './lib/pricing/index';
export * from './lib/3d-secure';
export * from './lib/address';
export * from './lib/adyen';
export * from './lib/apple-pay';
export * from './lib/bank-account';
export * from './lib/configure';
export * from './lib/elements';
export * from './lib/error';
export * from './lib/gift-card';
export * from './lib/paypal';
export * from './lib/recurly';
export * from './lib/token';
export * from './lib/validate';
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions types/lib/emitter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type Listener = (...args: any[]) => void;

export interface Emitter<Event = string> {
on(event: Event, listener: Listener): Emitter<Event>;
once(event: Event, listener: Listener): Emitter<Event>;
off(event?: Event, listener?: Listener): Emitter<Event>;
emit(event: Event, ...args: any[]): Emitter<Event>;
listeners(event: Event): Listener[];
hasListeners(event: Event): boolean;
}
File renamed without changes.
2 changes: 1 addition & 1 deletion types/gift-card.ts → types/lib/gift-card.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RecurlyError } from './';
import { RecurlyError } from './error';

export type GiftCardOptions = {
code: string;
Expand Down
8 changes: 7 additions & 1 deletion types/paypal.ts → types/lib/paypal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ export type PayPalConfig = BraintreeConfig | DirectConfig;

export type PayPalEvent = 'error' | 'token';

export type PayPalStartOptions = {
options: {
description: string;
}
};

export interface PayPalInstance extends Emitter<PayPalEvent> {
start: VoidFunction;
start: (payPalStartOptions?: PayPalStartOptions) => void;
token: TokenHandler;
destroy: VoidFunction;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export interface CheckoutPricingMethods {
giftCard: (giftcard: string) => CheckoutPricingPromise;
shippingAddress: (address: Address) => CheckoutPricingPromise;
tax: (tax: Tax) => CheckoutPricingPromise;
subscription: (subscriptionPricing: SubscriptionPricingState | void) => CheckoutPricingPromise;
subscription: (subscriptionPricing: SubscriptionPricingState) => CheckoutPricingPromise;
}

export interface CheckoutPricingInstance extends CheckoutPricingMethods, PricingInstance<CheckoutPricingPromise> {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 0 additions & 12 deletions types/recurly.ts → types/lib/recurly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,3 @@ export interface Recurly extends Emitter<RecurlyEvent> {
token: Token;
validate: Validate;
}

declare global {
interface Window {
recurly: Recurly;
}

namespace Recurly {
type recurly = Recurly;
}

const recurly: Recurly;
}
File renamed without changes.
File renamed without changes.

0 comments on commit c1f2546

Please sign in to comment.