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

runtimeType usage #100

Closed
creativecreatorormaybenot opened this issue Jan 20, 2021 · 1 comment
Closed

runtimeType usage #100

creativecreatorormaybenot opened this issue Jan 20, 2021 · 1 comment

Comments

@creativecreatorormaybenot

This is more of a question as I am not sure:

The package extensively uses runtimeType for equality. Is this safe to do?

Concern

See the first comment to the answer here:

RuntimeType is only for debugging purposes and the application code shouldn't depend on it. It can be overridden by classes to return fake values and probably returns unusable values when transpiled to JS – Günter Zöchbauer Mar 11 '16 at 21:33

Type checks

Why do we not use a type parameter for type checking? :)

@felangel
Copy link
Owner

We're just comparing runtimeTypes in order to ensure the types are identical which should be safe. Type checks aren't sufficient on their own because subclasses will still be considered equal if we only rely on type checks.

Closing for now but happy to continue the discussion if you have additional thoughts.

See also #175

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

No branches or pull requests

2 participants