Skip to content

Commit 7298c7b

Browse files
fix: adjust web types to match modified schema
1 parent c890891 commit 7298c7b

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

packages/nextclade-web/src/types.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { get, isBoolean, isFinite, isNil, isNumber, isString, range, sumBy } from 'lodash'
22
import type {
33
Aa,
4-
AnyType,
54
Cds,
65
CdsSegment,
76
Dataset,
87
DatasetsIndexJson,
8+
PathogenJson,
99
FastaRecord,
1010
InsertionFor_Nuc, // eslint-disable-line camelcase
1111
LetterRangeFor_AaAnd_Position, // eslint-disable-line camelcase
1212
LetterRangeFor_NucAnd_Position, // eslint-disable-line camelcase
13-
NextcladeErrorOutputs,
14-
NextcladeOutputs,
1513
NextcladeResult,
14+
ResultJson,
15+
ResultJsonError,
1616
Nuc,
1717
NucDel,
1818
NucSub,
@@ -28,16 +28,18 @@ export function rangeLen(range: Range) {
2828
return range.end - range.begin
2929
}
3030

31+
export type AnyType = unknown
3132
export type Nucleotide = Nuc
3233
export type Aminoacid = Aa
3334
export type NucleotideRange = LetterRangeFor_NucAnd_Position // eslint-disable-line camelcase
3435
export type AminoacidRange = LetterRangeFor_AaAnd_Position // eslint-disable-line camelcase
3536
export type NucleotideInsertion = InsertionFor_Nuc // eslint-disable-line camelcase
3637
export type NucleotideMissing = LetterRangeFor_NucAnd_Position // eslint-disable-line camelcase
37-
export type AnalysisResult = NextcladeOutputs
38-
export type AnalysisError = NextcladeErrorOutputs
38+
export type AnalysisResult = ResultJson
39+
export type AnalysisError = ResultJsonError
3940
export type FastaRecordId = StrictOmit<FastaRecord, 'seq'>
4041
export type DatasetsIndexV2Json = DatasetsIndexJson
42+
export type VirusProperties = PathogenJson
4143

4244
export function cdsNucLength(cds: Cds) {
4345
return sumBy(cds.segments, cdsSegmentNucLength)
@@ -120,27 +122,27 @@ export function areDatasetsEqual(left?: Dataset, right?: Dataset): boolean {
120122
return !isNil(left?.path) && !isNil(right?.path) && left?.path === right?.path
121123
}
122124

123-
export function anyAsStrMaybe(x: AnyType | undefined): string | undefined {
125+
export function anyAsStrMaybe(x: unknown | undefined): string | undefined {
124126
return isString(x) ? x : undefined
125127
}
126128

127-
export function anyAsNumberMaybe(x: AnyType | undefined): number | undefined {
129+
export function anyAsNumberMaybe(x: unknown | undefined): number | undefined {
128130
return isNumber(x) && isFinite(x) ? x : undefined
129131
}
130132

131-
export function anyAsBoolMaybe(x: AnyType | undefined): boolean | undefined {
133+
export function anyAsBoolMaybe(x: unknown | undefined): boolean | undefined {
132134
return isBoolean(x) ? x : undefined
133135
}
134136

135-
export function attrStrMaybe(attributes: Record<string, AnyType> | undefined, name: string): string | undefined {
137+
export function attrStrMaybe(attributes: Record<string, unknown> | undefined, name: string): string | undefined {
136138
return anyAsStrMaybe(get(attributes, name))
137139
}
138140

139-
export function attrNumberMaybe(attributes: Record<string, AnyType> | undefined, name: string): number | undefined {
141+
export function attrNumberMaybe(attributes: Record<string, unknown> | undefined, name: string): number | undefined {
140142
return anyAsNumberMaybe(get(attributes, name))
141143
}
142144

143-
export function attrBoolMaybe(attributes: Record<string, AnyType> | undefined, name: string): boolean | undefined {
145+
export function attrBoolMaybe(attributes: Record<string, unknown> | undefined, name: string): boolean | undefined {
144146
return anyAsBoolMaybe(get(attributes, name))
145147
}
146148

0 commit comments

Comments
 (0)