Skip to content

Language Service typing for Diagnostic does not define file field as optional #15667

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

Closed
tomv564 opened this issue May 8, 2017 · 1 comment
Closed
Labels
Duplicate An existing issue was already created

Comments

@tomv564
Copy link

tomv564 commented May 8, 2017

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code

// in a project with compiler diagnostics:
const brokenFiles = service.getPreEmitDiagnostics().map(diag => diag.file.fileName);

Expected behavior:

The file field always contains a SourceFile as the Diagnostic type specifies,
or the Diagnostic type should mark the file field as optional.

Actual behavior:

file is missing in the compiler diagnostics sent back (and probably cannot be provided).

The origin of these 'incomplete' diagnostics is likely https://github.com/Microsoft/TypeScript/blob/2150a7796b0dfe83c5286755410e0fd1646ed86c/src/compiler/core.ts#L1235-L1251

@tomv564 tomv564 closed this as completed May 8, 2017
@RyanCavanaugh RyanCavanaugh added the External Relates to another program, environment, or user action which we cannot control. label May 8, 2017
@tomv564
Copy link
Author

tomv564 commented May 8, 2017

Sorry, duplicate of #15666

@RyanCavanaugh RyanCavanaugh added Duplicate An existing issue was already created and removed External Relates to another program, environment, or user action which we cannot control. labels May 8, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants