-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript 4.1.3
/**
* @template {function} T
* @param {T} fn
* @returns {(...args: Parameters<T>) => void}
*/
function throttle(fn) {
return (...args) => {
fn(...args);
};
}
const tfn = throttle((/**@type {string}*/x) => x);
tfn(); // NO ERROR (WRONG)
tfn("foo") // No error (Right!)
tfn(1); // Error (Right!)
tfn("foo", 2); // Error (Right!)tsconfig.json
{
"compilerOptions": {
"target": "es6",
"jsx": "react",
"allowJs": true,
"checkJs": true,
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"noImplicitAny": false,
"moduleResolution": "node",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"typeRoots": [
"./node_modules/@types",
"./@types"
]
},
"include": [
"@types/**/*",
"lib"
],
"exclude": [
"node_modules"
]
}Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
