fix(53589): Allow newlines before extend in conditional types
Fixes #53589
Currently, when attempting to parse a conditional type we check that there is no newline before the extends keyword. This was added as a fix for #21637 where the object key with name extends was incorrectly being considered part of a conditional type. While this fixed the initial problem, the check was too broad as there are other contexts where a newline before the extends would be valid. In order to allow these cases, I updated the check to instead see if the extends is followed by : or ?: in which case it is part of an object type (or at least can't be a conditional type).
@microsoft-github-policy-service agree
@typescript-bot test this @typescript-bot test top100 @typescript-bot user test this @typescript-bot user test tsserver @typescript-bot test tsserver top100 @typescript-bot run dt @typescript-bot perf test this faster @typescript-bot pack this
Heya @jakebailey, I've started to run the extended test suite on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Update: The results are in!
Heya @jakebailey, I've started to run the diff-based user code test suite (tsserver) on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Update: The results are in!
Heya @jakebailey, I've started to run the tarball bundle task on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Heya @jakebailey, I've started to run the diff-based top-repos suite (tsserver) on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Update: The results are in!
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Update: The results are in!
Heya @jakebailey, I've started to run the abridged perf test suite on this PR at 3145ef49f3ec4ee8e701df53cb1bca5cb4946cd3. You can monitor the build here.
Update: The results are in!
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:
{
"devDependencies": {
"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/155547/artifacts?artifactName=tgz&fileId=C4871A23F8C5B1777273557904DC4E8D3B2183F6DC3103D870718FA379B05AFC02&fileName=/typescript-5.2.0-insiders.20230620.tgz"
}
}
and then running npm install.
There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;
@jakebailey Here are the results of running the user test suite comparing main and refs/pull/54688/merge:
There were infrastructure failures potentially unrelated to your change:
- 1 instance of "Unknown failure"
- 1 instance of "Package install failed"
Otherwise...
Something interesting changed - please have a look.
Details
rxjs-src
/mnt/ts_downloads/rxjs-src/build.sh
- [NEW]
error TS2428: All declarations of 'WeakMap' must have identical type parameters.- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-54688/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- [MISSING]
error TS2428: All declarations of 'WeakMap' must have identical type parameters.- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.collection.d.ts(63,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.iterable.d.ts(162,11)
- /home/vsts/work/1/s/typescript-main/lib/lib.es2015.symbol.wellknown.d.ts(140,11)
@jakebailey Here are the results of running the user test suite comparing main and refs/pull/54688/merge:
Everything looks good!
@jakebailey The results of the perf run you requested are in!
Here they are:
Comparison Report - main..54688
| Metric | main | 54688 | Delta | Best | Worst | p-value |
|---|---|---|---|---|---|---|
| Angular - node (v16.17.1, x64) | ||||||
| Memory used | 365,523k (± 0.01%) | 365,560k (± 0.02%) | ~ | 365,500k | 365,650k | p=0.471 n=6 |
| Parse Time | 3.56s (± 0.81%) | 3.58s (± 0.25%) | ~ | 3.57s | 3.59s | p=0.119 n=6 |
| Bind Time | 1.18s (± 0.69%) | 1.18s (± 0.35%) | ~ | 1.17s | 1.18s | p=0.584 n=6 |
| Check Time | 9.67s (± 0.34%) | 9.62s (± 0.22%) | -0.05s (- 0.53%) | 9.59s | 9.65s | p=0.015 n=6 |
| Emit Time | 7.92s (± 0.61%) | 7.90s (± 0.58%) | ~ | 7.84s | 7.96s | p=0.574 n=6 |
| Total Time | 22.33s (± 0.39%) | 22.27s (± 0.20%) | ~ | 22.23s | 22.32s | p=0.198 n=6 |
| Compiler-Unions - node (v16.17.1, x64) | ||||||
| Memory used | 193,082k (± 0.66%) | 192,606k (± 0.02%) | ~ | 192,554k | 192,668k | p=0.471 n=6 |
| Parse Time | 1.60s (± 1.16%) | 1.61s (± 0.47%) | ~ | 1.60s | 1.62s | p=0.195 n=6 |
| Bind Time | 0.83s (± 0.91%) | 0.83s (± 0.99%) | ~ | 0.82s | 0.84s | p=0.729 n=6 |
| Check Time | 10.22s (± 0.85%) | 10.22s (± 0.86%) | ~ | 10.13s | 10.36s | p=1.000 n=6 |
| Emit Time | 3.01s (± 0.57%) | 3.01s (± 1.18%) | ~ | 2.95s | 3.04s | p=1.000 n=6 |
| Total Time | 15.66s (± 0.53%) | 15.67s (± 0.72%) | ~ | 15.57s | 15.84s | p=0.688 n=6 |
| Monaco - node (v16.17.1, x64) | ||||||
| Memory used | 345,899k (± 0.00%) | 345,886k (± 0.00%) | ~ | 345,871k | 345,905k | p=0.228 n=6 |
| Parse Time | 2.74s (± 0.44%) | 2.74s (± 1.03%) | ~ | 2.71s | 2.78s | p=0.870 n=6 |
| Bind Time | 1.08s (± 1.01%) | 1.08s (± 0.48%) | ~ | 1.08s | 1.09s | p=0.784 n=6 |
| Check Time | 7.88s (± 0.29%) | 7.87s (± 0.56%) | ~ | 7.80s | 7.92s | p=0.810 n=6 |
| Emit Time | 4.47s (± 0.56%) | 4.44s (± 1.15%) | ~ | 4.38s | 4.51s | p=0.378 n=6 |
| Total Time | 16.16s (± 0.22%) | 16.13s (± 0.64%) | ~ | 16.01s | 16.26s | p=0.688 n=6 |
| TFS - node (v16.17.1, x64) | ||||||
| Memory used | 300,004k (± 0.00%) | 300,008k (± 0.00%) | ~ | 299,991k | 300,018k | p=0.518 n=6 |
| Parse Time | 2.17s (± 0.56%) | 2.18s (± 1.19%) | ~ | 2.15s | 2.22s | p=0.463 n=6 |
| Bind Time | 1.24s (± 0.94%) | 1.25s (± 0.84%) | ~ | 1.23s | 1.26s | p=0.406 n=6 |
| Check Time | 7.33s (± 0.45%) | 7.29s (± 0.43%) | -0.05s (- 0.64%) | 7.25s | 7.34s | p=0.036 n=6 |
| Emit Time | 4.31s (± 0.79%) | 4.34s (± 0.57%) | ~ | 4.31s | 4.38s | p=0.125 n=6 |
| Total Time | 15.05s (± 0.43%) | 15.05s (± 0.37%) | ~ | 14.96s | 15.11s | p=1.000 n=6 |
| material-ui - node (v16.17.1, x64) | ||||||
| Memory used | 480,323k (± 0.01%) | 480,358k (± 0.02%) | ~ | 480,255k | 480,463k | p=0.471 n=6 |
| Parse Time | 3.26s (± 0.55%) | 3.27s (± 0.58%) | ~ | 3.25s | 3.30s | p=0.511 n=6 |
| Bind Time | 0.94s (± 0.86%) | 0.94s (± 0.43%) | ~ | 0.94s | 0.95s | p=0.584 n=6 |
| Check Time | 17.98s (± 0.58%) | 17.93s (± 0.62%) | ~ | 17.77s | 18.04s | p=0.936 n=6 |
| Emit Time | 0.00s (± 0.00%) | 0.00s (± 0.00%) | ~ | 0.00s | 0.00s | p=1.000 n=6 |
| Total Time | 22.19s (± 0.47%) | 22.14s (± 0.53%) | ~ | 21.98s | 22.25s | p=0.936 n=6 |
| xstate - node (v16.17.1, x64) | ||||||
| Memory used | 560,629k (± 0.02%) | 560,643k (± 0.01%) | ~ | 560,574k | 560,753k | p=0.689 n=6 |
| Parse Time | 3.99s (± 0.52%) | 4.03s (± 0.34%) | +0.04s (+ 0.96%) | 4.02s | 4.05s | p=0.007 n=6 |
| Bind Time | 1.75s (± 0.93%) | 1.73s (± 0.30%) | -0.02s (- 1.15%) | 1.72s | 1.73s | p=0.021 n=6 |
| Check Time | 3.05s (± 0.40%) | 3.05s (± 0.51%) | ~ | 3.04s | 3.07s | p=0.796 n=6 |
| Emit Time | 0.09s (± 0.00%) | 0.09s (± 0.00%) | ~ | 0.09s | 0.09s | p=1.000 n=6 |
| Total Time | 8.88s (± 0.17%) | 8.90s (± 0.33%) | ~ | 8.87s | 8.95s | p=0.226 n=6 |
| Machine Name | ts-ci-ubuntu |
|---|---|
| Platform | linux 5.4.0-148-generic |
| Architecture | x64 |
| Available Memory | 16 GB |
| Available Memory | 15 GB |
| CPUs | 4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz |
- node (v16.17.1, x64)
- Angular - node (v16.17.1, x64)
- Compiler-Unions - node (v16.17.1, x64)
- Monaco - node (v16.17.1, x64)
- TFS - node (v16.17.1, x64)
- material-ui - node (v16.17.1, x64)
- xstate - node (v16.17.1, x64)
| Benchmark | Name | Iterations |
|---|---|---|
| Current | 54688 | 6 |
| Baseline | main | 6 |
Developer Information:
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! You can check the log here.
@jakebailey Here are the results of running the top-repos suite comparing main and refs/pull/54688/merge:
Everything looks good!