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

Problems view doesn't report TypeScript unreachable code #54494

Closed
jonchardy opened this issue Jul 17, 2018 · 2 comments
Closed

Problems view doesn't report TypeScript unreachable code #54494

jonchardy opened this issue Jul 17, 2018 · 2 comments
Assignees
Labels
*as-designed Described behavior is as designed typescript Typescript support issues

Comments

@jonchardy
Copy link

jonchardy commented Jul 17, 2018

Issue Type: Bug

  1. Set "typescript.reportStyleChecksAsWarnings": false so that unreachable code is an error.
  2. Create a simple file:
function test(): boolean {
  return true;
  return false;
}

test();

The return false line is greyed out and upon hover shows the TS error, but the problems view doesn't report it. It also causes an error during compilation.

image

VS Code version: Code 1.25.1 (1dfc5e5, 2018-07-11T15:43:53.668Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz (8 x 2112)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: disabled_software
video_decode: enabled
video_encode: enabled
vpx_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 31.84GB (23.18GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Extensions: none
@mjbvz mjbvz self-assigned this Jul 17, 2018
@mjbvz
Copy link
Collaborator

mjbvz commented Jul 19, 2018

This matches the behavior of tsc. Unreachable code is not reported as an error (hence shown in problems) unless you set allowUnreachableCode": false or "strict": true in your tsconfig.json

@mjbvz mjbvz closed this as completed Jul 19, 2018
@mjbvz mjbvz added typescript Typescript support issues *as-designed Described behavior is as designed labels Jul 19, 2018
@jonchardy
Copy link
Author

Ok, figured out the problem. Our tsconfig is nested in a config folder, so allowUnreachableCode wasn't being accounted for properly. Looks like another use case for #12463, since we have different files named tsconfig in different folders.

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

2 participants