-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Functions should not match {[key: string]: any}
type
#946
Comments
From IRC:
|
@samwgoldman was this addressed by #984? |
@danvk I don't think so. At least, that wasn't my intention. |
Is there any way to create a typedef specifying a parameter should be an Object but not a Function? This otherwise makes it impossible to properly make a distinction between |
I found a way to make this work: type GenericMap<T> = {[key: string]: T} & {$call?: void}; |
This is valid behavior for object types. You could also use an exact object type. |
@STRML thanks for the solution. Please fix your code snippet for further googlers. - type GenericMap<T> = {[key: string}: T} & {$call?: void};
^
+ type GenericMap<T> = {[key: string]: T} & {$call?: void}; |
Good catch, thanks. |
I'm surprised that this snippet type checks:
In what sense is a function type the same as an object type?
The text was updated successfully, but these errors were encountered: