Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Used before assigned" error when assigned in a function #25674

Closed
KoltesDigital opened this issue Jul 15, 2018 · 2 comments
Closed

"Used before assigned" error when assigned in a function #25674

KoltesDigital opened this issue Jul 15, 2018 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@KoltesDigital
Copy link

TypeScript Version: 3.0.0-dev.20180712

Search Terms: "Used before assigned"

Code

let angle: number;

function compute() {
	angle = 0;
}

compute();
angle += 2;

Expected behavior:

Passes.

Actual behavior:

error TS2454: Variable 'angle' is used before being assigned.
angle += 2;
@j-oliveras
Copy link
Contributor

Duplicate of #9998.

@KoltesDigital
Copy link
Author

Thanks.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants