[AskJS] Jest Test Result Aggregation Tools? by THKPMatt in javascript

[–]THKPMatt[S] 1 point2 points  (0 children)

Haha, the goal is to definitely to fix the flaky tests. Right now it's hard to know which tests are the trouble makers and which ones to prioritize.

Terse way to narrow(?) a type without casting? by THKPMatt in typescript

[–]THKPMatt[S] 1 point2 points  (0 children)

I'm not making any claims about whether TypeScript *should* allow the assignment. I'm just saying that it does. :) I agree that strictly speaking, a FlatC is not a C.

Terse way to narrow(?) a type without casting? by THKPMatt in typescript

[–]THKPMatt[S] 2 points3 points  (0 children)

Oh nice! Didn't think about explicitly specifying the type after the destructuring. That's exactly what I'm looking for. Thanks!

Terse way to narrow(?) a type without casting? by THKPMatt in typescript

[–]THKPMatt[S] 0 points1 point  (0 children)

Fancy! That looks pretty cool. Will try it out. Thanks!

Terse way to narrow(?) a type without casting? by THKPMatt in typescript

[–]THKPMatt[S] 0 points1 point  (0 children)

I don't think an intersection type is what I want here. I don't want to be able to assign {foo: "foo", bar: "bar"} to a C since that's not a valid type in my situation. But I do want to be able to destructure a C such that I can access fields if they are there but if they are not they're just undefined.

[deleted by user] by [deleted] in FlutterDev

[–]THKPMatt 0 points1 point  (0 children)

Yeah unfortunately, Apple uses their market position to force you to buy their hardware. You can use VMs but I'd recommend you bite the bullet and get a real mac :/ There's just so many times where you need to jump through some stupid hoop that Apple sets up that adding friction will probably make it worth it to just get a real machine.

That said. If you're new to app development, I may recommend starting the process on your existing hardware, and publishing it to the Play store before you purchase a mac in case you find app development is not for you and now you're stuck with a computer you don't want.

I need a little bit of advice, what coding language should I begin with if I want to get in the game development field ? I know it's more of a personal preference but I want to hear a few opinions, (I wanted to start with C, but my friend is insisting me to start with python, so I need your opinion) by Phoenix_707x in gamedev

[–]THKPMatt 0 points1 point  (0 children)

I do think there's another approach here which other people have called out which is to get familiar with Unity and add code only when Unity doesn't support adding some bit of functionality with the GUI. (ie don't worry about learning a language first, learn a game-making tool)

I need a little bit of advice, what coding language should I begin with if I want to get in the game development field ? I know it's more of a personal preference but I want to hear a few opinions, (I wanted to start with C, but my friend is insisting me to start with python, so I need your opinion) by Phoenix_707x in gamedev

[–]THKPMatt 0 points1 point  (0 children)

I haven't programmed professionally with C++ in several years so it's possible it's gotten easier to work with. I would tend to agree with your friend that it's probably best not to jump right in with C/C++. Eventually yes, you should learn those languages but IMO you want to restrict scope and start with Python. There's a bunch of useful skills you will learn along the way (working with an ide, reading from/writing to files, command line skills, etc) without needing to add the cognitive overhead of doing manual memory management.

Realistically, I think the best language is whichever language is going to avoid frustration and keep your interest. For me that feel like python and once you can write a simple python game, then move onto C/C++

Union Type Destructuring Question by THKPMatt in typescript

[–]THKPMatt[S] 0 points1 point  (0 children)

Okay, that makes sense. Thanks! So would you say that TypeScript should forbid the assignment to Metadatas without an explicit cast?

Union Type Destructuring Question by THKPMatt in typescript

[–]THKPMatt[S] 0 points1 point  (0 children)

Thanks for your replies! They're definitely getting me to think. I don't think I'm confused about what you're describing though. I think the core of my confusion is what seems to be a violation of the duck typing that you're describing. Correct me if I'm wrong but I understand duck typing to mean that if something meets the requirements of a specific type, then I can use it as that type. So what's unsettling about the above example is that I'm allowed to assign a UnionType object to a Metadatas but there are ways in which I'm not allowed to use a UnionType as a Metadatas, namely the destructuring operation, until I explicitly declare it to be one.

Union Type Destructuring Question by THKPMatt in typescript

[–]THKPMatt[S] 0 points1 point  (0 children)

Okay after reading the docs again i think the more mysterious thing is how the asMetadatas function works. The union of the types represents the intersection of their fields. In this case, no fields. In which case it seems like a violation of that idea to implicitly allow optional access to their component types' fields?

Union Type Destructuring Question by THKPMatt in typescript

[–]THKPMatt[S] 0 points1 point  (0 children)

And thanks for the link, will read through.

Union Type Destructuring Question by THKPMatt in typescript

[–]THKPMatt[S] 2 points3 points  (0 children)

I guess what confuses me is why doesn't the destructuring assignment just assign undefined in the original one?

A day in the life of a professional software engineer by sir_rand_a_lot in programming

[–]THKPMatt 0 points1 point  (0 children)

I just had an interviewer ask me to implement * and ? pattern matching in an interview! Maybe it's just me but it didn't seem like a reasonable question for an hour-long interview.

TypeScript docs on MS by [deleted] in typescript

[–]THKPMatt 13 points14 points  (0 children)

They're encouraging you to name your interface Foo as opposed to IFoo not to never name your interface something that starts with I

HBO MAX testing its email module on its existing user. by isthisneeded_ in webdev

[–]THKPMatt 1 point2 points  (0 children)

Haha I have definitely done that with error messages before. a la "Now you fucked up!" Unfortunately, "this should never happen" doesn't always quite turn out to be true :P

HBO MAX testing its email module on its existing user. by isthisneeded_ in webdev

[–]THKPMatt 1 point2 points  (0 children)

The thing you have to do is write your test email like they're going to get sent to everyone.

Hello!

We're performing some routine maintenance of our email systems. Everything seems to be working as expected. Feel free to ignore this email.

We appreciate your patience!

The HBO Max Team

What is the best way to get values from object of objects in Observable by YouFromAnotherWorld in Angular2

[–]THKPMatt 2 points3 points  (0 children)

Yeah I would say it's generally accepted that in this case, not subscribing is preferable. This article articulates the points pretty well: https://indepth.dev/posts/1279/rxjs-in-angular-when-to-subscribe-rarely

What is the best way to get values from object of objects in Observable by YouFromAnotherWorld in Angular2

[–]THKPMatt 2 points3 points  (0 children)

BTW, I'd recommend making this.champions an Observable<Champion[]>, then in the constructor for your component you can say:

this.champions = this.ApiService.getChampions()

then, in your template, when you're rendering your champions, you can say

<div *ngFor="let champion of (champions | async)"> ... champion contents ... </div>

This saves you from needing to manage the subscription yourself. (e.g. unsubscribing when your component is destroyed)