#343 Compare option types properly (#354)

This commit is contained in:
Dima 2021-11-02 17:18:18 +03:00 committed by GitHub
parent 73f46c6897
commit 3c7d81ba17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import aqua.backend.ts.TypeScriptCommon.fnDef
import aqua.model.transform.res.ServiceRes
case class TSServiceTypes(srv: ServiceRes) extends ServiceTypes {
import TypeScriptTypes._
import TypeScriptTypes.*
private val serviceTypeName = s"${srv.name}Def";
@ -49,18 +49,18 @@ case class TSServiceTypes(srv: ServiceRes) extends ServiceTypes {
.mkString("\n")
}
def exportInterface = {
private def exportInterface = {
val fnDefs = srv.members.map { case (name, arrow) =>
s"${typed(name, fnDef(arrow))};"
s" ${typed(name, fnDef(arrow))};"
}
.mkString("\n")
s"""export interface ${serviceTypeName} {
| ${fnDefs}
|${fnDefs}
|}""".stripMargin
}
def generate = {
def generate: String = {
s"""$exportInterface
|$registerServiceArgs
"""

View File

@ -114,6 +114,7 @@ object CompareTypes {
case (x: ArrayType, y: ArrayType) => apply(x.element, y.element)
case (x: ArrayType, y: StreamType) => apply(x.element, y.element)
case (x: ArrayType, y: OptionType) => apply(x.element, y.element)
case (x: OptionType, y: OptionType) => apply(x.element, y.element)
case (x: OptionType, y: StreamType) => apply(x.element, y.element)
case (x: OptionType, y: ArrayType) => apply(x.element, y.element)
case (x: StreamType, y: StreamType) => apply(x.element, y.element)