forked from mystiq/hydrogen-web
Convert enum.js to ts
This commit is contained in:
parent
0e18247184
commit
ebd1caf6d1
1 changed files with 1 additions and 4 deletions
|
@ -14,12 +14,9 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
export function createEnum(...values) {
|
||||
export function createEnum(...values: string[]): Readonly<{}> {
|
||||
const obj = {};
|
||||
for (const value of values) {
|
||||
if (typeof value !== "string") {
|
||||
throw new Error("Invalid enum value name" + value?.toString());
|
||||
}
|
||||
obj[value] = value;
|
||||
}
|
||||
return Object.freeze(obj);
|
Loading…
Reference in a new issue