Skip to content

TypeScript support #131

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

Open
jaysylvester opened this issue Oct 16, 2024 · 3 comments
Open

TypeScript support #131

jaysylvester opened this issue Oct 16, 2024 · 3 comments

Comments

@jaysylvester
Copy link
Owner

See title.

@Dimava
Copy link

Dimava commented Oct 16, 2024

I'm interested in trying to try to implement this
Mostly to see how the "old-school app servers" worked

With --experimental-strip-types node doesn't even need anything else to run TS

I'll make a draft PR tomorrow so you're able to see how typescript changes this codebase

I've looked up the code
It uses a lot of ||, are they actually intended to be || or they are intended to be ?? (as || also applies to false so you can't disable stuff on case by case basis)
In some cases there are foo || bar ? a : b which gets parsed as (foo || bar) ? a : b, please add brackets there

@jaysylvester
Copy link
Owner Author

The || logic is all correct (no bugs or unexpected behavior as far as I know), but there are probably suboptimal examples (or perhaps code others consider problematic that I don't find objectionable) I've avoided touching because they currently work as expected.

Are you looking to make it compatible with apps written in TS or changing citizen itself to be written in TS?

@Dimava
Copy link

Dimava commented Oct 17, 2024

I'm "rewriting" it to node-compatible TS (basically just adding variable types)
Then it can compiled back to JS with something like https://bloomberg.github.io/ts-blank-space/ + d.ts if needed

Rewriting + compiling to d.ts is somewhat easier then just adding d.ts as it immediately errors if types don't match

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants