Uh oh!
There was an error while loading. Please reload this page.
rustdoc: add nobuild typescript checking to our JS - #136161
Conversation
rustbot
commented
Jan 27, 2025
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @jsha |
This comment has been minimized.
This comment has been minimized.
uellenberg
commented
Jan 28, 2025
It may be better to use |
This comment has been minimized.
This comment has been minimized.
68d7aac to
7e3f583CompareBy 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
GuillaumeGomez
commented
Jan 28, 2025
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+ |
bors
commented
Jan 28, 2025
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`
fmease
commented
Jan 29, 2025
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 |
notriddle
commented
Jan 30, 2025
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)
marxin
commented
Feb 6, 2025
Can you please update |
notriddle
commented
Feb 6, 2025
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)
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
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