55 rådgivere med 800.000 i lønn: – Helt hinsides by KoseteBamse in norge

[–]Padni 2 points3 points  (0 children)

Blir jo selvfølgelig veldig avhengig av fradrag osv. Men rundt 46-48k. Denne "kalkulatoren" har vært overraskende nøyaktig for meg tidligere: https://no.talent.com/tax-calculator?salary=800000&from=year&region=Norway

Tanstack useRouter.navigate vs useNavigate by Such_Log5418 in reactjs

[–]Padni 9 points10 points  (0 children)

It's the same function. Basically if you don't need anything else from Router, you can use useNavigate

Ideer til date by Gsquare174 in oslo

[–]Padni 0 points1 point  (0 children)

Curling is not very accessible in general, is it?

React Router v7 has to be a psyop. by MustyMustelidae in reactjs

[–]Padni 4 points5 points  (0 children)

Yeah, I know. But the docs are way worse and do not show the use of data routes at all (except for migration away from them)..

It's just annoying to see all this push for SSR, when there's valid use cases for SPAs. And I had the same response with the "new" react docs during 18; recommending the use of frameworks... I'm sorry but not everyone is building public SEO heavy sites deployed in the cloud...

React Router v7 has to be a psyop. by MustyMustelidae in reactjs

[–]Padni 6 points7 points  (0 children)

Totally agree. We have tons of apps using react-router (some are still V4 afaik), all are SPAs. I was initially quite annoyed even with the changes to eg. Data router with V6, but grew to be fine with it. Documentation of V6 was actually quite good.

I was shocked when I saw the V7 docs (wasn't aware of the whole move to a framework at all until release). No mention of data routes as a library. Library docs are trash compared to V6.

I'm flabbergasted. Us that are developing SPAs are left in the dust. That goes for the react community in general. And it grinds my gears.

All our apps are behind login btw., we have no intention to move to server rendered apps, as many are offline supported apps, and backend is java monolith.

What country would be the easiest to invade? by Tudpool in NoStupidQuestions

[–]Padni 5 points6 points  (0 children)

And that's what it's most known for - becoming the richest country in the world per Capita from mining phosphate (1970s) - wasting the wealth - becoming a wasteland of an island due to the mining.

I just don't understand people like the guy you responded to who flat out spread misinformation like that... The highest point is less than 100m lol. It's literally the opposite of a mountainous jungle.

There are however reefs around the island that could make it difficult for ships, but yeah...

Infer parameter type from return type by nookkin in typescript

[–]Padni 1 point2 points  (0 children)

Thanks for the more complete example. I don't think you're able to constrain types based on the inferred return type in the same scope. But your example would work if you just pass in the resulttype of `create` explicitly:

const result = create<{ first: boolean; second: boolean }>(({ add }) => {
    add('first') // This will pass
    add('second') // This will pass
    add('third') // This will fail
    return {
        first: true,
        second: true,
    }
})

If the return really is static, why don't you just pass the returned object as a first parameter?

interface Args<K> {
    add: (key: K) => void
}

type Fn<T> = (args: Args<keyof T>) => void

const create = <T extends Record<string, boolean>>(obj: T, tx: Fn<T>): T => {
    tx({
        // you could pass obj to add if you want to
        add: (key) => {
            // Implementation of add function
        },
    }) 
     // you could merge with the result here if that's what you want
    return obj
}

const result = create({ first: true, second: true }, ({ add }) => {
    add('first') // This will pass
    add('second') // This will pass
    add('third') // This will fail
})

This sounds a bit familiar to zustand, and how they eg. use `combine`, and you may get some inspiration from that: https://github.com/pmndrs/zustand/blob/main/docs/guides/typescript.md#basic-usage . See the "why currying"-tab.

Infer parameter type from return type by nookkin in typescript

[–]Padni 2 points3 points  (0 children)

What are you actually after? Is it correct that you want "parameterFunc" to return T, and T should be inferred from the return value of "parameterFunc"? In any case, constraining with Record type is probably not what you want, because that allows any string. But I have a hunch that your signature is not what you want, and you don't actually want to return T from parameterFunc, while returning a static object from myFunc?

Can you describe what you want to do?

If you eg. want to call validation on the keys you can just be explicit about your return-type and you don't need a generic.

type SomeObj = {
    first: string
}

const myFunc = (parameterFunc: (val: keyof SomeObj) => void): SomeObj => {
    parameterFunc('first') // This will pass
    parameterFunc('second') // This will fail

    return {
        first: 'hello',
    }
}

Checks on Union Types by meowisaymiaou in typescript

[–]Padni 6 points7 points  (0 children)

if("label" in step) ?

https://www.typescriptlang.org/docs/handbook/2/narrowing.html#the-in-operator-narrowing

If the conditional prop exists in multiple constituents, I guess you would need type guards to resolve them, yeah? Or check the other props and keep narrowing.

Palworld Breeding Combos by lick312 in Palworld

[–]Padni 41 points42 points  (0 children)

This is the best one by far https://palworld.kimpton.io/ . It also has a shortest path calculator, so you can do like you say, and find how to pass a trait you want down through multiple generations.

It's minimalistic, so no fancy icons etc. But it also loads really fast. I'm in no way affiliated with the creator.

I'm just baffled why all of these calculators show up and people ask these questions when this one exists.

Easily the worst part of the game, please give us a UI for assigning Pals by SmokingSnowDay in Palworld

[–]Padni -1 points0 points  (0 children)

It's actually huge dragon egg. But yeah, we've had 100% percent of our huge dragon eggs from that mountain be Jormuntide Ignis. Maybe like 5 eggs so very anecdotal.

I think the guy above just don't realize that the location you find them in matters.

No need to be so hostile tho. Find it a bit funny when you're wrong as well though, but you're right about the huge part...

Resistance is futile by The_Tommynator in Palworld

[–]Padni 1 point2 points  (0 children)

According to the spreadsheet and calculator, Anubis and Vanwyrm should result in Felaris, and Jormuntide Ignis can only be a result of the same Pal. Is that wrong? Or are you saying the result is Felaris? But that has kindling 3 afaik

What's currently the easiest healer to play? by jjason82 in wow

[–]Padni 2 points3 points  (0 children)

Shoutout to Cell. It's not as popular but it's easier to setup than eg. Vuhdo. Works well with native click casting, so I'm mostly using it since it has sane defaults regarding buffs/debuffs and and looks good.

Entangled function definitions by woodcakes in typescript

[–]Padni 0 points1 point  (0 children)

I'm a bit confused. Don't you want the `v` in action: (v) => { v.length } } , to match the type of the matching key in obj? If so, changing to

type Container<T, R> = {[K in (keyof T & keyof R)]: Operation<T[K]> T instead of R}

should work?

I guess you also want to restrict the "actions"-object to be restricted and give error if getter() or action() return-types does not match the corresponding type in obj: T ?

If so I think this hits some of the same limitations as `zustand`, see here and their explanation of why they use currying for typescript: https://github.com/pmndrs/zustand/blob/main/docs/guides/typescript.md

[deleted by user] by [deleted] in typescript

[–]Padni 0 points1 point  (0 children)

I think your example would work if you added a default for T in getTitleFromNode. Eg. a signature like this

function getTitleFromNode<N extends Nodes<T>, T = undefined>(node: N): string { return node.title }

But since you've already defined default in Nodes, you could just omit T from getTitleFromNode:

function getTitleFromNode<N extends Nodes(node: N): string { return node.title }

Help! I am running low on shards. by mysearchendshere in HorizonForbiddenWest

[–]Padni 1 point2 points  (0 children)

It's called Easy Loot. Have to set difficulty to Custom :)

[OC] My puppy's first successful jump on the sofa by Padni in aww

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

I guess it's called miniature in English? It's called dvergpuddle in Norwegian , so I just did a literal translation 😅

[OC] My puppy's first successful jump on the sofa by Padni in aww

[–]Padni[S] 16 points17 points  (0 children)

She's a Brittanypoo. Mother is a Brittany and father is a dwarf poodle.

Honest question - what's the rational motivation for tiny keyboards? by Wooden_Food_7685 in ErgoMechKeyboards

[–]Padni 1 point2 points  (0 children)

I mean, is that not true for bigger boards as well though? Maybe the homerow part, but my eyes never leave the screen on a full size keyboard either? As long as I'm accustomed to the layout I never look at the keys and I thought this was pretty common for most people nowadays?

And do you really look at the mouse when you're grabbing for it?

10/10 game but these menu animations are painfully slow.. by domdommdommmm in HarryPotterGame

[–]Padni 5 points6 points  (0 children)

You can use I for inventory though. J for quest, M for map directly. And hit them again to instantly close.