We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version:
Version 1.9.0-dev.20160624-1.0
Code
test.ts
function g(cb: () => Promise<boolean>): Promise<boolean> { return cb(); } function f(a: string | null): Promise<boolean> { if (a === null) { return Promise.resolve(false); } return g(() => { console.log(a.substr(1)); return Promise.resolve(true); }); }
execute the command tsc --target es2015 --module commonjs --strictNullChecks test.ts.
tsc --target es2015 --module commonjs --strictNullChecks test.ts
Expected behavior:
There is no compile error.
Actual behavior:
test.ts(9,21): error TS2531: Object is possibly 'null'.
The text was updated successfully, but these errors were encountered:
Essentially duplicate of #9263 and #7662 as narrowing is reset across function boundaries as explained in #7718 (comment).
Sorry, something went wrong.
OK, I understand 👍
No branches or pull requests
TypeScript Version:
Version 1.9.0-dev.20160624-1.0
Code
test.ts
execute the command
tsc --target es2015 --module commonjs --strictNullChecks test.ts
.Expected behavior:
There is no compile error.
Actual behavior:
test.ts(9,21): error TS2531: Object is possibly 'null'.
The text was updated successfully, but these errors were encountered: