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

🏗️ Update transform-amp-asserts to leave devAsserts #26357

Merged
merged 2 commits into from
Jan 15, 2020

Conversation

jridgewell
Copy link
Contributor

This is necessary for Closure to correctly narrow the type of the value.

If we were to remove the devAssert(foo) call, then closure would not be able to tell that foo is truthy. This doesn't matter for assertBoolean/assertString/etc because we're able to replace the call with a typecast. There is no associated "truthy" cast possible for devAssert. Same for dev().assert()

This is necessary for Closure to correctly narrow the type of the value.

If we were to remove the `devAssert(foo)` call, then closure would not be able to tell that `foo` is truthy. This doesn't matter for `assertBoolean`/`assertString`/etc because we're able to replace the call with a typecast. There is no associated "truthy" cast possible for `devAssert`. Same for `dev().assert()`
@jridgewell jridgewell merged commit 3d1e112 into master Jan 15, 2020
@rsimha rsimha deleted the update-amp-asserts-transform branch February 13, 2020 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants