Skip to content
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

Check types based on type.name equality in addition referential equality #51

Closed
wants to merge 1 commit into from

Conversation

wbecker
Copy link

@wbecker wbecker commented Sep 15, 2015

This is sometimes necessary if referential equality is broken, eg when
types are proxied.

Fixes #48

This is sometimes necessary if referential equality is broken, eg when
types are proxied.
@SimonNodel-AI
Copy link

👍

Please merge, we are experiencing same problem on several teams in different environments.

@tkissing
Copy link

tkissing commented Oct 8, 2015

Can we get this merged please?

@othiym23 othiym23 self-assigned this Oct 30, 2015
@othiym23
Copy link
Contributor

I'll review this, and because it has a test, it's pretty much ready to merge. It would be nice to get a quick update to the docs referencing this change, if one of you has a minute. The change makes this either semver-patch or semver-major, depending on how it affects existing code.

@wbecker
Copy link
Author

wbecker commented Oct 30, 2015

Cool! I'll have a look over the weekend for you

On Fri, 30 Oct 2015, 22:24 Forrest L Norvell notifications@github.com
wrote:

I'll review this, and because it has a test, it's pretty much ready to
merge. It would be nice to get a quick update to the docs referencing this
change, if one of you has a minute. The change makes this either
semver-patch or semver-major, depending on how it affects existing code.


Reply to this email directly or view it on GitHub
#51 (comment).

@wbecker
Copy link
Author

wbecker commented Oct 31, 2015

So - having a look at the docs - I don't think this warrants a change to documentation, it's just fixing a rare edge case where the strict equality test doesn't pass, in certain scenarios where types have got a bit messed up.

It would be worth putting in a changelog, but you don't seem to have one going for this project. Could start one if you think it is necessary.

This should be a semver-patch change, as it just is a bug fix that just makes things slightly more permissive.

@othiym23
Copy link
Contributor

After taking a look at the docs, I agree (although at some point it would probably save somebody some time were we to document how nopt compares type equality, because there are so many subtly incompatible ways to do that). Landed as 0af9e18 and included in nopt@3.0.5, just published. Thanks for this, and thanks for your patience!

@othiym23 othiym23 closed this Nov 12, 2015
@othiym23
Copy link
Contributor

Woops, needed a little more fixup because of some insufficiently strict guards: 8900f8e. Landed as part of a quickly-released nopt@3.0.6.

othiym23 added a commit to npm/npm that referenced this pull request Nov 12, 2015
@tkissing
Copy link

Nitpick: Only one of the .name checks in (type && type.name && t.type && t.type.name) is actually needed (because you compare the two .name properties with === later, which can't be true if only one is truthy)

In all seriousness: Thanks for getting this merged and released, much appreciated.

othiym23 added a commit to npm/npm that referenced this pull request Dec 11, 2015
Check types based on type name as well as referential equality.

Fixes: npm/nopt#48
Credit: @wbecker
Reviewed-By: @othiym23
PR-URL: npm/nopt#51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants