Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allows emitting buildInfo when --noEmit is specified#39122

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
sheetalkamat merged 2 commits intomasterfromnoEmitIncremental
Jun 18, 2020

Conversation

sheetalkamat
Copy link
Member

This change emits buildinfo even ifnoEmit is specified
Now referencing composite project withnoEmit setting is error instead of erroring on project itself.
This allows to typecheck only run on composite projects just like any other project.
Also as part of this change, there were checker errors that were skipped ifnoEmit is on. Instead now those errors are generated but filtered when someone asks for semanticDiagnostics instead. This allows to preserver the diagnostics across emit and noEmit builds and having to invalidate cache/emit files/make extra pass on the code to get those diagnostics
Fixes#38440

minedeljkovic, deftomat, vkrol, SurajKalsiSky, ashfurrow, LukasKalbertodt, chibicode, swarthy, mshustov, jkillian, and 7 more reacted with hooray emoji
Copy link
Member

@sandersnsandersn left a comment

Choose a reason for hiding this comment

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

Changes look reasonable, although I'm not an expert on how noEmit should interact with buildinfo.

@sheetalkamatsheetalkamat merged commitb977f86 intomasterJun 18, 2020
@sheetalkamatsheetalkamat deleted the noEmitIncremental branchJune 18, 2020 18:05
Copy link
Member

@amcaseyamcasey left a comment

Choose a reason for hiding this comment

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

I like the idea, but I had some trouble understanding the implementation.

@@ -462,7 +462,6 @@ namespace ts {
{
name: "noEmit",
type: "boolean",
affectsEmit: true,
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I find this surprising enough that I'd leave it present but commented out and with an explanation.

sandersn reacted with thumbs up emoji
@@ -1013,6 +1013,12 @@ namespace ts {
}
}

function errorSkippedOn(key: keyof CompilerOptions, location: Node | undefined, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic {
Copy link
Member

Choose a reason for hiding this comment

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

I'm having trouble wrapping my head around what this does and would find an explanation helpful.

Copy link
Member

Choose a reason for hiding this comment

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

location, message, arg0, ... are the existing error logging parameters.

key: keyof CompilerOptions is a typesafe way to assert thatkey, while a string, actually refers to a property inCompilerOptions. That way the string can safely be used as a property name ofCompilerOptions infilterSemanticDiagnostics:

filter(diagnostics, d => !d.skippedOn || !options[d.skippedOn])

This keeps diagnostics that

  1. were not issued byerrorSkippedOn, so didn't setskippedOn
    -OR-
  2. do haveskippedOn, which is guaranteed to be the name of a property in compiler options, say "noEmit". For the "noEmit" example,!options[d.skippedOn] is equivalent to!options.noEmit.

This meta-programming JS would require an enum plus a switch-case conversion in C# I think. Or the meta-programming facilities there, though the result wouldn't be as typesafe as in Typescript.

@@ -3675,6 +3678,11 @@ namespace ts {
return { diagnostics, sourceMaps: undefined, emittedFiles, emitSkipped: true };
}

/*@internal*/
export function filterSemanticDiagnotics(diagnostic: readonly Diagnostic[], option: CompilerOptions): readonly Diagnostic[] {
Copy link
Member

@sandersnsandersnJun 23, 2020
edited
Loading

Choose a reason for hiding this comment

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

should probably be nameddiagnostics andoptions

Choose a reason for hiding this comment

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

There's also a typo in the function name.

joemaffei reacted with thumbs up emoji
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@glen-84glen-84glen-84 left review comments

@sandersnsandersnsandersn approved these changes

@amcaseyamcaseyamcasey left review comments

@RyanCavanaughRyanCavanaughAwaiting requested review from RyanCavanaugh

Assignees

@sheetalkamatsheetalkamat

Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Allow --noEmit to override incremental: true from tsconfig.json .tsbuildinfo file should be created when the noEmit flag is enabled
5 participants
@sheetalkamat@glen-84@sandersn@amcasey@typescript-bot

[8]ページ先頭

©2009-2025 Movatter.jp