-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Types with index signatures lose all attribute signatures when using keyof or Omit #43478
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
Comments
This is working as intended. What search terms did you use to look for existing issues? |
I wrote a tool that converts some properties of an object into optional, but it doesn't work. type PartPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
interface Route {
name: string;
path: string;
href?: string;
exact?: boolean;
strict?: boolean;
[key: string]: string | boolean | undefined | object;
}
type RouteNode = PartPartial<Route, 'name'>; And the same type PartRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>; But type PartRequired<T, K extends keyof T> = T & Required<Pick<T, K>>; |
See the existing issues: #43139, #40999, etc. Issue #41966 mentions a workaround for this behavior (by excluding the index signature from the type). |
@MartinJohns 3Q~ |
Bug Report
💻 Code
🙁 Actual behavior
Lose all attribute signatures
🙂 Expected behavior
Do not lose attribute signatures
The text was updated successfully, but these errors were encountered: