Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow const enum to be visible to TypeScript #74

Open
singpolyma opened this issue Jun 18, 2024 · 2 comments
Open

Allow const enum to be visible to TypeScript #74

singpolyma opened this issue Jun 18, 2024 · 2 comments
Assignees

Comments

@singpolyma
Copy link

Instead of just using number type could generate a TypeScript-side const enum like hxtsdgen does

@benmerckx
Copy link
Owner

Do you have an example of what you'd consider a const enum in Haxe? https://haxe.org/manual/types-abstract-enum.html?

@singpolyma
Copy link
Author

For example this:

enum abstract MessageDirection(Int) {
	var MessageReceived;
	var MessageSent;
}

with hxtsdgen gives me this:

export namespace snikket {
	export const enum MessageDirection {
		MessageReceived = 0,
		MessageSent = 1,
	}
}

so that I can reference the enum items by name in typescript instead of needing to use the raw numbers.

@benmerckx benmerckx self-assigned this Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants