-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add types for rrecognized version commit (#81)
- Loading branch information
Showing
4 changed files
with
63 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
import { DataPortalProps } from "../../common/types/entities"; | ||
|
||
const VERSION_ONES = ["1.0.0", "1.1.0"]; | ||
const VERSION_TWOS = ["2.0.0"]; | ||
|
||
export function checkValidVersion(corporaProps: any) { | ||
export function checkValidVersion(corporaProps: DataPortalProps): boolean { | ||
if (!corporaProps) return false; | ||
|
||
// eslint-disable-next-line @typescript-eslint/naming-convention -- prop from BE | ||
const { version, schema_version } = corporaProps; | ||
const { version, schema_version: schemaVersion } = corporaProps; | ||
|
||
const isValidVersionOne = VERSION_ONES.includes( | ||
version?.corpora_schema_version | ||
); | ||
const isValidVersionTwo = VERSION_TWOS.includes(schema_version); | ||
const isValidVersionTwo = VERSION_TWOS.includes(schemaVersion); | ||
|
||
return isValidVersionOne || isValidVersionTwo; | ||
} |