BVB Source Codes

prettier Show break.js Source code

Return Download prettier: download break.js Source code - Download prettier Source code - Type:.js
  1. function foo(b) {
  2.     var x = b ? null: false;
  3.     var z;
  4.     while(b) {
  5.         if (x == null) { z = ""; break; }
  6.         var y:number = x; // error: boolean !~> number
  7.     }
  8.     var w:number = z; // 2 errors: ?string !~> number
  9. }
  10.  
  11. function bar(b) {
  12.     var x = b ? null: false;
  13.     if (x == null) return;
  14.     switch ("") {
  15.     case 0:
  16.         var y:number = x; // error: boolean !~> number
  17.         x = "";
  18.     case 1:
  19.         var z:number = x; // 2 errors: (boolean | string) !~> number
  20.         break;
  21.     case 2:
  22.     }
  23.     var w:number = x; // 2 errors: (boolean | string) !~> number
  24. }
  25.  
  26. function bar2(b) {
  27.     var x = b ? null: false;
  28.     if (x == null) return;
  29.     switch ("") {
  30.     case 0: {
  31.       let y:number = x; // error: boolean !~> number
  32.       x = "";
  33.     }
  34.     case 1: {
  35.       let z:number = x; // 2 errors: (boolean | string) !~> number
  36.       break;
  37.     }
  38.     case 2:
  39.     }
  40.     var w:number = x; // 2 errors: (boolean | string) !~> number
  41. }
  42.  
  43. function qux(b) {
  44.     var z = 0;
  45.     while(b) {
  46.         var y:number = z;
  47.         if (b) { z = ""; continue; } // error: string !~> number
  48.         z = 0;
  49.     }
  50.     var w:number = z; // error: string !~> number
  51. }
  52.  
  53. // same basic test as foo(), but with const. probes the
  54. // logic that still uses havoc to do env resets.
  55. function test_const() {
  56.   let st: string = 'abc';
  57.  
  58.   for (let i = 1; i < 100; i++) {
  59.     const fooRes: ?string = "HEY";
  60.     if (!fooRes) {
  61.       break;
  62.     }
  63.  
  64.     st = fooRes; // no error
  65.   }
  66.  
  67.   return st;
  68. }
  69.  
downloadbreak.js Source code - Download prettier Source code
Related Source Codes/Software:
storybook - 2017-06-07
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
prepack - Prepack is a partial evaluator for JavaScript. Pre... 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top