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

Proposal: Implement autocompletion for OverrideProperties #711

Closed
henriqueinonhe opened this issue Oct 15, 2023 · 1 comment · Fixed by #712
Closed

Proposal: Implement autocompletion for OverrideProperties #711

henriqueinonhe opened this issue Oct 15, 2023 · 1 comment · Fixed by #712

Comments

@henriqueinonhe
Copy link
Contributor

Currently, while OverrideProperties restricts the keys you can override to the keys that are present in the type you pass (TOriginal), it doesn't offer autocomplete:

image

image

But with a simple tweak we can enable autocompletion:

image

Here's a demo showcasing the implementation:

https://stackblitz.com/edit/typescript-zyn86c?file=index.ts

This implementation keeps keys "strict", in the sense that you cannot override/add keys that are not present in the original type.

If maintainers agree that this is a good improvement, I can create a PR.

@sindresorhus
Copy link
Owner

PR welcome

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 a pull request may close this issue.

2 participants