Skip to content

Fix userAssert's type annotation#28191

Merged
jridgewell merged 4 commits intoampproject:masterfrom
jridgewell:user-assert
May 5, 2020
Merged

Fix userAssert's type annotation#28191
jridgewell merged 4 commits intoampproject:masterfrom
jridgewell:user-assert

Conversation

@jridgewell
Copy link
Copy Markdown
Contributor

Matches devAssert's change in #24047.

Matches `devAssert`'s change in ampproject#24047.
* @return {T} The value of shouldBeTrueish.
* @throws {!Error} When `shouldBeTrueish` is falsey.
* @template T
* @template R :=
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was R for?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it comes from here.

* @return {T} The value of shouldBeTrueish.
* @throws {!Error} When `shouldBeTrueish` is falsey.
* @template T
* @template R :=
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it comes from here.

jridgewell added 3 commits May 5, 2020 14:25
Closure is narrowing the type to `Object` due to the `typeof x === 'object'` check. Seems like a bug.
// See https://github.com/google/closure-compiler/wiki/Warnings#warnings-categories
// for a full list of closure's default error / warning levels.
if (options.typeCheckOnly) {
compilerOptions.checks_only = true;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save 30s with with this one weird trick.

@jridgewell jridgewell merged commit 8545cdd into ampproject:master May 5, 2020
@jridgewell jridgewell deleted the user-assert branch May 5, 2020 20:45
ldoroshe pushed a commit to ldoroshe/amphtml that referenced this pull request May 8, 2020
* Fix userAssert's type annotation

Matches `devAssert`'s change in ampproject#24047.

* Remove old notes

* Add single cast

Closure is narrowing the type to `Object` due to the `typeof x === 'object'` check. Seems like a bug.

* Speed up check-types by 30s
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.

6 participants