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

Updated API version in types/lib.d.ts #2218

Merged
merged 1 commit into from
Oct 30, 2024
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
5 changes: 1 addition & 4 deletions scripts/updateAPIVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const read = (file) => fs.readFileSync(path.resolve(file)).toString();
const write = (file, str) => fs.writeFileSync(path.resolve(file), str);
const edit = (file, cb) => write(file, cb(read(file)));

const API_VERSION = '2[0-9][2-9][0-9]-[0-9]{2}-[0-9]{2}';
const API_VERSION = '2[0-9][2-9][0-9]-[0-9]{2}-[0-9]{2}.[a-z]+';

const main = () => {
const matches = [
Expand Down Expand Up @@ -36,9 +36,6 @@ const main = () => {
);
});

replaceAPIVersion('README.md', 'apiVersion: [\'"]API_VERSION[\'"]');
replaceAPIVersion('package.json', '"types": "types/API_VERSION/index.d.ts');

replaceAPIVersion(
'types/lib.d.ts',
'export type LatestApiVersion = [\'"]API_VERSION[\'"]'
Expand Down
2 changes: 1 addition & 1 deletion types/lib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare module 'stripe' {
}): (...args: any[]) => Response<ResponseObject>; //eslint-disable-line @typescript-eslint/no-explicit-any
static MAX_BUFFERED_REQUEST_METRICS: number;
}
export type LatestApiVersion = '2024-09-30.acacia';
export type LatestApiVersion = '2024-10-28.acacia';
export type HttpAgent = Agent;
export type HttpProtocol = 'http' | 'https';

Expand Down
6 changes: 3 additions & 3 deletions types/test/typescriptTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Stripe from 'stripe';

let stripe = new Stripe('sk_test_123', {
apiVersion: '2024-09-30.acacia',
apiVersion: '2024-10-28.acacia',
});

stripe = new Stripe('sk_test_123');
Expand All @@ -26,7 +26,7 @@ stripe = new Stripe('sk_test_123', {

// Check config object.
stripe = new Stripe('sk_test_123', {
apiVersion: '2024-09-30.acacia',
apiVersion: '2024-10-28.acacia',
typescript: true,
maxNetworkRetries: 1,
timeout: 1000,
Expand All @@ -44,7 +44,7 @@ stripe = new Stripe('sk_test_123', {
description: 'test',
};
const opts: Stripe.RequestOptions = {
apiVersion: '2024-09-30.acacia',
apiVersion: '2024-10-28.acacia',
};
const customer: Stripe.Customer = await stripe.customers.create(params, opts);

Expand Down
Loading