Skip to content

"Used before assigned" error with arrow functions and strict null checks #9382

Closed
@Christoph-D

Description

@Christoph-D

TypeScript Version:

1.9.0-dev.20160627-1.0

Code

const f = () => { return f; };

Compiled with --strictNullChecks.

Expected behavior:

No errors.

Actual behavior:

foo.ts(1,26): error TS2454: Variable 'f' is used before being assigned.

It sems to be impossible to call f before f is assigned, so I don't think this should trigger an error.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions