-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Show implied options in --showConfig #56701
Conversation
@typescript-bot perf test this |
Heya @andrewbranch, I've started to run the regular perf test suite on this PR at 1032991. You can monitor the build here. Update: The results are in! |
/** @internal */ | ||
export const getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue; | ||
/** @internal */ | ||
export const getIsolatedModules = computedOptions.isolatedModules.computeValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One advantage is that these functions now automatically say what they depend on in their parameter type. The signature of this one, for example, is (compilerOptions: Pick<CompilerOptions, "isolatedModules" | "verbatimModuleSyntax">) => boolean
@andrewbranch Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me.
I know the perf doesn't seem to be affected, but I do wonder if we should lift all of these calls in the checker upward so they're all precalculated and local, rather than continually calculating them. e.g. we call getEmitModuleResolutionKind
and getESModuleInterop
a looot. As evidenced by this change, they all strictly depend on compilerOptions
, so could be known immediately.
moduleResolution: computedCompilerOption("moduleResolution", ["module", "target"], (compilerOptions): ModuleResolutionKind => { | ||
let moduleResolution = compilerOptions.moduleResolution; | ||
if (moduleResolution === undefined) { | ||
export const computedOptions = createComputedCompilerOptions({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Andarist for helping with this tricky inference 🌟
This only works in recent nightlies, hence the “LKG” bump (cc @jakebailey)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mind bumping the TS version, though I am wondering which PR was needed to make this pattern work (and of course if there's any change at all that we could avoid it 😅).
But yeah, this pattern is nicer than the previous IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s the recent improvement from #55811 . It was merged in just last week :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good apart from minor nits
Fixes my minor annoyance from earlier today
--showConfig
on this tsconfig:Before:
After: