-
Notifications
You must be signed in to change notification settings - Fork 12
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
Check the number of type parameters before handling the Range type #45
Check the number of type parameters before handling the Range type #45
Conversation
Hmm. Looks like the |
I ran I also ran |
Very weird. There are new tests failing. Do they fail on your system? |
Looking at the workflow logs, it seems the test is failing during the execution of I tried a solution in the forked repository. |
Oops, it seems the e2e test is still failing even after upgrading the Node version. I'll create a Pull Request to address this workflow issue. |
I have created a Pull Request to fix the workflow. Please review it. Once the workflow completes without errors, it should be easier to review and accept this Pull Request. |
Thanks for this! And thank you for adding tests right from the start :-D |
There is an issue where a user-defined
Range
type is incorrectly treated asstd::ops::Range
.The behavior differs depending on whether the type has exactly one type parameter or not, but in either case, the user-defined
Range
is ignored.Example: A panic occurs when there are no type parameters.
When the
Range
type is specified for a field in a struct, Tsify expects it to have one type parameter.However, a user-defined Range type without type parameters causes a panic.
Example: When there is one type parameter, it is treated as
std::ops::Range
.Generated
.d.ts
file:This issue arises because the system cannot correctly determine whether
Range
refers to a user-defined type orstd::ops::Range
.Unfortunately, avoiding this issue when there is exactly one type parameter seems difficult.
On the other hand, for cases with a different number of type parameters, the distinction is straightforward. Clearly,
Range
orRange<T, U>
should not be interpreted asstd::ops::Range
.Adding a guard to
TsType::from_name()
to handle cases with exactly one type parameter may provide a solution to this problem.