Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[no-use-before-define]: typedefs option doesn't work #249

Copy link
Copy link
Closed
@Hotell

Description

@Hotell
Issue body actions

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

bugSomething isn't workingSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginscope analyserIssues that are caused by bugs/incomplete cases in the scope analyserIssues that are caused by bugs/incomplete cases in the scope analyser

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.