Closed
Description
Repro
{
"rules": {
"@typescript-eslint/no-use-before-define": ["error"]
}
}
const updatedAt = data?.updatedAt;
// ^^^^^^^^^
// 'updatedAt' was used before it was defined. (@typescript-eslint/no-use-before-define)
Expected Result
Would not produce any errors.
Actual Result
Produces an error:
// 'updatedAt' was used before it was defined. (@typescript-eslint/no-use-before-define)
Additional Info
This issue seems to only happen when the variable name is the same as the property name. For instance, the code below does not show the warning:
const timestamp = data?.updatedAt;
Versions
package | version |
---|---|
@typescript-eslint/parser | 2.4.0 |
TypeScript | 3.7.0-beta (15 Oct 2019) |
ESLint | 6.5.1 |
node | 12.11.1 |
npm | 6.11.3 |
yarn | 1.19.1 |