8000 fix: clean core types by wooorm-arcjet · Pull Request #4500 · arcjet/arcjet-js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: clean core types #4500

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
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

fix: clean core types #4500

wants to merge 28 commits into from

Conversation

wooorm-arcjet
Copy link
Member

Last week I noticed, while working on the tests, that the types could be better.
I looked at them, yesterday, and today. And am finding a lot of room for improvement.
There are many type parameters which are either not used, or in some cases incorrect.
There are also many “wrapper” types, which can be inlined, resulting in less code and shorter “stack” traces.

I am sharing this PR before it becomes bigger. It is already bigger than would be nice. But, there is still lot more to do. And it’s all tiny commits. So separate PRs would take a while to merge. I can do that though.

@wooorm-arcjet wooorm-arcjet requested a review from a team as a code owner June 24, 2025 14:48
Copy link
trunk-io bot commented Jun 24, 2025

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@blaine-arcjet
Copy link
Contributor

As you've now noticed by the failing tests, these generics are all used for type inference on the SDK. They provide the necessary context to augment the protect() function's signature.

@blaine-arcjet
Copy link
Contributor

As far as I'm aware, TypeScript doesn't have something like Rust's PhantomData type (probably because it doesn't need it).

8000
@wooorm-arcjet
Copy link
Member Author
wooorm-arcjet commented Jun 24, 2025

Ah, I only tested the main project, I need to look at those then too.
In many cases they can be replaced by infer.
Though, this is exactly why I want to do it now: I believe we can do without them.

@wooorm-arcjet
Copy link
Member Author

also want to add that sometimes typescript failing is a good thing: I’ll have to look into this better though

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

Successfully merging this pull request may close these issues.

2 participants
0