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

Preserve parameter inference #8

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

prndP
Copy link

@prndP prndP commented Jun 24, 2023

Hey there. Great library. I've been using it to help speed up converting an old legacy codebase that had a ton of shady as any casting.

One corner case I ran into:

interface SomeInterface {
  setter: (p: number) => number;
  value: number;
}

const test: SomeInterface = fromPartial({ setter: (p) => p + 1 });

Will throw TS7006: Parameter 'p' implicitly has an 'any' type when it could have been inferred.

Adding an inference for the parameter seems to have fixed it without breaking the rest of my tests. Not sure if it will cover all your use cases as well.

Cheers

@mattpocock
Copy link
Collaborator

This looks neat - could you add test cases for this?

@mattpocock mattpocock self-requested a review June 24, 2023 13:05
Copy link
Collaborator

@mattpocock mattpocock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests requested in comment above

@prndP
Copy link
Author

prndP commented Jun 26, 2023

Tests requested in comment above

Done!

@prndP prndP requested a review from mattpocock June 26, 2023 15:26
@prndP
Copy link
Author

prndP commented Jul 11, 2024

Hey @mattpocock just wondering if you had a chance to look at this one again. No rush, I'm sure you're quite busy

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