Skip to content

Mark file as skips typechecking if it contains ts-nocheck - #58593

Merged
Sheetal Nandi (sheetalkamat) merged 7 commits into
mainfrom
skipCheckIfNoJSCheck
May 31, 2024
Merged

Mark file as skips typechecking if it contains ts-nocheck#58593
Sheetal Nandi (sheetalkamat) merged 7 commits into
mainfrom
skipCheckIfNoJSCheck

Conversation

@sheetalkamat

@sheetalkamatSheetal Nandi (sheetalkamat) commented May 20, 2024

Copy link
Copy Markdown
Member

This is different take on #58592 to skip checking only if no-checkJs
Frankly i dont know what all will fail because we dont have enough coverage for js + incremental as such from this perspective.

cc: Wesley Wigham (@weswigham)

From investigating #56956

Needs #58364 to work correctly for js emit

@typescript-botTypeScript Bot (typescript-bot) added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels May 20, 2024
@sheetalkamatSheetal Nandi (sheetalkamat) changed the title Skip typechecking before declaration file on js files with nocheck[Experiment] Skip typechecking before declaration file on js files with nocheckMay 20, 2024
Comment threadsrc/compiler/checker.ts Outdated
@sheetalkamat
Sheetal Nandi (sheetalkamat)force-pushed the skipCheckIfNoJSCheck branch 2 times, most recently from f3189ed to 989d088CompareMay 20, 2024 22:55
@sheetalkamat

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test it

@typescript-bot

TypeScript Bot (typescript-bot) commented May 20, 2024

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started✅ Results
perf test this faster✅ Started👀 Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Sheetal Nandi (@sheetalkamat), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Sheetal Nandi (@sheetalkamat) Here are the results of running the user tests comparing main and refs/pull/58593/merge:

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Sheetal Nandi (@sheetalkamat)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15462,154~~~p=1.000 n=6
Types50,24850,248~~~p=1.000 n=6
Memory used192,814k (± 0.76%)192,872k (± 0.83%)~192,173k196,126kp=0.575 n=6
Parse Time1.29s (± 1.99%)1.29s (± 1.45%)~1.27s1.31sp=0.677 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.53s (± 0.29%)9.55s (± 0.31%)~9.50s9.59sp=0.226 n=6
Emit Time2.65s (± 0.56%)2.66s (± 0.50%)~2.64s2.68sp=0.285 n=6
Total Time14.19s (± 0.27%)14.21s (± 0.36%)~14.12s14.25sp=0.226 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,110944,110~~~p=1.000 n=6
Types407,140407,140~~~p=1.000 n=6
Memory used1,222,119k (± 0.00%)1,222,101k (± 0.00%)~1,222,067k1,222,176kp=0.689 n=6
Parse Time6.79s (± 0.68%)6.79s (± 0.55%)~6.76s6.85sp=0.518 n=6
Bind Time1.87s (± 0.44%)1.88s (± 0.45%)~1.86s1.88sp=0.718 n=6
Check Time31.34s (± 0.11%)31.25s (± 0.74%)~30.99s31.67sp=0.128 n=6
Emit Time14.72s (± 0.54%)14.81s (± 0.55%)~14.69s14.92sp=0.126 n=6
Total Time54.72s (± 0.20%)54.73s (± 0.52%)~54.39s55.17sp=1.000 n=6
mui-docs - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols1,979,1561,979,156~~~p=1.000 n=6
Types882,049882,049~~~p=1.000 n=6
Memory used1,884,994k (± 0.00%)1,884,986k (± 0.00%)~1,884,947k1,885,011kp=1.000 n=6
Parse Time6.79s (± 0.40%)6.78s (± 0.42%)~6.75s6.81sp=0.684 n=6
Bind Time2.30s (± 1.37%)2.28s (± 0.39%)~2.27s2.29sp=0.270 n=6
Check Time60.37s (± 0.35%)60.25s (± 0.33%)~60.00s60.59sp=0.423 n=6
Emit Time0.14s (± 3.60%)0.14s~~~p=0.174 n=6
Total Time69.59s (± 0.32%)69.46s (± 0.29%)~69.17s69.77sp=0.335 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,222,7721,222,830+58 (+ 0.00%)~~p=0.001 n=6
Types260,022260,027+5 (+ 0.00%)~~p=0.001 n=6
Memory used2,338,777k (± 0.03%)2,339,212k (± 0.03%)~2,338,485k2,340,165kp=0.173 n=6
Parse Time5.01s (± 1.04%)5.05s (± 1.04%)~4.97s5.11sp=0.173 n=6
Bind Time1.89s (± 0.88%)1.89s (± 1.23%)~1.87s1.93sp=0.933 n=6
Check Time33.81s (± 0.35%)33.77s (± 0.40%)~33.52s33.92sp=0.689 n=6
Emit Time2.68s (± 2.13%)2.68s (± 2.36%)~2.57s2.74sp=0.936 n=6
Total Time43.40s (± 0.18%)43.40s (± 0.44%)~43.02s43.55sp=0.378 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,222,7721,222,830+58 (+ 0.00%)~~p=0.001 n=6
Types260,022260,027+5 (+ 0.00%)~~p=0.001 n=6
Memory used2,414,215k (± 0.05%)2,415,044k (± 0.04%)~2,413,802k2,416,158kp=0.230 n=6
Parse Time6.35s (± 1.12%)6.28s (± 0.80%)~6.21s6.35sp=0.173 n=6
Bind Time2.03s (± 0.88%)2.04s (± 1.76%)~2.00s2.10sp=0.518 n=6
Check Time40.22s (± 0.14%)40.31s (± 0.31%)~40.10s40.45sp=0.109 n=6
Emit Time3.30s (± 4.38%)3.19s (± 2.73%)~3.08s3.27sp=0.229 n=6
Total Time51.92s (± 0.32%)51.82s (± 0.13%)~51.71s51.90sp=0.471 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols257,595257,609+14 (+ 0.01%)~~p=0.001 n=6
Types104,862104,867+5 (+ 0.00%)~~p=0.001 n=6
Memory used426,544k (± 0.01%)426,537k (± 0.01%)~426,483k426,620kp=0.689 n=6
Parse Time4.17s (± 0.62%)4.17s (± 0.25%)~4.15s4.18sp=0.357 n=6
Bind Time1.62s (± 0.78%)1.63s (± 0.51%)~1.63s1.65sp=0.065 n=6
Check Time22.15s (± 0.24%)22.20s (± 0.18%)~22.13s22.24sp=0.078 n=6
Emit Time1.72s (± 1.89%)1.72s (± 1.24%)~1.69s1.75sp=0.746 n=6
Total Time29.67s (± 0.20%)29.72s (± 0.11%)~29.68s29.77sp=0.147 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,575224,575~~~p=1.000 n=6
Types93,78593,785~~~p=1.000 n=6
Memory used369,858k (± 0.03%)369,863k (± 0.02%)~369,749k369,962kp=0.936 n=6
Parse Time2.83s (± 0.88%)2.84s (± 1.27%)~2.80s2.88sp=0.687 n=6
Bind Time1.58s (± 1.11%)1.58s (± 0.48%)~1.57s1.59sp=0.397 n=6
Check Time15.67s (± 0.47%)15.67s (± 0.37%)~15.55s15.70sp=0.808 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time20.07s (± 0.45%)20.09s (± 0.42%)~19.93s20.17sp=0.630 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,825,7402,825,449-291 (- 0.01%)~~p=0.001 n=6
Types958,540958,519-21 (- 0.00%)~~p=0.001 n=6
Memory used2,999,944k (± 0.00%)3,000,038k (± 0.00%)~2,999,888k3,000,151kp=0.093 n=6
Parse Time13.82s (± 0.23%)13.82s (± 0.20%)~13.77s13.84sp=1.000 n=6
Bind Time4.14s (± 0.20%)4.21s (± 2.83%)~4.12s4.37sp=0.867 n=6
Check Time73.53s (± 0.28%)73.54s (± 0.42%)~73.22s73.96sp=1.000 n=6
Emit Time23.51s (± 0.81%)23.64s (± 0.84%)~23.40s23.91sp=0.378 n=6
Total Time115.01s (± 0.25%)115.21s (± 0.14%)~115.00s115.41sp=0.149 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,866265,866~~~p=1.000 n=6
Types108,401108,401~~~p=1.000 n=6
Memory used410,663k (± 0.02%)410,647k (± 0.02%)~410,563k410,785kp=0.872 n=6
Parse Time4.77s (± 1.01%)4.75s (± 0.86%)~4.68s4.79sp=0.520 n=6
Bind Time2.07s (± 0.43%)2.08s (± 0.95%)~2.04s2.10sp=0.198 n=6
Check Time21.05s (± 0.35%)20.99s (± 0.40%)~20.85s21.08sp=0.261 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.89s (± 0.26%)27.82s (± 0.42%)~27.61s27.94sp=0.335 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols524,654524,654~~~p=1.000 n=6
Types178,920178,920~~~p=1.000 n=6
Memory used462,666k (± 0.02%)462,740k (± 0.02%)~462,647k462,916kp=0.128 n=6
Parse Time3.89s (± 0.25%)3.89s (± 0.51%)~3.86s3.91sp=1.000 n=6
Bind Time1.45s (± 1.29%)1.44s (± 0.68%)~1.43s1.45sp=0.673 n=6
Check Time22.48s (± 0.80%)22.56s (± 0.50%)~22.37s22.68sp=0.422 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.81s (± 0.63%)27.89s (± 0.40%)~27.71s27.99sp=0.471 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Sheetal Nandi (@sheetalkamat) Here are the results of running the top 400 repos comparing main and refs/pull/58593/merge:

Everything looks good!

@sheetalkamatSheetal Nandi (sheetalkamat) changed the title [Experiment] Skip typechecking before declaration file on js files with nocheck Skip typechecking for files with no check in them even with dts emitMay 21, 2024
@sheetalkamat
Sheetal Nandi (sheetalkamat) marked this pull request as ready for review May 21, 2024 02:24
@sheetalkamatSheetal Nandi (sheetalkamat) changed the title Skip typechecking for files with no check in them even with dts emitMark file as skips typechecking if it contains ts-nocheckMay 21, 2024
@sheetalkamat

Copy link
Copy Markdown
MemberAuthor

Does this need to wait for #58364 given the ts-nocheck files may be emitting js?

@weswigham

Copy link
Copy Markdown
Member

Does this need to wait for #58364 given the ts-nocheck files may be emitting js?

Either that or, like the other PR, only enabled when only .d.ts emit is performed by the checker in question.

@sheetalkamat

Copy link
Copy Markdown
MemberAuthor

Either that or, like the other PR, only enabled when only .d.ts emit is performed by the checker in question.

Thats tough I think and not work flowing information temporarily till we get the PR in so i will just wait for that PR to merge.

@jakebailey

Copy link
Copy Markdown
Member

#58364 is in, so is this safe to update and get in?

@weswigham

Copy link
Copy Markdown
Member

Yeah, just remember the condition in calculateNodeCheckFlagWorker in checker.ts and emitJsFileOrBundle in emitter.ts needs to swap from just compilerOptions.noCheck to something that can handle this, too. (probably just the skipTypeChecking util function this edits, unless you wanna do the piecemeal thing emitDeclarationFileOrBundle does - but that should probably just swap to skipTypeChecking, too)

@sheetalkamat

Sheetal Nandi (sheetalkamat) commented May 31, 2024

Copy link
Copy Markdown
MemberAuthor

Wesley Wigham (@weswigham) pls review again. I have merged with main and added those checks

Also i used canIncludeBind* function instead of skipsTypeChecking to avoid having to do extra checks (or get sourceFile if not needed)

Comment threadsrc/compiler/checker.ts Outdated
Comment threadsrc/compiler/emitter.ts
Comment threadsrc/compiler/utilities.ts
@sheetalkamat

Copy link
Copy Markdown
MemberAuthor

Wesley Wigham (@weswigham) pls review so i can get this in for 5.5

@sheetalkamat
Sheetal Nandi (sheetalkamat) deleted the skipCheckIfNoJSCheck branch May 31, 2024 19:18
Jonathan Skeate (skeate) added a commit to skeate/TypeScript that referenced this pull request Jun 1, 2024
* upstream/main: (37 commits)
Added NoTruncation flag to completions (microsoft#58719)
Clone node to remove location even when it has been modified if needed (microsoft#58706)
Properly account for `this` argument in intersection apparent type caching (microsoft#58677)
Fix: Include Values of Script Extensions for Unicode Property Value Expressions in Regular Expressions (microsoft#58615)
In `reScanSlashToken` use `charCodeChecked` not `codePointChecked` (microsoft#58727)
Shorten error spans for errors reported on constructor declarations (microsoft#58061)
Mark file as skips typechecking if it contains ts-nocheck (microsoft#58593)
Fixed an issue with broken `await using` declarations in `for of` loops (microsoft#56466)
Do not expand type references in keyof and index access (microsoft#58715)
Improve the performance of isolatedDeclarations quickfix (microsoft#58722)
Unwrap `NoInfer` types when narrowing (microsoft#58292)
Recover from type reuse errors by falling back to inferred type printing (microsoft#58720)
Fixing self import (microsoft#58718)
Enable JS emit for noCheck and noCheck for transpileModule (microsoft#58364)
Revert PR 55371 (microsoft#58702)
Update dependencies (microsoft#58639)
Fix baselines after PR 58621 (microsoft#58705)
Do not infer `yield*` type from contextual `TReturn` (microsoft#58621)
`await using` normative changes (microsoft#58624)
Handling statements from a known source file (microsoft#58679)
...
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 16, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@sheetalkamat@typescript-bot@weswigham@jakebailey