eamodio / vscode-tsl-problem-matcher

TypeScript + Webpack Problem Matchers for VS Code
MIT License
44 stars 9 forks source link

This condition will always return 'false' since the types 'false' and 'true' have no overlap #8

Closed vikicoder007 closed 3 years ago

vikicoder007 commented 3 years ago

Issue Type: Bug image

inst.getCartItems(function(items :any){
        var item_found = false;
        items = items.map(function(item:any){
          if(item.product_id == product_id){
            item_found = true;
            item.quantity = item.quantity+quantity;
          }
          return item;
        });

       //This condition will always return 'false' since the types  'false' and 'true' have no overlap
        if(item_found == true){
            items.push({
              product_id : product_id,
              quantity : quantity
            });
        }
        localStorage.setItem("cart",JSON.stringify(items));
      });

seems validator is not detecthing variable scrope inside map function

Extension version: 0.4.0 VS Code version: Code 1.54.3 (2b9aebd5354a3629c3aba0a5f5df49f43d6689f8, 2021-03-15T10:55:45.459Z) OS version: Windows_NT x64 10.0.19042

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx (8 x 2096)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: enabled
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|7.69GB (2.40GB free)| |Process Argv|--crash-reporter-id 78883d0f-eda4-4725-a7a0-cb18b15554c9| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 pythonvspyt700cf:30270857 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vstry244:30276681 pythonvsdeb440:30248342 pythonvsded773:30248341 vstes516:30244333 pythonvspyt875:30259475 pythonvsnew554:30281908 pythontbcf:30265426 pythonvspyt943:30280189 openwsldoc:30282072 vspre833:30267464 pythonptprofiler:30281270 vshan820cf:30276953 ```
eamodio commented 3 years ago

This project doesn't provide any validation/errors/etc, it is just a library that captures errors/warnings out of the terminal and provides them to the vscode UI. You'll need to open an issue for TypeScript or ESLint or whatever is actually doing the code validation. Thanks!