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

Dead code is not detected after a never returning function call #13958

Closed
3n-mb opened this issue Feb 8, 2017 · 1 comment
Closed

Dead code is not detected after a never returning function call #13958

3n-mb opened this issue Feb 8, 2017 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@3n-mb
Copy link

3n-mb commented Feb 8, 2017

Related to #13957

TypeScript Version: 2.1.4
"strictNullChecks": true

Code

function justThrow(): never {
	throw new Error('We throw');
}

function makeString(n: number): string {
	justThrow();
	return `This is a dead code`;
}

Expected behavior:
Report that there is an unreachable (dead) code after a call to never returning function.

Actual behavior:
Dead code is not detected.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Feb 8, 2017
@RyanCavanaugh
Copy link
Member

RyanCavanaugh commented Feb 8, 2017

Flow control and function type analysis are done in two passes that don't fully interact with each other yet. Tons of open issues on this already, see #12825 as a starting point.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants