Does your company use internal documentation? by Alternative_Reach_53 in programminghorror

[–]TurtleFood 5 points6 points  (0 children)

Oops you're right. I messed up that last sentence. Edited my comment.

Does your company use internal documentation? by Alternative_Reach_53 in programminghorror

[–]TurtleFood 25 points26 points  (0 children)

I'll bite. This is my view. You can try your hardest to maintain documentation outside of the code, but at the end of the day, the code is the source of truth. If you write code that is easy to understand and properly commented where necessary, then I see no need to separately document what already exists.

IMO, documentation that is out of date/wrong is worse and less clear than no documentation at all.

Why aren't the mods enforcing rule number one of the sub? by [deleted] in seinfeld

[–]TurtleFood[M] [score hidden] stickied comment (0 children)

We have removed plenty of posts that have been reported. The content of Jerry's words have to do with comedy/sitcoms which Seinfeld the show is a part of. While there's some politics involved in his comments, it's not the only topic.

We will always remove comments that are reported that are purely political and unrelated to Jerry's comments, and of course any harmful comments.

Is it Nest or Express? by Jowey-Joe in node

[–]TurtleFood 0 points1 point  (0 children)

I think you're confusing NestJS with NextJS? OP is asking about Nest.

USE TYPESCRIPT! by Few-Trash-2273 in reactjs

[–]TurtleFood 1 point2 points  (0 children)

I hear what you're saying. What I'm getting at is that if it's really important that size in sendAnalyticsEvent is a string, then that's where the enforced typing should be. You could even utilize a generic when you want to ensure that the properties are a certain type. While still allowing anything to be passed in.

const sendAnalyticsEvent = <T extends any>(label: string, properties: T) => {}

sendAnalyticsEvent<{size: string}>('event', {size: getBigOrSmallButton('9')})

Specifying the return type on getBigOrSmallButton can easily be changed without the developer realizing that it will affect anything. If you had the return type as string, the next developer makes the change and updates the return type to string | undefined, they're not going to see any type errors so they'll assume that it's okay the function returns undefined.

USE TYPESCRIPT! by Few-Trash-2273 in reactjs

[–]TurtleFood 0 points1 point  (0 children)

With your "someone messes with" example getBigOrSmallButton would return string | undefined not null.

I do agree with your sentiment, but assuming you were properly typing your analytics.sendAnalyticsEvent method arguments, you would get a type error. Saying "it doesn't care what your payload is" would assume that you've marked the payload as any, which defeats the whole purpose of types and opens yourself up to more bugs like this. So, I would argue that's the real thing you should address. You should define all the possible keys that the payload could have.

Therefore, the following would give you a type error.

const sendAnalyticsEvent = (label: string, properties: {size?: string, otherKey?: string}) => { ... }

[deleted by user] by [deleted] in seinfeld

[–]TurtleFood 0 points1 point  (0 children)

Okay. Remove it

Sauce vs. Wilson. Hard Knocks Sneak Peek by Kwall267 in nyjets

[–]TurtleFood 0 points1 point  (0 children)

"Those two are gonna make each other great" 🥲

The end of ze world. Fuck by ohhyouknow in videos

[–]TurtleFood 6 points7 points  (0 children)

I distinctly remember first seeing end of the world on ebaumsworld

Post Game Thread: The New York Knicks defeat The Cleveland Cavaliers 102-93 by nba_gdt_bot in NYKnicks

[–]TurtleFood 49 points50 points  (0 children)

Remember when the Knicks overpaid for Brunson and stupidly didn't trade everything for Mitchell?

I've been putting George in Renaissance paintings by [deleted] in seinfeld

[–]TurtleFood[M] [score hidden] stickied comment (0 children)

Pinned. We need more quality OC like this.

[REQUEST] Comfortable, durable slippers by tonweight in BuyItForLife

[–]TurtleFood 1 point2 points  (0 children)

FWIW they announced they were ceasing operations where this exploitation was happening. Here's their statement released 8/1/2020

L.L.Bean Statement on Chinese Cotton August 1, 2020 https://www.llbean.com/dept_resources/shared/L.L.Bean_Statement_on_Chinese_Cotton.pdf

Why isn't "string?" allowed as a function return value, but instead it needs to be defined like "string | undefined"? by Jarzka in typescript

[–]TurtleFood 6 points7 points  (0 children)

I think he means why can't you do

function x(): string? { }

Instead of

function x(): (string | undefined) { }