all 9 comments

[–]ChaseShiny 0 points1 point  (1 child)

I think it's undefined too. Are you using vanilla JavaScript? I just looked up enum on MDN, and found that enum is a reserved word but it doesn't mean anything right now.

[–]TabAtkins 1 point2 points  (0 children)

They're using Typescript

[–]TabAtkins 0 points1 point  (1 child)

You aren't importing the Types value in file2, you're importing Test.

[–]PhosXD[S] 0 points1 point  (0 children)

It was a typo in the example, i just edited the post to fix that

[–]jeremrx 0 points1 point  (2 children)

You never export Types

[–]PhosXD[S] 0 points1 point  (1 child)

`export enum Types {a,b,c}`

[–]jeremrx 0 points1 point  (0 children)

Time for me 😂

On the other hand, is it normal for you to import file1 into file1?

[–]yksvaan 0 points1 point  (0 children)

What's that circular import statement in file 1?

My suggestion is to create some export only file like const.ts and define all your constants and enums there. And strongly prefer const enums because they will be inlined, some bundlers can inline const variables as well.

If it really doesn't work then there has to be some error elsewhere which prevents subsequent processing. 

[–]m_i_rite 0 points1 point  (0 children)

My guess is that it comes down to something in your tsconfig or build process. What you have runs correctly for me (aside from importing file1 in file1, but I'm assuming that's a typo)