|
Am I expecting too much when I was hoping that VS Code would notify me about stupid small mistakes, like reassigning a const or using = instead of === inside an if? What's the best way to handle this: -never do mistakes -attach eslint to every single script separately -install eslint globally and deal with that hassle? Obfuscation fucked around with this message at 13:09 on Aug 10, 2018 |
# ¿ Aug 10, 2018 13:06 |
|
|
# ¿ Apr 29, 2024 16:53 |
|
smackfu posted:Use WebStorm? But it costs money! I really like PyCharm though, so I'll check it out.
|
# ¿ Aug 10, 2018 13:33 |
|
Thermopyle posted:I realize this is old, but PyCharm is a superset of webstorm...at lease on the professional version, not sure about community edition. Community version of PyCharm doesn't do javascript, sadly.
|
# ¿ Sep 5, 2018 18:16 |
|
e: or that, whatever, glhf
|
# ¿ Sep 12, 2018 10:02 |
|
What's the easiest way to turn an existing React app into an Electron app? I tried electron-forge but it was opinionated in ways that I didn't care for and couldn't quickly figure out how to configure. I also looked at some boilerplate projects but they were all massively overcomplicated for what I actually need.
|
# ¿ Feb 10, 2019 15:42 |
|
I've been using [...Array(x)] as a hacky way to initialize empty arrays but this doesn't work in typescript. Is there a better way?
|
# ¿ Feb 16, 2019 17:25 |
|
necrotic posted:Array(x).fill(undefined) It does work, thanks.
|
# ¿ Feb 16, 2019 18:16 |
|
I had a pretty annoying bug today. Turns out that neither tslint or typescript compiler will warn you about referencing an undeclared variable called "name"... because (obviously?) it shadows window.name. I even had a test that covered the bugged code but since jest environment has a default value for window.name while Chrome doesn't, the code worked in tests and broke in production.
|
# ¿ Feb 28, 2019 20:08 |
|
TheFluff posted:I would have expected no-restricted-globals to complain about that. Do you have that enabled? Looks like it was only implemented last week, I guess it's time to update tslint.
|
# ¿ Mar 1, 2019 14:55 |
|
Yarn still doesn't support npm audit fix, right?
|
# ¿ Jan 26, 2020 19:44 |
|
Ytlaya posted:edit: Hm, I think I found what the issue is for the second and third (IE JS not supporting the ellipsis rest syntax or default parameter values), and I'm guessing the issue with the first is something similar. Is there any reason why IE is like this? Safari also seems to frequently have problems that Firefox/Chrome don't have. Yeah IE doesn't support arrow functions or the spread operator since those are from ES6 and IE hasn't been updated in forever. Look into Babel for transpiling your code to an older standard.
|
# ¿ Nov 12, 2020 21:09 |
|
oh no computer posted:
The reducer here is why all of your users are getting added to the store after every request, you need some logic here that merges the new users with the already stored ones based on userId or something. Also throw some console.logs to check that the userId gets passed all the way to the action, because if it's null or something then you will actually get all the users in the response.
|
# ¿ Mar 3, 2021 17:03 |
|
Combat Pretzel posted:This Node.JS stuff is weeeeeird. The one made with Link has an event handler attached to it that captures your click and handles it as an app state change instead.
|
# ¿ Mar 10, 2021 21:33 |
|
I haven’t done React in a while, but I’m guessing that at some point there are duplicate strings in the array which causes the key error and after that the component just shows wrong data
|
# ¿ May 13, 2022 11:04 |
|
You are getting a compile time error because [[]] is a nonsensical type that seems to only accept an empty array inside another array? Define return values for your api call, or use 'any' to bypass the type checking edit: the thing that returns from the api is probably something like [Record<string, string>, Record<string, string>]. The api turns the data into JSON when it sends the response, and JSON has objects instead of dictionaries. Obfuscation fucked around with this message at 20:19 on Aug 4, 2022 |
# ¿ Aug 4, 2022 20:07 |
|
Check the position of the screen after scrolling and compare it to element positions, something like this.
|
# ¿ Dec 15, 2022 19:10 |
|
Now all you need is a state management system that knows which templates to re-render when your state changes and whoops, you have re-invented react
|
# ¿ Jan 31, 2023 11:09 |
|
As for that latter example, normally you don't use a class in Typescript just to hold data like that, you are using a javascript object and a typescript interface to add types to the contents of that object. Since TS uses duck typing, you don't need to declare an explicit type for your objects, as long as they fulfill the expected interface they are ok. Not sure if I'm making sense but here's a code example to show what I mean: TypeScript code:
Obfuscation fucked around with this message at 20:12 on Jun 21, 2023 |
# ¿ Jun 21, 2023 20:07 |
|
|
# ¿ Apr 29, 2024 16:53 |
|
Does anyone know why Temporal is still not ready?
|
# ¿ Mar 19, 2024 20:48 |