π Search Terms
This binary expression is never nullish
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.6.0-beta#code/KYOwrgtgBACghgJwC4HkBmAROBPKBvAWACgBIAOQEsBzACySQomCgF4oAmKAKi6gAYANMRJYA7iFYduvAIxDSAZTAgEFAM7M2nHh3kicDJpO28AzHqUgNSY9KgAWPRjBqA1rZ0BWecICCAG38sbENNKDEJAB8oS1UNKGjg0ISY5Ws9AP9KWnpGMOc3FOy6UIz-URw1SUykvJTM4tymeQBfYmIAE2AAY39EZm6AeysbKgRBsAAHAC4oACUewYQOgB54ZHRggShwCAAjYAQAbQBdU5TlLrQKEGAOgD4Abk6evoQB4bUbScRUTBxZus-sFnkRiEMRlBrFU2JdgNdbh1hAB6ZFQJAIXBjODgN5QH7IKCDNBQDo4KDXBBfYQAfhpUDGE0mRwJwJwJxRaKQNFAUG6PO67goJO5zGxuMQ+N+RJJZNw6igONwrJlO2oJTy2xxHSgwqhg3RmMVgTVOShP3Ealp9IAFEDNjgAHQNdVNZgAMilG3+uHpjKmR3tPudgUaoROUFmcIRdwAlJz0TyJPyekKRTyGQgcWA8SriaTyQqlV6bPm5aVFSAdXq1AaMbg4Ca5ea4JbrVA7b8HdgQ0EDHVPazu1A-eMA0Hgr3akwI1Gq-CbnGE2hG-49nBBeiDauC7g1BarO3-cyJ06AhVsGoTqCgA
π» Code
const sets = undefined
// try granular part of day first
?? group[partOfDay]
// then check if the granular part of day is any part of nighttime, and if so try all night spawns
?? (PartOfDay.AllNighttime & partOfDay ? group[PartOfDay.AllNighttime] : undefined)
// then check if the granular part of day is any part of daytime, and if so try all day spawns
?? (PartOfDay.AllDaytime & partOfDay ? group[PartOfDay.AllDaytime] : undefined)
// fallback to all day spawns
?? group[PartOfDay.Always];
π Actual behavior
My codebases have a number of instances of things similar to the above β undefined is used to put the actual potential results each on their own line, all formatted the same way. However this no longer works in TS 5.6.0 due to it throwing an error. I think this is an over-eager error message.
π Expected behavior
I should be able to format the code how I want to still
Additional information about the issue
Other examples of code in my codebases broken by this
let plugs: PlugRaw[] = undefined
?? (this.state ? refresh.plugs ?? [] : undefined)
?? this.plugs?.slice()
?? (!this.plugSetHash ? undefined : (await DestinyPlugSetDefinition.get(this.plugSetHash))?.reusablePlugItems)
?? (this.plugSetHash ? undefined : (await DeepsightSocketExtendedDefinition.get(this.item?.definition.hash))?.sockets[this.index]?.rewardPlugItems)
?? [];
Component.create()
.classes.add(ItemTooltipSourceClasses.ActivityName)
.text.set(undefined
?? Display.name(lostSectorDisplay)
?? Display.name(source.dropTable.displayProperties)
?? Display.name(activity))
.appendTo(activityComponent);
.setRefreshMethod(() => undefined
?? (status === UiStatusType.Cut ? this.human?.getStatusLevel(StatusType.Bleeding) === BleedLevel.Minor : undefined)
?? (status === StatusType.Bleeding ? this.human?.getStatusLevel(StatusType.Bleeding) === BleedLevel.Major : undefined)
?? !!this.human?.hasStatus(status as StatusType))
Also, this still works for true && conditions and false || conditions β would be nice if it stayed consistent:
const inRange = true
&& gatherTile.x - treasureRange <= treasure.x && gatherTile.x + treasureRange >= treasure.x
&& gatherTile.y - treasureRange <= treasure.y && gatherTile.y + treasureRange >= treasure.y
&& executor.z === map.position.z;
const needsAuthView = false
|| (viewRequiredAuth === "required" && !ProfileManager.isAuthenticated())
|| (viewRequiredAuth === "spy" && !ProfileManager.get());
π Search Terms
This binary expression is never nullish
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.6.0-beta#code/KYOwrgtgBACghgJwC4HkBmAROBPKBvAWACgBIAOQEsBzACySQomCgF4oAmKAKi6gAYANMRJYA7iFYduvAIxDSAZTAgEFAM7M2nHh3kicDJpO28AzHqUgNSY9KgAWPRjBqA1rZ0BWecICCAG38sbENNKDEJAB8oS1UNKGjg0ISY5Ws9AP9KWnpGMOc3FOy6UIz-URw1SUykvJTM4tymeQBfYmIAE2AAY39EZm6AeysbKgRBsAAHAC4oACUewYQOgB54ZHRggShwCAAjYAQAbQBdU5TlLrQKEGAOgD4Abk6evoQB4bUbScRUTBxZus-sFnkRiEMRlBrFU2JdgNdbh1hAB6ZFQJAIXBjODgN5QH7IKCDNBQDo4KDXBBfYQAfhpUDGE0mRwJwJwJxRaKQNFAUG6PO67goJO5zGxuMQ+N+RJJZNw6igONwrJlO2oJTy2xxHSgwqhg3RmMVgTVOShP3Ealp9IAFEDNjgAHQNdVNZgAMilG3+uHpjKmR3tPudgUaoROUFmcIRdwAlJz0TyJPyekKRTyGQgcWA8SriaTyQqlV6bPm5aVFSAdXq1AaMbg4Ca5ea4JbrVA7b8HdgQ0EDHVPazu1A-eMA0Hgr3akwI1Gq-CbnGE2hG-49nBBeiDauC7g1BarO3-cyJ06AhVsGoTqCgA
π» Code
π Actual behavior
My codebases have a number of instances of things similar to the above β
undefinedis used to put the actual potential results each on their own line, all formatted the same way. However this no longer works in TS 5.6.0 due to it throwing an error. I think this is an over-eager error message.π Expected behavior
I should be able to format the code how I want to still
Additional information about the issue
Other examples of code in my codebases broken by this
Also, this still works for
true &&conditions andfalse ||conditions β would be nice if it stayed consistent: