1

I have an enum type with many items and therefore I want to put the definition in an individual file. The type is defined as

const enum Band {
  B2190m = '2190m',
  B631m  = '631m',
   // ... etc. many more
};

However, trying to export this by export or export default fails with "Expression expected" TS1109. What is the correct way to do this?

Thank you.

1 Answer 1

1

const enum is inlined while transpilation to js, so can't be exported. You should emit "const" and use just enum:

export enum Band {
...
Sign up to request clarification or add additional context in comments.

1 Comment

Hello, unfortunately it doesn't work for "plain enum", either. That was actually my first attempt, later I tried const enum as another possibility. I suspect there is some piece of TS documentation that I missed or did not understand. Never mind, I will read through the docs again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.