Skip to content

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

Merged
jridgewell merged 2 commits intomasterfrom
update-amp-asserts-transform
Jan 15, 2020
Merged

🏗️ Update transform-amp-asserts to leave devAsserts#26357
jridgewell merged 2 commits intomasterfrom
update-amp-asserts-transform

Conversation

@jridgewell
Copy link
Copy Markdown
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.

4 participants