@@ -10,16 +10,20 @@ const packagePaths = [
1010 "packages/hebrew/package.json" ,
1111 "packages/hijri/package.json" ,
1212 "packages/persian/package.json" ,
13- ] ;
13+ ] as const ;
1414
15- function readPackageJson ( packagePath ) {
15+ function readPackageJson ( packagePath : string ) : {
16+ version : string ;
17+ peerDependencies ?: Record < string , string > ;
18+ } {
1619 const filePath = new URL ( packagePath , repoRoot ) ;
17- return JSON . parse ( readFileSync ( filePath , "utf8" ) ) ;
20+ return JSON . parse ( readFileSync ( filePath , "utf8" ) ) as {
21+ version : string ;
22+ peerDependencies ?: Record < string , string > ;
23+ } ;
1824}
1925
20- const rootVersion = readPackageJson (
21- "packages/react-day-picker/package.json" ,
22- ) . version ;
26+ const rootVersion = readPackageJson ( packagePaths [ 0 ] ) . version ;
2327
2428for ( const packagePath of packagePaths . slice ( 1 ) ) {
2529 const packageJson = readPackageJson ( packagePath ) ;
@@ -28,6 +32,7 @@ for (const packagePath of packagePaths.slice(1)) {
2832 `Expected ${ path . dirname ( packagePath ) } version ${ rootVersion } , got ${ packageJson . version } .` ,
2933 ) ;
3034 }
35+
3136 if ( packageJson . peerDependencies ?. [ "react-day-picker" ] !== rootVersion ) {
3237 throw new Error (
3338 `Expected ${ path . dirname ( packagePath ) } peer dependency react-day-picker=${ rootVersion } , got ${ packageJson . peerDependencies ?. [ "react-day-picker" ] } .` ,
0 commit comments