Skip to content

Commit 4ef73a1

Browse files
feat: Change CustomData type definition (#188)
1 parent 5e16df9 commit 4ef73a1

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ adding additional type guards.
2626

2727
- Added support for new payment methods `blik`, `mb_way`, `pix` and `upi`. See [related changelog](https://developer.paddle.com/changelog/2025/blik-mbway-payment-methods).
2828

29+
### Changed
30+
31+
- `CustomData` type definition is now `Record<string, any>`
32+
33+
---
34+
2935
## 3.2.1 - 2025-08-26
3036

3137
### Fixed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { CustomData } from '../../entities/index.js';
2+
3+
interface IMyCustomData {
4+
customer_reference_id: string;
5+
}
6+
7+
describe('CustomData', () => {
8+
test('without casting to a custom type', () => {
9+
const customData: CustomData = { customer_reference_id: 'abcd1234' };
10+
11+
expect(customData['customer_reference_id']).toBe('abcd1234');
12+
});
13+
14+
test('casts to a custom type', () => {
15+
const customData: CustomData = { customer_reference_id: 'abcd1234' };
16+
const myCustomData = customData as IMyCustomData;
17+
18+
expect(myCustomData?.customer_reference_id).toBe('abcd1234');
19+
});
20+
});

src/entities/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ export * from './simulation/index.js';
2828
export * from './simulation-run/index.js';
2929
export * from './simulation-run-event/index.js';
3030

31-
export type CustomData = object;
31+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
32+
export type CustomData = Record<string, any>;

src/types/shared/custom-data.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
* Changes may be overwritten as part of auto-generation.
55
*/
66

7-
export type ICustomData = object;
7+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
8+
export type ICustomData = Record<string, any>;

0 commit comments

Comments
 (0)