Last active
November 17, 2023 13:55
-
-
Save avaly/770d08f6321586002e3c7492813b4dfe to your computer and use it in GitHub Desktop.
prettier-experimental-ternaries-samples.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Having the condition start on a newline is not readable | |
const availabilityStartDate = | |
availability.startDate ? DateTime.fromJSDate(availability.startDate, { zone: 'utc' }) : DateTime.now().toUTC(); | |
// Previously it was much more readable: | |
const availabilityStartDate = availability.startDate | |
? DateTime.fromJSDate(availability.startDate, { zone: "utc" }) | |
: DateTime.now().toUTC(); | |
///////////////////////////////////////////////////////////// | |
// The wrapping parenthesis are in a weird position | |
const columns = ( | |
definition.length > 1 && typeof definition[1] === 'object' ? | |
definition[0] | |
: definition) as PGIndexElement<TDocument>[]; | |
// Previously it was much more readable: | |
const columns = ( | |
definition.length > 1 && typeof definition[1] === 'object' ? definition[0] : definition | |
) as PGIndexElement<TDocument>[]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment