-
-
Notifications
You must be signed in to change notification settings - Fork 548
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
OverrideProperties
and Merge
don't retain callable aspect of type
#969
Comments
Was playing around with using this trick to retain the callable type, but it doesn't retain generic type parameters if the function is generic |
I think this is the most related TypeScript comment/issue |
This is a really tricky one. I'm not sure if we can do anything here right now. Maybe you can work around this one, with something like this: import type { OverrideProperties, Merge } from 'type-fest'
type MyCallable = {
(): void
}
type CallableWithProperty = MyCallable & {
property: number
}
type Overridden = OverrideProperties<CallableWithProperty, { property: string }> & MyCallable
declare const overridden: Overridden
overridden()
type Merged = Merge<CallableWithProperty, { property2: string }> & MyCallable
declare const merged: Merged
merged() |
Bug description
See the playground
Repro
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBDAnmApnA3nA8gNxVKYAExQAUoJVZgUBnAGjgFl8BzNAXzgDMKQ4A5ElQBabnRgCAsAChZwtAGEAhgBtVygEaqUAdWAwAFuUr4kcALwZZASAAUASgBccHBGK2wFKkhcA7AFcQTXxZDll5ZDRcfEIiEj9LbDwCYjJvMxpaAB4VdS0dfSMTH0RGTC9TWEQXWhhCP1Y4DgA+WTgOuAB6LrgAPQB+WRIAYw0oNBGIPzq4CBS4hJcY1PiUP1keuABlQwgA1SI4ELgRtQ1tFEZNAPhWCHhlRNjoWXnY4gTHCJkFZjYUEcrCwoOxcucCnoDMYMtVynBKqUAEy1erARrNNoyTrdXqDYYoMbKCanaazEAAoguEHsIibXq7faHY6TCGXa63OD3R7PAivGQU0GA74yIA
Upvote & Fund
The text was updated successfully, but these errors were encountered: