Fixed typescript build

This commit is contained in:
Ozzie Gooen 2022-07-20 08:27:57 -07:00
parent 1c4557b638
commit 078534f7c8
2 changed files with 82 additions and 72 deletions

View File

@ -120,6 +120,10 @@ function createTsExport(
x: expressionValue,
environment: environment
): squiggleExpression {
switch (x) {
case "EvVoid":
return tag("void", "");
default: {
switch (x.tag) {
case "EvArray":
// genType doesn't convert anything more than 2 layers down into {tag: x, value: x}
@ -153,7 +157,8 @@ function createTsExport(
return tag("number", x.value);
case "EvRecord":
// genType doesn't support records, so we have to do the raw conversion ourself
let result: tagged<"record", { [key: string]: squiggleExpression }> = tag(
let result: tagged<"record", { [key: string]: squiggleExpression }> =
tag(
"record",
_.mapValues(x.value, (x: unknown) =>
convertRawToTypescript(x as rescriptExport, environment)
@ -173,8 +178,10 @@ function createTsExport(
case "EvTypeIdentifier":
return tag("typeIdentifier", x.value);
case "EvType":
let typeResult: tagged<"type", { [key: string]: squiggleExpression }> =
tag(
let typeResult: tagged<
"type",
{ [key: string]: squiggleExpression }
> = tag(
"type",
_.mapValues(x.value, (x: unknown) =>
convertRawToTypescript(x as rescriptExport, environment)
@ -193,4 +200,6 @@ function createTsExport(
);
return moduleResult;
}
}
}
}

View File

@ -131,7 +131,8 @@ export type squiggleExpression =
| tagged<"record", { [key: string]: squiggleExpression }>
| tagged<"type", { [key: string]: squiggleExpression }>
| tagged<"typeIdentifier", string>
| tagged<"module", { [key: string]: squiggleExpression }>;
| tagged<"module", { [key: string]: squiggleExpression }>
| tagged<"void", string>;
export { lambdaValue };