Closed kungfooman closed 7 months ago
Test:
/** * @param {1|2|3} a */ function square123(a, b) { return a * a; } square123( 0 ); // error square123( 1 ); square123( 2 ); square123("2"); // error square123( 3 ); square123( 4 ); // error square123("4"); // error
Current output:
/** * @param {1|2|3} a */ function square123(a, b) { if (!assertType(a, { "type": "union", "members": [ "1", "2", "3" ], "optional": false }, 'square123', 'a')) { youCanAddABreakpointHere(); } return a * a; } square123(0); // error square123(1); square123(2); square123("2"); // error square123(3); square123(4); // error square123("4"); // error
DevTools:
There are multiple ways to fix this, but I have to contemplate that a bit more for the PR...
Test:
Current output:
DevTools:
There are multiple ways to fix this, but I have to contemplate that a bit more for the PR...