Closed as not planned
Description
🔎 Search Terms
optional chaining, null, undefined, property does not exist on type never
🕗 Version & Regression Information
- This is a crash
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
⏯ Playground Link
💻 Code
type Project = {
id: number
title: string,
link: string,
description: string
}
let project: Project | null = null;
console.log(project?.title);
🙁 Actual behavior
TypeScript is not recognizing that project
can be of type Project
, giving a type error:
Property 'title' does not exist on type 'never'.
🙂 Expected behavior
I would expect for TypeScript to accept Project
as a possible type for the variable.
Additional information about the issue
No response