Thank you for these insights!
Victor
- 0 Posts
- 118 Comments
How are you posting this if you have flight mode turned on?
What field were you in? Happy to hear you’re doing well!
So it’s a library?
It would still be cool if they wrote what they’re actually delivering…
I think you confuse argument with parameter. You cannot specify the type of the parameter, but any argument you supply to a function in JS has a type. Every value in JS has a type, arguments included.
If I go:
const n = 0.0000005; console.log(typeof n);
The code above will print “number”. And you cannot assign
n.foo = "metadata";
to this value of a primitive type. Not everything is an object.Either way, arguments have types, values have types. The arguments in this case were of type “number”, when they should have been “string”.
You did say untyped though.
The function expects a string and does things in the function body which converts the object into a string.
… These are different words that describe exactly what I’m saying. I’m saying: in the place where there should be a string argument, because the function expects one, there is not a string argument, but a number argument. (Not an object like you keep saying.)
I know all that stuff about dynamically typed languages. I’m just saying that the function is being used incorrectly here.
Agreed, functions in general should do this, and some do. But it should probably be automatic. And the variable argument is a good one, a very good argument for TypeScript. ❤️
It’s not a string argument though, it’s JS
Huh? The code in the image is passing a number argument where there should be a string argument.
And this function is specifically made to parse a string into an int. Apply common sense.
But you’re calling a function specifically made for passing a string to an int… 😆 There’s gotta be some common sense somewhere here, guys.
Still, it’s a very good point. JS should do this.
I would suspect one reason it doesn’t do this is to be backwards compatible.
Classic people who don’t know how to code wat. Passing a number in place of a string argument because they don’t know what they’re doing.
I can kinda see that, yeah. 👍
Looks like one of them fish tank PC cases that are apparently a thing.
I hope it can follow the system state. It’s pretty much the only application left in my system that hasn’t had support for that AFAICT.
Victor@lemmy.worldto Ask Lemmy@lemmy.world•What’s a thing you miss that you’re 90% sure was objectively awful?16·8 days agoYou can miss something without being in a crisis lol
Victor@lemmy.worldto Ask Lemmy@lemmy.world•I cheated. Wife forgave me. How to reearn trust?4·9 days agoVery profound. Thanks for sharing it.
Yeah it’s very frustrating. Unless there’s a bunch of exciting features, just let it be. Especially these niche little repos.
If you want to promote a repo, better to make a post with details on what it is, does, and what you like about it. Not just posting a small update with only the title of the project followed by “released”.