Can a function return arrays or maps of enum Types?


#1

I want to do something like this:

type EnumArrayTest {
  enumArray: function (): [DataSourceType] js server
}

---

function enumArray() {
  return [DataSourceType.FILE_SOURCE_SYSTEM];
}

but when I run EnumArrayTest.enumArray(), I get EnumArrayTest.enumArray: Unable to convert JavaScript java.lang.String value to expected DataSourceType

(DataSourceType is an enum type in the platformCommon package.)


#2

The return type should be [string enum DataSourceType]

type EnumArrayTest {
  enumArray: function (): [string enum DataSourceType] js server
}