♻️ Migrate most of #core to pass TS typechecking#37141
Merged
rcebulko merged 31 commits intoampproject:mainfrom Dec 9, 2021
Merged
♻️ Migrate most of #core to pass TS typechecking#37141rcebulko merged 31 commits intoampproject:mainfrom
rcebulko merged 31 commits intoampproject:mainfrom
Conversation
samouri
reviewed
Dec 7, 2021
Member
samouri
left a comment
There was a problem hiding this comment.
Read through the first half. Will finish reviewing tomorrow morning. Looks great ⭐
|
This pull request introduces 15 alerts when merging 80a13bb into 3e8072d - view on LGTM.com new alerts:
|
|
This pull request introduces 7 alerts when merging 06e7268 into 6268ef3 - view on LGTM.com new alerts:
|
|
Hey @jridgewell! These files were changed: |
Pass tsc for #core/dom
Contributor
Author
|
@samouri bumping this |
Member
|
Do you know what all of the bundle size changes are from? |
samouri
reviewed
Dec 9, 2021
| // obfuscated. | ||
| // TODO(rcebulko): Closure Compiler used this and the @dict annotation to check | ||
| // that properties are only accessed using bracket notation. We need to | ||
| // verify this works with TypeScript/esbuild. |
Member
There was a problem hiding this comment.
We cannot enforce this guarantee unless we write a custom script via the new TS API.
That said, I don't think fields get dangerously obfuscated like they did with CC... so this is not really an issue.
cc @jridgewell
samouri
approved these changes
Dec 9, 2021
samouri
approved these changes
Dec 9, 2021
This was referenced Dec 14, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates most of the files under
src/corefrom Closure type-checking to Typescript. Closure will no longer pass type-checking on many (most?) of these files. As a result, all Closure-based type-checking will stop passing (and so has been silenced incheck-types.js). Later PRs will handle cleaning out legacy type-checking code.Two
#coredirectories are excluded:contextandassert.contextis intricate and isolated, so it can be migrated independently while this PR unblocks progress elsewhere in the repo.assertwill be more involved because of differences in how CC and TS handle assertion annotations, so its type signatures are stubbed in this PR to be addressed in a later PR.Some "globals" we access through the
windowobject, which we rely on for some polyfills and testing scenarios. Because TS doesn't expect them to be on the window, there are corresponding TS definition files.d.tswhich add these properties to theWindowinterface. Anything in a.d.tsfile is TS-only logic that need to live outside of existing JS annotations. Mostly, they replace existing.extern.jsfiles.Files ending in
.shame.d.tscontain "band-aids", such as type stubs, that allow type-checking to pass. One example isassert.shame.d.ts, which tellstscto skip type-checking#core/assertfor now and instead provides the type signatures it should expect.