// src/main.js
/**
* @param {number} length
*/
export function rectArea(length) {
const width = arguments[1];
if (typeof width === 'number') {
return length * width;
}
return length * length;
}
rectArea(3);
rectArea(4, 5);
With no error.
With error.
src/main.js:17:13 - error TS2554: Expected 1 arguments, but got 2.
17 rectArea(4, 5);
~
Found 1 error in src/main.js:17
There are (somewhat) related sections on
CHANGES.md, but none of them are describing what I observe here.Steps to reproduce
npx tsgo --initto get the default tsconfig. Turn on these flags as well.src/main.js. Runnpx tsc&npx tsgoto see the difference.Behavior with
typescript@6.0Emit
With no error.
Behavior with
tsgoEmit
With error.