Skip to content
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

Update type-only import semantics to allow type queries #36092

Merged
merged 27 commits into from
Jan 23, 2020

Conversation

andrewbranch
Copy link
Member

@andrewbranch andrewbranch commented Jan 9, 2020

In #35200, a type-only import or export created a synthetic symbol which reflected only the type-side meaning of its target. This meant that the imported names were unusable in any value position. This PR removes the intermediate synthetic symbol and instead issues an error if the imported names appear in any non-ambient expression context. Namely, this allows for:

import type { BaseClass } from './base';

// 1. Type queries
let ConstructorType: typeof BaseClass;

// 2. Ambient contexts that require value meanings
declare class SubClass extends BaseClass {}

One oddity that arises with this approach is how to treat a namespace import that includes type-only exports:

// a.ts
class A {}
export type { A }

// b.ts
import * as a from './a';
console.log(a); // Empty object, because the export type was erased

type T = keyof typeof a; // `never` - because `typeof a` must be an empty object type

let a: a.A; // This is ok
let A: typeof a.A; // This doesn’t work because `typeof a` is an empty object :(

Essentially, there is a limitation that if you need to access the value meaning of a type-only export, you can’t do so through a namespace import—you have to use a named (or default) import.

The distinction is subtle and confusing, but I think internally consistent, and unlikely to come up much in real code. At least, I think it’s better to start with this limitation than to be overly permissive in a way that could make the type system misrepresent the reality of the shape of a module.


Fixes #36040
Fixes #36003 (the part I said was a bug)
Fixes #36004

src/compiler/checker.ts Outdated Show resolved Hide resolved
@andrewbranch andrewbranch marked this pull request as ready for review January 9, 2020 17:48
Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks OK to me, but with the caveat the I didn't review the original code so this is the first time for me to look at it. @weswigham should probably answer your question about whether there's a better way to finagle const enum references.

@andrewbranch
Copy link
Member Author

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 9, 2020

Heya @andrewbranch, I've started to run the perf test suite on this PR at 124dcd6. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@andrewbranch
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..36092

Metric master 36092 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 356,335k (± 0.02%) 358,325k (± 0.02%) +1,990k (+ 0.56%) 358,120k 358,466k
Parse Time 1.61s (± 0.52%) 1.62s (± 0.41%) +0.01s (+ 0.56%) 1.60s 1.63s
Bind Time 0.87s (± 1.17%) 0.88s (± 0.96%) +0.01s (+ 0.92%) 0.86s 0.89s
Check Time 4.59s (± 0.45%) 4.76s (± 0.49%) +0.17s (+ 3.77%) 4.71s 4.82s
Emit Time 5.29s (± 0.99%) 5.27s (± 0.87%) -0.02s (- 0.47%) 5.13s 5.38s
Total Time 12.36s (± 0.51%) 12.53s (± 0.57%) +0.17s (+ 1.35%) 12.32s 12.71s
Monaco - node (v10.16.3, x64)
Memory used 367,758k (± 0.02%) 367,890k (± 0.01%) +132k (+ 0.04%) 367,799k 368,006k
Parse Time 1.26s (± 0.59%) 1.25s (± 0.80%) -0.01s (- 0.56%) 1.23s 1.28s
Bind Time 0.76s (± 0.48%) 0.76s (± 0.53%) -0.01s (- 0.65%) 0.75s 0.77s
Check Time 4.71s (± 0.51%) 4.83s (± 0.61%) +0.12s (+ 2.55%) 4.76s 4.88s
Emit Time 2.95s (± 0.56%) 2.97s (± 0.90%) +0.02s (+ 0.58%) 2.91s 3.02s
Total Time 9.68s (± 0.44%) 9.81s (± 0.49%) +0.13s (+ 1.33%) 9.69s 9.89s
TFS - node (v10.16.3, x64)
Memory used 323,446k (± 0.02%) 323,642k (± 0.02%) +196k (+ 0.06%) 323,477k 323,795k
Parse Time 0.95s (± 0.61%) 0.94s (± 0.50%) -0.00s (- 0.42%) 0.93s 0.95s
Bind Time 0.74s (± 0.88%) 0.73s (± 1.09%) -0.01s (- 0.81%) 0.71s 0.75s
Check Time 4.17s (± 0.32%) 4.29s (± 0.35%) +0.12s (+ 2.90%) 4.26s 4.33s
Emit Time 3.03s (± 0.88%) 3.04s (± 0.88%) +0.01s (+ 0.16%) 2.98s 3.09s
Total Time 8.89s (± 0.34%) 9.01s (± 0.45%) +0.12s (+ 1.32%) 8.94s 9.10s
Angular - node (v12.1.0, x64)
Memory used 331,969k (± 0.03%) 333,964k (± 0.05%) +1,996k (+ 0.60%) 333,295k 334,170k
Parse Time 1.56s (± 0.74%) 1.57s (± 0.61%) +0.00s (+ 0.19%) 1.55s 1.59s
Bind Time 0.84s (± 0.81%) 0.86s (± 0.68%) +0.01s (+ 1.42%) 0.84s 0.87s
Check Time 4.54s (± 0.45%) 4.72s (± 0.47%) +0.17s (+ 3.83%) 4.66s 4.76s
Emit Time 5.52s (± 0.95%) 5.50s (± 0.55%) -0.02s (- 0.45%) 5.45s 5.58s
Total Time 12.47s (± 0.41%) 12.64s (± 0.33%) +0.16s (+ 1.29%) 12.55s 12.74s
Monaco - node (v12.1.0, x64)
Memory used 347,547k (± 0.02%) 347,684k (± 0.01%) +137k (+ 0.04%) 347,559k 347,781k
Parse Time 1.22s (± 0.39%) 1.23s (± 0.99%) +0.00s (+ 0.41%) 1.20s 1.26s
Bind Time 0.73s (± 0.91%) 0.73s (± 0.79%) +0.00s (+ 0.00%) 0.72s 0.75s
Check Time 4.55s (± 0.51%) 4.67s (± 0.60%) +0.12s (+ 2.52%) 4.59s 4.73s
Emit Time 2.99s (± 0.67%) 3.03s (± 0.62%) +0.05s (+ 1.57%) 2.99s 3.07s
Total Time 9.50s (± 0.31%) 9.66s (± 0.34%) +0.17s (+ 1.75%) 9.57s 9.73s
TFS - node (v12.1.0, x64)
Memory used 305,787k (± 0.01%) 305,917k (± 0.02%) +131k (+ 0.04%) 305,711k 306,046k
Parse Time 0.94s (± 1.00%) 0.93s (± 0.40%) -0.01s (- 0.53%) 0.93s 0.94s
Bind Time 0.69s (± 0.65%) 0.70s (± 2.66%) +0.01s (+ 1.60%) 0.68s 0.76s
Check Time 4.12s (± 0.41%) 4.21s (± 0.61%) +0.09s (+ 2.28%) 4.16s 4.27s
Emit Time 3.07s (± 0.66%) 3.11s (± 0.77%) +0.04s (+ 1.37%) 3.05s 3.16s
Total Time 8.81s (± 0.37%) 8.95s (± 0.55%) +0.14s (+ 1.58%) 8.84s 9.04s
Angular - node (v8.9.0, x64)
Memory used 351,256k (± 0.02%) 353,222k (± 0.01%) +1,965k (+ 0.56%) 353,132k 353,317k
Parse Time 2.11s (± 0.65%) 2.11s (± 0.45%) +0.00s (+ 0.05%) 2.09s 2.13s
Bind Time 0.91s (± 0.83%) 0.93s (± 0.81%) +0.01s (+ 1.42%) 0.91s 0.94s
Check Time 5.40s (± 0.55%) 5.58s (± 0.35%) +0.18s (+ 3.28%) 5.50s 5.60s
Emit Time 6.30s (± 0.82%) 6.29s (± 0.92%) -0.01s (- 0.19%) 6.16s 6.45s
Total Time 14.71s (± 0.59%) 14.90s (± 0.44%) +0.19s (+ 1.26%) 14.78s 15.08s
Monaco - node (v8.9.0, x64)
Memory used 365,985k (± 0.01%) 366,116k (± 0.01%) +132k (+ 0.04%) 365,987k 366,218k
Parse Time 1.56s (± 0.41%) 1.56s (± 0.36%) -0.00s (- 0.26%) 1.55s 1.57s
Bind Time 0.95s (± 0.74%) 0.94s (± 0.90%) -0.01s (- 0.84%) 0.92s 0.96s
Check Time 5.44s (± 1.61%) 5.64s (± 1.40%) +0.21s (+ 3.83%) 5.51s 5.81s
Emit Time 3.34s (± 4.58%) 3.28s (± 4.43%) -0.06s (- 1.91%) 3.01s 3.45s
Total Time 11.29s (± 0.81%) 11.43s (± 0.74%) +0.14s (+ 1.20%) 11.24s 11.56s
TFS - node (v8.9.0, x64)
Memory used 322,752k (± 0.01%) 322,828k (± 0.01%) +76k (+ 0.02%) 322,733k 322,914k
Parse Time 1.27s (± 0.29%) 1.26s (± 0.54%) -0.00s (- 0.08%) 1.25s 1.28s
Bind Time 0.75s (± 0.78%) 0.75s (± 1.09%) 0.00s ( 0.00%) 0.73s 0.77s
Check Time 4.78s (± 0.84%) 4.88s (± 0.75%) +0.10s (+ 2.09%) 4.80s 4.95s
Emit Time 3.22s (± 0.71%) 3.22s (± 0.48%) -0.00s (- 0.06%) 3.19s 3.27s
Total Time 10.01s (± 0.57%) 10.11s (± 0.50%) +0.10s (+ 0.99%) 10.00s 10.21s
Angular - node (v8.9.0, x86)
Memory used 199,561k (± 0.02%) 200,605k (± 0.03%) +1,044k (+ 0.52%) 200,428k 200,737k
Parse Time 2.04s (± 0.56%) 2.03s (± 0.47%) -0.00s (- 0.20%) 2.02s 2.06s
Bind Time 1.02s (± 0.47%) 1.03s (± 0.74%) +0.01s (+ 0.88%) 1.01s 1.05s
Check Time 4.91s (± 0.68%) 5.08s (± 0.62%) +0.16s (+ 3.32%) 5.01s 5.16s
Emit Time 6.15s (± 1.43%) 6.19s (± 1.98%) +0.03s (+ 0.55%) 6.01s 6.48s
Total Time 14.12s (± 0.59%) 14.32s (± 0.96%) +0.20s (+ 1.44%) 14.11s 14.65s
Monaco - node (v8.9.0, x86)
Memory used 205,223k (± 0.02%) 205,326k (± 0.02%) +103k (+ 0.05%) 205,233k 205,452k
Parse Time 1.61s (± 0.81%) 1.60s (± 0.57%) -0.01s (- 0.62%) 1.59s 1.63s
Bind Time 0.76s (± 1.19%) 0.75s (± 1.10%) -0.01s (- 0.66%) 0.74s 0.77s
Check Time 5.36s (± 2.05%) 5.60s (± 1.07%) +0.24s (+ 4.51%) 5.39s 5.68s
Emit Time 3.02s (± 4.43%) 2.90s (± 3.26%) -0.12s (- 4.04%) 2.80s 3.27s
Total Time 10.74s (± 0.46%) 10.85s (± 0.51%) +0.11s (+ 1.02%) 10.72s 11.03s
TFS - node (v8.9.0, x86)
Memory used 182,069k (± 0.03%) 182,139k (± 0.02%) +70k (+ 0.04%) 182,065k 182,202k
Parse Time 1.30s (± 0.73%) 1.30s (± 0.68%) -0.00s (- 0.31%) 1.29s 1.33s
Bind Time 0.70s (± 0.42%) 0.71s (± 1.32%) +0.01s (+ 1.14%) 0.70s 0.74s
Check Time 4.54s (± 0.73%) 4.63s (± 0.85%) +0.08s (+ 1.78%) 4.56s 4.75s
Emit Time 2.98s (± 0.92%) 2.99s (± 0.70%) +0.00s (+ 0.17%) 2.94s 3.02s
Total Time 9.53s (± 0.38%) 9.62s (± 0.56%) +0.09s (+ 0.94%) 9.52s 9.79s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
Benchmark Name Iterations
Current 36092 10
Baseline master 10

@andrewbranch
Copy link
Member Author

Check time appears up ~2–4%. I think this discussion will have some bearing on what we can do, so I’ll hold off on doing anything specifically for perf until we make some other decisions.

@andrewbranch

This comment has been minimized.

@typescript-bot

This comment has been minimized.

@typescript-bot

This comment has been minimized.

@andrewbranch

This comment has been minimized.

@andrewbranch andrewbranch changed the title Update type-only import semantics to allow type queries WIP(perf): Update type-only import semantics to allow type queries Jan 10, 2020
@andrewbranch andrewbranch changed the title WIP(perf): Update type-only import semantics to allow type queries WIP (perf): Update type-only import semantics to allow type queries Jan 10, 2020
@typescript-bot

This comment has been minimized.

@andrewbranch
Copy link
Member Author

For a moment I thought we could also allow type-only imports in class property declarations without initializers:

class C {
  [onInit]: any;
}

But that’s actually a problem for ES class field semantics if I understand correctly. declare property declarations should Just Work™ because the ambient node flag will propagate down.

It’s also maybe worth noting that at this point, it would be very easy to allow people to use const enums as type-only imports (#36003), even though I think it’s pretty unintuitive.

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Jan 15, 2020

Yeah, that's definitely an error. Here's another fun case now that you mention non-emitted members in classes: abstract members!

import type { onInit } from "./framework-hooks";

abstract class Component {
    abstract [onInit](): void;
}

@andrewbranch
Copy link
Member Author

andrewbranch commented Jan 15, 2020

@DanielRosenwasser I’ve just updated to include those cases, and switched to a NodeFlag-based approach as @weswigham suggested earlier since the list of syntactic forms to check for in a hot path was growing.

Edit: NodeFlag approach was terrible for incremental parsing. Reverted.

@andrewbranch
Copy link
Member Author

@typescript-bot perf-test this

@DanielRosenwasser
Copy link
Member

Looks like there's diagnostic conflicts

@andrewbranch
Copy link
Member Author

@typescript-bot perf test this again for good measure please

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 23, 2020

Heya @andrewbranch, I've started to run the perf test suite on this PR at be5f50f. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@andrewbranch
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..36092

Metric master 36092 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 355,798k (± 0.02%) 357,379k (± 0.03%) +1,581k (+ 0.44%) 357,006k 357,550k
Parse Time 1.60s (± 0.50%) 1.61s (± 0.74%) +0.01s (+ 0.88%) 1.59s 1.64s
Bind Time 0.88s (± 0.78%) 0.87s (± 0.85%) -0.00s (- 0.23%) 0.85s 0.89s
Check Time 4.56s (± 0.52%) 4.60s (± 0.29%) +0.03s (+ 0.66%) 4.57s 4.63s
Emit Time 5.24s (± 0.61%) 5.28s (± 0.54%) +0.05s (+ 0.94%) 5.21s 5.34s
Total Time 12.28s (± 0.34%) 12.37s (± 0.24%) +0.09s (+ 0.73%) 12.30s 12.44s
Monaco - node (v10.16.3, x64)
Memory used 364,353k (± 0.01%) 364,286k (± 0.02%) -67k (- 0.02%) 364,169k 364,422k
Parse Time 1.25s (± 0.61%) 1.25s (± 0.67%) +0.01s (+ 0.48%) 1.24s 1.28s
Bind Time 0.77s (± 0.90%) 0.76s (± 0.29%) -0.01s (- 0.78%) 0.75s 0.76s
Check Time 4.61s (± 0.59%) 4.62s (± 0.38%) +0.02s (+ 0.35%) 4.59s 4.66s
Emit Time 2.96s (± 1.05%) 2.94s (± 0.88%) -0.01s (- 0.47%) 2.88s 2.99s
Total Time 9.57s (± 0.53%) 9.58s (± 0.36%) +0.01s (+ 0.07%) 9.50s 9.66s
TFS - node (v10.16.3, x64)
Memory used 323,555k (± 0.02%) 323,498k (± 0.01%) -57k (- 0.02%) 323,425k 323,569k
Parse Time 0.94s (± 0.53%) 0.95s (± 0.79%) +0.00s (+ 0.21%) 0.94s 0.97s
Bind Time 0.74s (± 1.37%) 0.73s (± 1.11%) -0.00s (- 0.27%) 0.71s 0.75s
Check Time 4.17s (± 0.52%) 4.20s (± 0.36%) +0.03s (+ 0.84%) 4.16s 4.23s
Emit Time 3.03s (± 1.04%) 3.03s (± 1.15%) -0.00s (- 0.16%) 2.96s 3.13s
Total Time 8.88s (± 0.58%) 8.91s (± 0.50%) +0.03s (+ 0.35%) 8.83s 9.04s
Angular - node (v12.1.0, x64)
Memory used 331,487k (± 0.02%) 332,950k (± 0.07%) +1,462k (+ 0.44%) 331,978k 333,117k
Parse Time 1.56s (± 0.61%) 1.56s (± 0.33%) +0.01s (+ 0.32%) 1.55s 1.57s
Bind Time 0.85s (± 0.78%) 0.86s (± 0.60%) +0.01s (+ 1.29%) 0.85s 0.87s
Check Time 4.51s (± 0.42%) 4.52s (± 0.61%) +0.01s (+ 0.11%) 4.46s 4.59s
Emit Time 5.45s (± 0.84%) 5.45s (± 0.80%) +0.00s (+ 0.02%) 5.38s 5.57s
Total Time 12.37s (± 0.45%) 12.39s (± 0.55%) +0.02s (+ 0.18%) 12.28s 12.54s
Monaco - node (v12.1.0, x64)
Memory used 344,133k (± 0.02%) 344,080k (± 0.02%) -53k (- 0.02%) 343,894k 344,248k
Parse Time 1.21s (± 0.58%) 1.22s (± 0.67%) +0.01s (+ 0.50%) 1.20s 1.24s
Bind Time 0.74s (± 0.68%) 0.73s (± 1.06%) -0.00s (- 0.54%) 0.72s 0.75s
Check Time 4.47s (± 0.16%) 4.48s (± 0.58%) +0.00s (+ 0.11%) 4.42s 4.52s
Emit Time 3.02s (± 1.08%) 3.00s (± 0.53%) -0.01s (- 0.43%) 2.96s 3.04s
Total Time 9.44s (± 0.40%) 9.43s (± 0.35%) -0.01s (- 0.11%) 9.34s 9.47s
TFS - node (v12.1.0, x64)
Memory used 305,807k (± 0.02%) 305,787k (± 0.01%) -20k (- 0.01%) 305,675k 305,843k
Parse Time 0.94s (± 1.12%) 0.94s (± 1.08%) -0.01s (- 0.85%) 0.91s 0.96s
Bind Time 0.69s (± 0.52%) 0.69s (± 0.50%) -0.01s (- 1.01%) 0.68s 0.69s
Check Time 4.12s (± 0.40%) 4.12s (± 0.39%) -0.00s (- 0.12%) 4.09s 4.16s
Emit Time 3.09s (± 0.95%) 3.06s (± 0.61%) -0.03s (- 0.81%) 3.03s 3.11s
Total Time 8.84s (± 0.39%) 8.80s (± 0.32%) -0.04s (- 0.44%) 8.76s 8.88s
Angular - node (v8.9.0, x64)
Memory used 350,760k (± 0.01%) 352,342k (± 0.01%) +1,582k (+ 0.45%) 352,281k 352,463k
Parse Time 2.10s (± 0.33%) 2.10s (± 0.39%) -0.00s (- 0.10%) 2.08s 2.11s
Bind Time 0.91s (± 0.77%) 0.92s (± 0.94%) +0.01s (+ 1.43%) 0.91s 0.95s
Check Time 5.37s (± 0.65%) 5.34s (± 0.66%) -0.03s (- 0.47%) 5.28s 5.42s
Emit Time 6.29s (± 0.70%) 6.22s (± 1.52%) -0.07s (- 1.08%) 5.92s 6.40s
Total Time 14.67s (± 0.43%) 14.58s (± 0.76%) -0.08s (- 0.57%) 14.33s 14.84s
Monaco - node (v8.9.0, x64)
Memory used 362,547k (± 0.01%) 362,452k (± 0.01%) -95k (- 0.03%) 362,387k 362,522k
Parse Time 1.56s (± 0.32%) 1.56s (± 0.78%) +0.01s (+ 0.39%) 1.54s 1.59s
Bind Time 0.94s (± 0.88%) 0.95s (± 0.70%) +0.01s (+ 0.64%) 0.93s 0.96s
Check Time 5.33s (± 1.90%) 5.30s (± 1.65%) -0.02s (- 0.39%) 5.20s 5.54s
Emit Time 3.30s (± 5.24%) 3.38s (± 4.02%) +0.08s (+ 2.43%) 3.01s 3.50s
Total Time 11.12s (± 0.82%) 11.19s (± 0.67%) +0.07s (+ 0.62%) 11.02s 11.36s
TFS - node (v8.9.0, x64)
Memory used 322,838k (± 0.01%) 322,771k (± 0.02%) -67k (- 0.02%) 322,669k 322,901k
Parse Time 1.26s (± 0.49%) 1.26s (± 0.49%) 0.00s ( 0.00%) 1.24s 1.27s
Bind Time 0.75s (± 0.53%) 0.75s (± 0.80%) -0.00s (- 0.40%) 0.73s 0.76s
Check Time 4.75s (± 0.56%) 4.78s (± 0.45%) +0.04s (+ 0.76%) 4.74s 4.83s
Emit Time 3.19s (± 0.63%) 3.21s (± 0.49%) +0.01s (+ 0.34%) 3.17s 3.25s
Total Time 9.95s (± 0.34%) 9.99s (± 0.38%) +0.04s (+ 0.41%) 9.90s 10.09s
Angular - node (v8.9.0, x86)
Memory used 199,344k (± 0.02%) 200,156k (± 0.03%) +812k (+ 0.41%) 200,027k 200,294k
Parse Time 2.02s (± 0.59%) 2.03s (± 0.54%) +0.01s (+ 0.35%) 2.01s 2.06s
Bind Time 1.03s (± 0.74%) 1.02s (± 0.69%) -0.01s (- 0.49%) 1.01s 1.04s
Check Time 4.89s (± 0.51%) 4.90s (± 0.66%) +0.01s (+ 0.27%) 4.83s 4.97s
Emit Time 6.08s (± 2.03%) 6.17s (± 1.68%) +0.09s (+ 1.43%) 6.00s 6.38s
Total Time 14.02s (± 0.85%) 14.12s (± 0.88%) +0.11s (+ 0.75%) 13.88s 14.38s
Monaco - node (v8.9.0, x86)
Memory used 203,498k (± 0.02%) 203,438k (± 0.02%) -60k (- 0.03%) 203,344k 203,583k
Parse Time 1.60s (± 0.82%) 1.60s (± 1.09%) 0.00s ( 0.00%) 1.58s 1.66s
Bind Time 0.76s (± 1.06%) 0.76s (± 0.65%) -0.00s (- 0.26%) 0.75s 0.77s
Check Time 5.11s (± 2.57%) 5.11s (± 1.46%) +0.00s (+ 0.06%) 5.04s 5.39s
Emit Time 3.18s (± 3.06%) 3.21s (± 2.30%) +0.03s (+ 0.94%) 2.93s 3.30s
Total Time 10.65s (± 0.49%) 10.68s (± 0.38%) +0.03s (+ 0.25%) 10.63s 10.82s
TFS - node (v8.9.0, x86)
Memory used 182,139k (± 0.02%) 182,159k (± 0.03%) +20k (+ 0.01%) 182,064k 182,269k
Parse Time 1.30s (± 0.53%) 1.30s (± 0.67%) +0.01s (+ 0.46%) 1.28s 1.32s
Bind Time 0.70s (± 0.88%) 0.70s (± 0.48%) +0.00s (+ 0.29%) 0.70s 0.71s
Check Time 4.54s (± 0.81%) 4.53s (± 0.50%) -0.00s (- 0.04%) 4.49s 4.59s
Emit Time 2.96s (± 0.72%) 2.98s (± 0.59%) +0.02s (+ 0.81%) 2.95s 3.03s
Total Time 9.49s (± 0.42%) 9.52s (± 0.28%) +0.03s (+ 0.31%) 9.45s 9.57s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
Benchmark Name Iterations
Current 36092 10
Baseline master 10

@michael-land
Copy link

michael-land commented Mar 8, 2022

Is there any settings could disable this??

It's so annoying when use DI framework like nest.js. I want it always import value not type.

image

image

it will raise runtime error for imports statement likes this, and hard to catch during build.

@andrewbranch
Copy link
Member Author

It doesn’t do this unless you set importsNotUsedAsValues: "error" or "preserve" in your tsconfig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants