-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
/**
* Create a staggering delay for Svelte
* transitions that resets after every tick.
*
* @example
* const stagger = createStagger(100);
*
* const { delay: d0 } = stagger;
* const { delay: d100 } = stagger;
* const { delay: d200 } = stagger;
* const { delay: d300 } = stagger;
* const { delay: d400 } = stagger;
*
* setTimeout(() => {
* const { delay: d0 } = stagger;
* }, 0);
*/
export const createStagger = (offset: number) => {
let i = 0;
let rafHandle: ReturnType<typeof requestAnimationFrame> | undefined;
return {
get delay() {
rafHandle ??= requestAnimationFrame(() => {
i = 0;
rafHandle = undefined;
});
return offset * i++;
},
};
};
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unused-vars": "error",
},
};
tsconfig
Expected Result
The lint error is not raised for rafHandle
Actual Result
The lint error is raised for rafHandle
Additional Info
It seems like TypeScript follows the erraneous behaviour with the error 6133: 'rafHandle' is declared but its value is never read. 20:7 - 20:16
. HOWEVER, it is only raised on the playground, not on the latest stable version of VSCode:

Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin