Skip to content

Commit 41068ae

Browse files
chore!: zod and node version upgrade (#38)
* Update zod to v4 and set as peerDependency * Use zod v 4.1.11 * Upgrade node version * Use node v22 for workflows as well
1 parent 690726d commit 41068ae

11 files changed

Lines changed: 32 additions & 27 deletions

File tree

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v1
12-
- name: install node v20
12+
- name: install node v22
1313
uses: actions/setup-node@v1
1414
with:
15-
node-version: 20
15+
node-version: 22
1616
- uses: actions/cache@v4
1717
with:
1818
path: '**/node_modules'

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
if: ${{ steps.release.outputs.release_created }}
2424
- uses: actions/setup-node@v4
2525
with:
26-
node-version: 20
26+
node-version: 22
2727
registry-url: 'https://registry.npmjs.org'
2828
if: ${{ steps.release.outputs.release_created }}
2929
- run: yarn install --frozen-lockfile

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"lib"
2020
],
2121
"devDependencies": {
22-
"@tsconfig/recommended": "^1.0.8",
22+
"@tsconfig/node22": "^22.0.2",
2323
"@types/jest": "^29.5.14",
2424
"@types/lodash": "^4.17.15",
2525
"@typescript-eslint/eslint-plugin": "^8.23.0",
@@ -31,10 +31,13 @@
3131
"jest": "^29.7.0",
3232
"prettier": "^3.4.2",
3333
"ts-jest": "^29.2.5",
34-
"typescript": "^5.7.3"
34+
"typescript": "^5.7.3",
35+
"zod": "^4.1.11"
3536
},
3637
"dependencies": {
37-
"lodash": "^4.17.21",
38-
"zod": "^3.24.1"
38+
"lodash": "^4.17.21"
39+
},
40+
"peerDependencies": {
41+
"zod": "^4.1.11"
3942
}
4043
}

src/error-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {z} from 'zod';
1+
import {z} from 'zod/v4';
22

33
/** https://github.com/AtB-AS/amp-rs/blob/main/amp-http/src/lib.rs */
44
export const HttpError = z.object({

src/fare-contract/__tests__/fixtures/carnet-farecontact.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {FareContractType} from '../../types';
1+
import {FareContractType, TravelRightType} from '../../types';
22
import {carnetTravelRight} from './carnet-travelright';
33

44
export const carnetFareContract: FareContractType = {
@@ -13,6 +13,6 @@ export const carnetFareContract: FareContractType = {
1313
customerAccountId: 'ATB:CustomerAccount:Qw3fhcJudvgCYR7yHScbFd1mPtP2',
1414
orderId: 'E69J9NJH',
1515
created: new Date(Date.now() - 1000 * 60 * 60 * 10), // 10 hours ago
16-
travelRights: [carnetTravelRight],
16+
travelRights: [carnetTravelRight as unknown as TravelRightType],
1717
totalTaxAmount: '46.07',
1818
};

src/fare-contract/__tests__/fixtures/period-boat-farecontract.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {FareContractType} from '../../types';
1+
import {FareContractType, TravelRightType} from '../../types';
22
import {periodBoatTravelRight} from './period-boat-travelright';
33

44
export const periodBoatFareContract: FareContractType = {
@@ -13,6 +13,6 @@ export const periodBoatFareContract: FareContractType = {
1313
customerAccountId: 'ATB:CustomerAccount:Qw3fhcJudvgCYR7yHScbFd1mPtP2',
1414
orderId: '8MTTWRI4',
1515
created: new Date(Date.now() - 1000 * 60 * 60 * 10), // 10 hours ago
16-
travelRights: [periodBoatTravelRight],
16+
travelRights: [periodBoatTravelRight as unknown as TravelRightType],
1717
totalTaxAmount: '895.82',
1818
};

src/fare-contract/__tests__/travelrights.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ describe('Travelright type', () => {
1818
expect(TravelRightType.safeParse(nightTravelRight).success).toBe(true);
1919
expect(TravelRightType.safeParse(periodTravelRight).success).toBe(true);
2020
expect(
21-
TravelRightType.safeParse(periodBoatTravelRight as TravelRightType)
22-
.success,
21+
TravelRightType.safeParse(
22+
periodBoatTravelRight as unknown as TravelRightType,
23+
).success,
2324
).toBe(true);
2425
expect(TravelRightType.safeParse(singleTravelRight).success).toBe(true);
2526
expect(
26-
TravelRightType.safeParse(singleBoatTravelRight as TravelRightType)
27-
.success,
27+
TravelRightType.safeParse(
28+
singleBoatTravelRight as unknown as TravelRightType,
29+
).success,
2830
).toBe(true);
2931
expect(TravelRightType.safeParse(youthTravelRight).success).toBe(true);
3032
expect(TravelRightType.safeParse(carnetTravelRight).success).toBe(true);

src/fare-contract/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {z} from 'zod';
1+
import {z} from 'zod/v4';
22
import {nullishToOptional} from '../utils';
33

44
export enum TravelRightStatus {

src/offers/ticket-offer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {z} from 'zod';
1+
import {z} from 'zod/v4';
22
import {nullishToOptional} from '../utils';
33

44
/**

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "@tsconfig/recommended/tsconfig.json",
2+
"extends": "@tsconfig/node22/tsconfig.json",
33
"compilerOptions": {
44
"outDir": "./lib",
55
"declaration": true

0 commit comments

Comments
 (0)