(
t: Type,
anyType: (anyType: PrimitiveType) => U,
nullType: (nullType: PrimitiveType) => U,
boolType: (boolType: PrimitiveType) => U,
integerType: (integerType: PrimitiveType) => U,
doubleType: (doubleType: PrimitiveType) => U,
stringType: (stringType: PrimitiveType) => U,
arrayType: (arrayType: ArrayType) => U,
classType: (classType: ClassType) => U,
mapType: (mapType: MapType) => U,
enumType: (enumType: EnumType) => U,
unionType: (unionType: UnionType) => U,
stringTypeMatchers?: StringTypeMatchers<U>
)
| 489 | } |
| 490 | |
| 491 | export function matchType<U>( |
| 492 | t: Type, |
| 493 | anyType: (anyType: PrimitiveType) => U, |
| 494 | nullType: (nullType: PrimitiveType) => U, |
| 495 | boolType: (boolType: PrimitiveType) => U, |
| 496 | integerType: (integerType: PrimitiveType) => U, |
| 497 | doubleType: (doubleType: PrimitiveType) => U, |
| 498 | stringType: (stringType: PrimitiveType) => U, |
| 499 | arrayType: (arrayType: ArrayType) => U, |
| 500 | classType: (classType: ClassType) => U, |
| 501 | mapType: (mapType: MapType) => U, |
| 502 | enumType: (enumType: EnumType) => U, |
| 503 | unionType: (unionType: UnionType) => U, |
| 504 | stringTypeMatchers?: StringTypeMatchers<U> |
| 505 | ): U { |
| 506 | if (stringTypeMatchers === undefined) { |
| 507 | stringTypeMatchers = {}; |
| 508 | } |
| 509 | const typeNotSupported = (_: Type) => { |
| 510 | return panic("Unsupported PrimitiveType"); |
| 511 | }; |
| 512 | return matchTypeExhaustive( |
| 513 | t, |
| 514 | anyType, |
| 515 | nullType, |
| 516 | boolType, |
| 517 | integerType, |
| 518 | doubleType, |
| 519 | stringType, |
| 520 | arrayType, |
| 521 | classType, |
| 522 | mapType, |
| 523 | enumType, |
| 524 | unionType, |
| 525 | stringTypeMatchers.dateType || typeNotSupported, |
| 526 | stringTypeMatchers.timeType || typeNotSupported, |
| 527 | stringTypeMatchers.dateTimeType || typeNotSupported |
| 528 | ); |
| 529 | } |
| 530 | |
| 531 | export function matchCompoundType( |
| 532 | t: Type, |
no test coverage detected
searching dependent graphs…