Conversation
| return compareTypes(elementType, input.elementType); | ||
| } | ||
| else { | ||
| } else { |
There was a problem hiding this comment.
Add subtyping here too
|
I skimmed the code...just realized, there's probably not a clean way to throw a runtime error if a |
|
On second thought though, could statements like |
|
@jedwards1211 what about casting to any? It should basically unfreeze array which is impossible to do, that's why I'm having concern with it |
|
Ok, I see that |
|
Oh, it can trace assignments with Babel? var foo: string;
foo = 1;was converted to import t from "flow-runtime";
var _fooType = t.string(),
foo;
foo = _fooType.assert(1); |
|
Right you can look up where an identifier was declared using |
|
@jedwards1211 can I check what type annotation it has? This would work for |
|
@gajus what would you think about just using the same runtime type as |
|
Sounds acceptable. |
|
@goodmind I was thinking about this again because I use a lot of readonly types nowadays. It wouldn't actually make sense to insert any runtime checks for modifications on readonly-typed expressions, because such code paths would always throw (it's never in the developer's interest to write such a code path). For that reason it's really better to just rely on Flow to catch such cases, and not do anything special with the read-only status in |

Any-casting seems problematic with
Object.freezeIssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor