Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make typescript param optional #788

Merged
merged 1 commit into from
Jan 31, 2020
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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ and instantiate it as `new Stripe()` with the latest API version.
import Stripe from 'stripe';
const stripe = new Stripe('sk_test_...', {
apiVersion: '2019-12-03',
typescript: true,
});

const createCustomer = async () => {
Expand Down Expand Up @@ -174,7 +173,7 @@ const stripe = Stripe('sk_test_...', {
| `timeout` | 120000 (Node default timeout) | [Maximum time each request can take in ms.](#configuring-timeout) |
| `host` | `'api.stripe.com'` | Host that requests are made to. |
| `port` | 443 | Port that requests are made to. |
| `telemetry` | `true` | Allow Stripe to send latency [telemetry](#request-latency-telemetry). |
| `telemetry` | `true` | Allow Stripe to send latency [telemetry](#request-latency-telemetry). |

Note: Both `maxNetworkRetries` and `timeout` can be overridden on a per-request basis.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ env.config();

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY, {
apiVersion: '2019-12-03',
typescript: true,
});

const webhookSecret: string = process.env.STRIPE_WEBHOOK_SECRET;
Expand Down
4 changes: 2 additions & 2 deletions types/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ declare module 'stripe' {
apiVersion: LatestApiVersion;

/**
* Indicate that you are using TypeScript.
* Optionally indicate that you are using TypeScript.
* This currently has no runtime effect other than adding "TypeScript" to your user-agent.
*/
typescript: true;
typescript?: true;

/**
* Enables automatic network retries with exponential backoff, up to the specified number of retries (default 0).
Expand Down
1 change: 0 additions & 1 deletion types/test/typescriptTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Stripe from 'stripe';

let stripe = new Stripe('sk_test_123', {
apiVersion: '2019-12-03',
typescript: true,
});

// @ts-ignore lazily ignore apiVersion requirement.
Expand Down