-
Notifications
You must be signed in to change notification settings - Fork 8
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
StrictExtends
is laxer than Extends
#37
Comments
I agree. The logic is a little fuzzy when it comes to functions - this was initially conceived more as a checker for plain objects and performs best with those, but I would like to cover as many edge cases as possible. It might require some careful thought and design though. I am maintaining this library in bursts, and I am a forgetful person, so would you mind opening up a PR containing a failing test to illustrate this point unambiguously (and more importantly - permanently, since the test can remain in the git history once it's made to pass)? |
Having said that, it's beyond the scope of this library to provide a carefully-designed utility type library. I'll be adding a note to the docs warning about this in #16 to close this issue. That PR also renames |
Hi, I was trying to use the
Extends
types (see #36) and ran into some unexpected behavior withStrictExtends
.My understanding is strict extension should be a subset of normal extension. That is to say, there should be no cases where a type strict extends another type, but does not traditionally extend it. If that is not the case, I would greatly appreciate some explanation on what these edge cases are.
Example:
My understanding is that is caused by this line: https://github.com/mmkal/expect-type/blob/main/src/index.ts#L43C11
It spreads the params + return equally.
extends
of methods is a bit counter intuitive.In order for method A to extend B:
ReturnType<A> extends ReturnType<B>
)Parameters<B> extends Parameters<A>
)The text was updated successfully, but these errors were encountered: