Closed
Description
Repro
{
"rules": {
"typescript/no-use-before-define": ["error",{"typedefs": true}]
}
}
// Should error according to docs, but it wont
let myVar: StringOrNumber = 'hello'
type StringOrNumber = string | number
Expected Result
Should work according to docs
Actual Result
Doesn't work at all
Additional Info
Also dunno if this is considered within the implementation, but there is a common pattern in React to get Props/State types from implementation by leveraging typeof
. So if typedefs
is set to false
this should not raise any error:
type State = typeof initialState
const initialState = { count: 0, who: ''}
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
1.3.0 |
@typescript-eslint/parser |
X.Y.Z |
TypeScript |
3.3.3 |
ESLint |
5.12 |
node |
8.15 |
npm |
X.Y.Z |
Metadata
Metadata
Assignees
Labels
Something isn't workingSomething isn't workingIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues that are caused by bugs/incomplete cases in the scope analyserIssues that are caused by bugs/incomplete cases in the scope analyser