-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
TypeScript Nightly version 3.8.0-dev.20191113
Playground link
Compiler Options:
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"useDefineForClassFields": false,
"alwaysStrict": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"downlevelIteration": false,
"noEmitHelpers": false,
"noLib": false,
"noStrictGenericChecks": false,
"noUnusedLocals": false,
"noUnusedParameters": false,
"esModuleInterop": true,
"preserveConstEnums": false,
"removeComments": false,
"skipLibCheck": false,
"checkJs": false,
"allowJs": false,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"target": "ES2017",
"module": "ESNext"
}
}
Input:
const f = (a: { b: boolean, c: number } | undefined) => (a?.b || null) && a.c;
Output:
Compiler error: Object is possibly 'undefined'.(2532)
Expected behavior:
Successful compilation
Note:
const f = (a: { b: boolean, c: number } | undefined) => (a?.b || false) && a.c;
(using false
instead of null
) works as expected.
sehcheese, mgrahamx, AlansCodeLog and lo1tuma
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript