Skip to content

Commit e91435c

Browse files
cleanup wrapDef a little more
1 parent 1d58a8f commit e91435c

File tree

1 file changed

+4
-7
lines changed
  • packages/malloy/src/dialect/functions

1 file changed

+4
-7
lines changed

packages/malloy/src/dialect/functions/util.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -746,21 +746,18 @@ export function wrapDef(
746746
const generic: {[name: string]: TypeDescElementBlueprintOrNamedGeneric[]} =
747747
{};
748748
for (const argVal of Object.values(takes)) {
749-
const genericRefs = Array.from(tdLeafTypes(argVal)).filter(
750-
(t: TypeDescBlueprint): t is NamedGeneric => {
751-
return typeof t !== 'string' && 'generic' in t;
749+
for (const leafType of tdLeafTypes(argVal)) {
750+
if (typeof leafType !== 'string' && 'generic' in leafType) {
751+
generic[leafType.generic] = ['any'];
752752
}
753-
);
754-
for (const genericRef of genericRefs) {
755-
generic[genericRef.generic] = ['any'];
756753
}
757754
}
758755
const newDef: DefinitionBlueprint = {
759756
takes,
760757
returns,
761758
impl: {function: name.toUpperCase()},
762759
};
763-
// avoids constructing an erray just to test the length
760+
// avoids constructing an array just to test the length
764761
for (const _atLeastOneGeneric in generic) {
765762
newDef.generic = generic;
766763
break;

0 commit comments

Comments
 (0)