-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Describing an overridden but incompatible method signature in an ambient class #6094
Comments
Current winrt.d.ts in DefinitelyTyped have manually added ES5 compatible Array methods on IVectorView interface but that will:
|
I've answered on http://stackoverflow.com/a/34299582/4386952. In general, it seems strange that the library authors disregarded the implementation - but that's the thing. We require all derived signatures to be compatible in an ambient class even if a library author is doing shenanigans, and we should discuss whether that should be the case. |
@DanielRosenwasser It helps me a lot, thanks! 👍 My thought: abstract class PnpObjectCollection extends Array<PnpObject> {
/* suppress signature confliction error */
override indexOf(value: Windows.Devices.Enumeration.Pnp.PnpObject): { index: number; returnValue: boolean; };
}
let collection: PnpObjectCollection;
let ary: Array<PnpObject>
ary = collection; // error
collection = ary; // error |
Answer on SO is generally correct, as well as the observation that you don't really need to |
@RyanCavanaugh I think I need to |
From SO: http://stackoverflow.com/questions/34087631
This is the current generated code by expressing UWP PnpObjectCollection.
PnpObjectCollection.prototype.__proto__ === Array
is true here so I addedextends Array
but as you see the signature ofindexOf
method conflicts.30+ classes in entire d.ts file have this problem, so how can I express this class without errors? I cannot add
indexOf(value: T, fromIndex: number): number
line because callingindexof(value, 0)
returns an object, not a number.The text was updated successfully, but these errors were encountered: