-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
rustdoc: add nobuild typescript checking to our JS #136161
Conversation
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
This comment has been minimized.
This comment has been minimized.
It may be better to use |
This comment has been minimized.
This comment has been minimized.
68d7aac
to
7e3f583
Compare
By nobuild, I mean that the type annotations are all in comments, not in the "native" typescript syntax. This is a bit uglier, but it lets you rapid-prototype without tsc, works with all the native browser debugging tools, and keeps Node out of Rust's bootstrap chain. This pull request mostly just adds ts-ignore annotations and type declarations. To actually take good advantage of typescript, we'll want to "burn down" this pile of unsafe code until we eventually have a version with almost none of these. This PR also adds tsc to the mingw-check Dockerfile, so that it can't fall out of date like the Closure annotations did. https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/typescript
This is impressive. Thanks a lot for this improvement! I particularly appreciate that we don't require TS to build rustdoc, only to check its JS like we do with eslint. @bors r+ |
Rollup of 9 pull requests Successful merges: - rust-lang#136121 (Deduplicate operand creation between scalars, non-scalars and string patterns) - rust-lang#136134 (Fix SIMD codegen tests on LLVM 20) - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests) - rust-lang#136161 (rustdoc: add nobuild typescript checking to our JS) - rust-lang#136166 (interpret: is_alloc_live: check global allocs last) - rust-lang#136168 (GCI: Don't try to eval / collect mono items inside overly generic free const items) - rust-lang#136170 (Reject unsound toggling of Arm atomics-32 target feature) - rust-lang#136176 (Render pattern types nicely in mir dumps) - rust-lang#136186 (uefi: process: Fix args) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 9 pull requests Successful merges: - rust-lang#136121 (Deduplicate operand creation between scalars, non-scalars and string patterns) - rust-lang#136134 (Fix SIMD codegen tests on LLVM 20) - rust-lang#136153 (Locate asan-odr-win with other sanitizer tests) - rust-lang#136161 (rustdoc: add nobuild typescript checking to our JS) - rust-lang#136166 (interpret: is_alloc_live: check global allocs last) - rust-lang#136168 (GCI: Don't try to eval / collect mono items inside overly generic free const items) - rust-lang#136170 (Reject unsound toggling of Arm atomics-32 target feature) - rust-lang#136176 (Render pattern types nicely in mir dumps) - rust-lang#136186 (uefi: process: Fix args) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136161 - notriddle:typescript, r=GuillaumeGomez rustdoc: add nobuild typescript checking to our JS By nobuild, I mean that the type annotations are all [in comments], not in the "native" typescript syntax. This is a bit uglier, but it lets you rapid-prototype without tsc, works with all the native browser debugging tools, and keeps Node out of Rust's bootstrap chain. [in comments]: https://news.ycombinator.com/item?id=35892250 This pull request mostly just adds ts-ignore annotations and type declarations. To actually take good advantage of typescript, we'll want to "burn down" this pile of unsafe code until we eventually have a version with almost none of these. This PR also adds tsc to the mingw-check Dockerfile, so that it can't fall out of date like the Closure annotations did. https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/typescript r? `@GuillaumeGomez` `@lolbinarycat`
FYI: I'm suspecting this caused slight perf regressions. See #136227 (comment). I'll let you be the judge of that :) |
rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address rust-lang#136161 (comment)
Disclaimer: I haven't played around with the newly annotated JS files, so I might be missing some obvious things! Is it actually a hard requirement to use JSDoc's / Closure's type syntax? As far as I understand and have tested, tsc is perfectly fine with using (most) TS type syntax inside JSDoc annotations. TS's docs call this out (source):
Or did you intend to offer people the chance to typecheck the project locally with the Closure compiler instead (which seems to be the only tool other than tsc that can consume and check JSDoc type annotations)? I guess third party tools (like editors) might suffer from using TS syntax instead. Of course, VS Code's integrated JS/TS language server supports this out of the box. |
I was just wondering about that while reviewing #136263 where I saw the JSDoc-style |
No, you can use all the typescript-specific syntax you want as long as it's in comments (or in metadata files that aren't loaded by the browser). I don't see any point in trying to support multiple type checkers. |
…=fmease rustdoc: clean up a bunch of ts-expected-error declarations in main This mostly consists of handling potentially-null input and adding more global functions to the list of globals. Follow-up for rust-lang#136161
…=fmease rustdoc: clean up a bunch of ts-expected-error declarations in main This mostly consists of handling potentially-null input and adding more global functions to the list of globals. Follow-up for rust-lang#136161
…illaumeGomez rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address rust-lang#136161 (comment)
Rollup merge of rust-lang#136263 - notriddle:notriddle/typescript2, r=fmease rustdoc: clean up a bunch of ts-expected-error declarations in main This mostly consists of handling potentially-null input and adding more global functions to the list of globals. Follow-up for rust-lang#136161
…illaumeGomez rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address rust-lang#136161 (comment)
rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address rust-lang/rust#136161 (comment)
rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address rust-lang/rust#136161 (comment)
Can you please update
|
rustdoc: run css and html minifier at build instead of runtime This way, adding a bunch of comments to the JS files won't make rustdoc slower. Meant to address rust-lang/rust#136161 (comment)
By nobuild, I mean that the type annotations are all in comments, not in the "native" typescript syntax. This is a bit uglier, but it lets you rapid-prototype without tsc, works with all the native browser debugging tools, and keeps Node out of Rust's bootstrap chain.
This pull request mostly just adds ts-ignore annotations and type declarations. To actually take good advantage of typescript, we'll want to "burn down" this pile of unsafe code until we eventually have a version with almost none of these.
This PR also adds tsc to the mingw-check Dockerfile, so that it can't fall out of date like the Closure annotations did.
https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/typescript
r? @GuillaumeGomez @lolbinarycat