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

Remove @ts-expect-error assigned from required & requiredAsync function overloads #939

Open
EltonLobo07 opened this issue Nov 22, 2024 · 1 comment
Assignees
Labels
fix A smaller enhancement or bug fix

Comments

@EltonLobo07
Copy link
Contributor

The code related to the required and requiredAsync function overloads generates a type error with a vague message: This overload signature is not compatible with its implementation signature. The source code looks correct, and after a few experiments, I was unable to figure out the issue associated with the type error. The type error might be unnecessary and incorrect, but I am not sure. The purpose of this GitHub issue is to work together and figure out the root cause of the type error. The relevant source code can be found here.

@EltonLobo07
Copy link
Contributor Author

Since the types that are transformed are generic objects that are used to create new generic objects with some overridden properties, the type checker is unable to prove the transformation is safe. One possible solution that gets rid of the type error is to completely create a new object type without any transformation of the input as shown in the image below. image Then using it as shown in the image below. image The problem with this solution is that we will have to specify all of the known properties, which can be a maintenance burden.

@fabian-hiller fabian-hiller changed the title Remove @ts-expect-error assigned to required & requiredAsync function overloads Remove @ts-expect-error assigned from required & requiredAsync function overloads Nov 22, 2024
@fabian-hiller fabian-hiller self-assigned this Nov 22, 2024
@fabian-hiller fabian-hiller added the fix A smaller enhancement or bug fix label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A smaller enhancement or bug fix
Projects
None yet
Development

No branches or pull requests

2 participants