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

As a developer I want advanced static code analysis regarding implications between statements #2539

Open
mmews-n4 opened this issue Aug 31, 2023 · 0 comments

Comments

@mmews-n4
Copy link
Contributor

See the example below.

Example

function f(arg1: any+) {
    const val1 = arg1?.val; // implication 1: if val1 is truthy => arg1 is also truthy
    const val2 = val1?.prop; // implication 2: if val2 is truthy => val1 is also truthy
    const query = val2 ? {
        someProp: val1.prop // here we know based on implication 2 that val1 is truthy
    } : null;
    query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant