Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/braintree/braintree-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const gateway: BraintreeGateway = new braintree.BraintreeGateway({

// Plan Gateway
(async () => {
// $ExpectType { plans: Plan[]; }
// $ExpectType Plan[];
await gateway.plan.all();
})();

Expand Down
94 changes: 76 additions & 18 deletions types/braintree/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ declare namespace braintree {
voidedAt: RangeFieldSearchFn<Date>;
}) => void;

export type DisputeSearchFn = (search: {
status: MultiValueSearchFn<DisputeStatus>;
}) => void;

export type GatewayConfig = KeyGatewayConfig | ClientGatewayConfig | AccessTokenGatewayConfig;

export class Environment {
Expand Down Expand Up @@ -262,7 +266,7 @@ declare namespace braintree {
finalize(disputeId: string): Promise<ValidatedResponse<Dispute>>;
find(disputeId: string): Promise<Dispute>;
removeEvidence(disputeId: string, evidenceId: string): Promise<ValidatedResponse<Dispute>>;
search(searchFn: any): stream.Readable;
search(searchFn: DisputeSearchFn): stream.Readable;
}

interface MerchantAccountGateway {
Expand Down Expand Up @@ -307,7 +311,10 @@ declare namespace braintree {
}

interface PlanGateway {
all(): Promise<{ plans: Plan[] }>;
all(): Promise<Plan[]>;
find(planId: string): Promise<Plan>;
create(request: PlanCreateRequest): Promise<ValidatedResponse<Plan>>;
update(planId: string, updates: PlanCreateRequest): Promise<ValidatedResponse<Plan>>;
}

interface SettlementBatchSummaryGateway {
Expand All @@ -318,14 +325,14 @@ declare namespace braintree {
}

interface SubscriptionGateway {
cancel(subscriptionId: string): Promise<void>;
cancel(subscriptionId: string): Promise<Subscription>;
create(request: SubscriptionCreateRequest): Promise<ValidatedResponse<Subscription>>;
find(subscriptionId: string): Promise<Subscription>;
retryCharge(
subscriptionId: string,
amount?: string,
submitForSettlement?: boolean,
): Promise<ValidatedResponse<Subscription>>;
): Promise<ValidatedResponse<Transaction>>;
search(searchFn: any): stream.Readable;
update(subscriptionId: string, updates: SubscriptionUpdateRequest): Promise<ValidatedResponse<Subscription>>;
}
Expand Down Expand Up @@ -1269,6 +1276,36 @@ declare namespace braintree {
updatedAt: string;
}

export interface PlanCreateRequest {
addOns?:
| {
add?: AddOnAddRequest[] | undefined;
remove?: string[] | undefined;
update?: AddOnUpdateRequest[] | undefined;
}[]
| undefined;
billingDayOfMonth?: number | string | undefined;
billingFrequency: number | string;
currencyIsoCode: string;
description?: string | undefined;
discounts?:
| {
add?: DiscountAddRequest[] | undefined;
remove?: string[] | undefined;
update?: DiscountUpdateRequest[] | undefined;
}[]
| undefined;
id?: string | undefined;
modificationTokens?: string | undefined;
name: string;
neverExpires?: boolean | string | undefined;
numberOfBillingCycles?: number | string | undefined;
price: string | number;
trialDuration?: number | undefined;
trialDurationUnit?: string | undefined;
trialPeriod?: boolean | undefined;
}

/**
* Settlement Batch Summary
*/
Expand Down Expand Up @@ -2306,20 +2343,41 @@ declare namespace braintree {
* Errors
*/

export interface AuthenticationError extends Error {}
export interface AuthorizationError extends Error {}
export interface GatewayTimeoutError extends Error {}
export interface InvalidChallengeError extends Error {}
export interface InvalidKeysError extends Error {}
export interface InvalidSignatureError extends Error {}
export interface NotFoundError extends Error {}
export interface RequestTimeoutError extends Error {}
export interface ServerError extends Error {}
export interface ServiceUnavailableError extends Error {}
export interface TestOperationPerformedInProductionError extends Error {}
export interface TooManyRequestsError extends Error {}
export interface UnexpectedError extends Error {}
export interface UpgradeRequired extends Error {}
type ErrorType =
| "authenticationError"
| "authorizationError"
| "gatewayTimeoutError"
| "invalidChallengeError"
| "invalidKeysError"
| "invalidSignatureError"
| "notFoundError"
| "requestTimeoutError"
| "serverError"
| "serviceUnavailableError"
| "testOperationPerformedInProductionError"
| "tooManyRequestsError"
| "unexpectedError"
| "upgradeRequired";

export interface BraintreeError<T extends ErrorType> extends Error {
type: T;
}
export interface AuthenticationError extends BraintreeError<"authenticationError"> {}
export interface AuthorizationError extends BraintreeError<"authorizationError"> {}
export interface GatewayTimeoutError extends BraintreeError<"gatewayTimeoutError"> {}
export interface InvalidChallengeError extends BraintreeError<"invalidChallengeError"> {}
export interface InvalidKeysError extends BraintreeError<"invalidKeysError"> {}
export interface InvalidSignatureError extends BraintreeError<"invalidSignatureError"> {}
export interface NotFoundError extends BraintreeError<"notFoundError"> {}
export interface RequestTimeoutError extends BraintreeError<"requestTimeoutError"> {}
export interface ServerError extends BraintreeError<"serverError"> {}
export interface ServiceUnavailableError extends BraintreeError<"serviceUnavailableError"> {}
export interface TestOperationPerformedInProductionError
extends BraintreeError<"testOperationPerformedInProductionError">
{}
export interface TooManyRequestsError extends BraintreeError<"tooManyRequestsError"> {}
export interface UnexpectedError extends BraintreeError<"unexpectedError"> {}
export interface UpgradeRequired extends BraintreeError<"upgradeRequired"> {}

/**
* Validation errors
Expand Down
4 changes: 4 additions & 0 deletions types/office-js-preview/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24625,6 +24625,10 @@ declare namespace Office {
*
* **Important**
*
* - The `errorMessageMarkdown` property is available for preview in Outlook on Mac starting in Version 16.103 (Build 25102433). To test the property, join the
* {@link https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756 | Microsoft 365 Insider program} and
* select the **Beta Channel** option to access Office beta builds.
*
* - The formatted error message must be 500 characters or less.
*
* - For guidance on supported Markdown elements, see
Expand Down
4 changes: 4 additions & 0 deletions types/office-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23846,6 +23846,10 @@ declare namespace Office {
*
* **Important**
*
* - The `errorMessageMarkdown` property is available for preview in Outlook on Mac starting in Version 16.103 (Build 25102433). To test the property, join the
* {@link https://techcommunity.microsoft.com/kb/microsoft-365-insider-kb/join-the-microsoft-365-insider-program-on-macos/4401756 | Microsoft 365 Insider program} and
* select the **Beta Channel** option to access Office beta builds.
*
* - The formatted error message must be 500 characters or less.
*
* - For guidance on supported Markdown elements, see
Expand Down
49 changes: 26 additions & 23 deletions types/string-pixel-width/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
export = getWidth;

declare function getWidth(string: string, settings?: Settings): number;
declare function getWidth(string: string, settings?: getWidth.Settings): number;

interface Settings {
bold?: boolean | undefined;
font?:
| "andale mono"
| "arial"
| "avenir"
| "avenir next"
| "comic sans ms"
| "courier new"
| "georgia"
| "helvetica"
| "impact"
| "open sans"
| "quantify"
| "tahoma"
| "times new roman"
| "trebuchet ms"
| "verdana"
| "webdings"
| undefined;
italic?: boolean | undefined;
size?: number | undefined;
declare namespace getWidth {
interface Settings {
bold?: boolean | undefined;
font?:
| "andale mono"
| "arial"
| "avenir"
| "avenir next"
| "comic sans ms"
| "courier new"
| "georgia"
| "helvetica"
| "impact"
| "inter"
| "times new roman"
| "trebuchet ms"
| "verdana"
| "webdings"
| "open sans"
| "tahoma"
| "quantify"
| undefined;
italic?: boolean | undefined;
size?: number | undefined;
}
}
2 changes: 1 addition & 1 deletion types/string-pixel-width/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/string-pixel-width",
"version": "1.10.9999",
"version": "1.11.9999",
"projects": [
"https://github.com/adambisek/string-pixel-width#readme"
],
Expand Down
37 changes: 24 additions & 13 deletions types/string-pixel-width/string-pixel-width-tests.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import stringPixelWidth = require("string-pixel-width");
import stringPixelWidth, { Settings } from "string-pixel-width";

// $ExpectType number
stringPixelWidth("test");
// $ExpectType number
stringPixelWidth("test", {});
// $ExpectType number
stringPixelWidth("test", { bold: true });
// $ExpectType number
stringPixelWidth("test", { font: "arial" });
// $ExpectType number
stringPixelWidth("test", { italic: true });
// $ExpectType number
stringPixelWidth("test", { size: 10 });
let x: number;
x = stringPixelWidth("test");
x = stringPixelWidth("test", {} satisfies Settings);
x = stringPixelWidth("test", { bold: true });
x = stringPixelWidth("test", { italic: true });
x = stringPixelWidth("test", { size: 10 });
x = stringPixelWidth("test", { font: "andale mono" });
x = stringPixelWidth("test", { font: "arial" });
x = stringPixelWidth("test", { font: "avenir" });
x = stringPixelWidth("test", { font: "avenir next" });
x = stringPixelWidth("test", { font: "comic sans ms" });
x = stringPixelWidth("test", { font: "courier new" });
x = stringPixelWidth("test", { font: "georgia" });
x = stringPixelWidth("test", { font: "helvetica" });
x = stringPixelWidth("test", { font: "impact" });
x = stringPixelWidth("test", { font: "inter" });
x = stringPixelWidth("test", { font: "times new roman" });
x = stringPixelWidth("test", { font: "trebuchet ms" });
x = stringPixelWidth("test", { font: "verdana" });
x = stringPixelWidth("test", { font: "webdings" });
x = stringPixelWidth("test", { font: "open sans" });
x = stringPixelWidth("test", { font: "tahoma" });
x = stringPixelWidth("test", { font: "quantify" });