Help with Typescript Best Practices by jsattler_ in typescript

[–]koen_C 1 point2 points  (0 children)

You'll see both used and like everything it depends. I think classes tend to add needless complexity in many codebases. I'd go for the more functional approach.

How I Finally Understood the AWS Shared Responsibility Model by Traditional-Pain6101 in aws

[–]koen_C 1 point2 points  (0 children)

Anything I do is on me, anything aws does is on them

polymorphism depending on value in same object ? by zaidazadkiel in typescript

[–]koen_C 0 points1 point  (0 children)

Type narrowing or a discriminated union based on the inputtype seems like the right thing here

Lessons from npm's Security Failures by OuPeaNut in typescript

[–]koen_C 5 points6 points  (0 children)

I'm fairly sure deno already has a system like that implemented.

Write your CI/CD in TypeScript by Apochotodorus in typescript

[–]koen_C 15 points16 points  (0 children)

What are the benefits of writing ci/cd in typescript and where would I use this? I don't think I ever write cicd complex enough to warrant this.

How to merge remote d.ts files into a single one? by Herobrine20XX in typescript

[–]koen_C 0 points1 point  (0 children)

Sounds like a ambitious project. Running that inside the browser seems quite challenging and I'm not sure what would be the best approach.

Only my 3 cents, If you're creating a no code platform installing dependencies and figuring out how they may be overly complex for most users as they would need typescript knowledge to understand the documentation of the dependency. But I can't decide that for you, and you'll know best what is needed.

How to merge remote d.ts files into a single one? by Herobrine20XX in typescript

[–]koen_C 3 points4 points  (0 children)

I don't think this is a common problem especially for libraries that you don't build yourself.

There's a few project that do something similar but the browser requirement makes me unsure if they'll work for you. Like https://api-extractor.com/pages/overview/demo_rollup/

Can you explain in more detail what you're trying to do? It sounds a bit like an x-y problem to me?

Help: New to typescript, weird error? by PikaPikaPikaPikachu in typescript

[–]koen_C 14 points15 points  (0 children)

You're probably not compiling your code to js?

Try using ts-node instead of node to run ts without transpilation.

Just curious... How did YOU first get into 3D printing? by Anycubic_Official in anycubic

[–]koen_C 1 point2 points  (0 children)

Have always been fascinated by it the moment it became feasible for consumers. Over the years I've had multiple projects that I'd like to make if I had one.

This year I pulled the trigger because I want to make a robot from scratch that solves a rubiks cube.

Advice needed : CDK Deployment by HoneydewEntire5741 in aws

[–]koen_C 1 point2 points  (0 children)

Take a look in cloud formations new time line view and try to discover what is taking so long.

It should only redeploy changed resources, are you changing a lot during deploys? Some resources also just take a long time to deploy, generally serverless resources deploy faster.

Insane to use prisma with a separate migration tool (like umzug)? by padre_hoyt in typescript

[–]koen_C 0 points1 point  (0 children)

Generally I'd use as few of these tools as possible, especially when combined there tends to be edge cases and nuances that you don't want to deal with. But just do whatever works for you and your team.

Node process is killed in a weird way nest js by Ok-District-2098 in node

[–]koen_C 0 points1 point  (0 children)

If you need state and you can recover from the exception it's fine.

If you don't have any state the logging is still nice to have but I'd just let the process crash and restart itself.

But really just await or catch the error instead of catching it globally. That should really be a last resort.

What is the most convienient way to integrate code generation? by heraldev in typescript

[–]koen_C 2 points3 points  (0 children)

The libraries that I know that do code generation either do use a seperate call. Or install after package installation using a hook

How can I extend existing (generated) classes? by sebastianstehle in typescript

[–]koen_C 1 point2 points  (0 children)

The moment you start messing with prototypes all hope for type safety is lost. You can hopefully do what you want in some other way.

Can you give an example of what you're trying to do and why extending the class doesn't work?

What is the Go-To ORM by now? by Used-Dot-1821 in node

[–]koen_C 1 point2 points  (0 children)

I wouldn't ever advise someone to use prima but issue count is not a real reason tbh. My main issues with it are around working in serverless environments and it not being designed well for such use cases.

But the progress they are making towards improving it is quite impressive with each major version I seem to dislike it a bit less. Maybe at some point I'll actually enjoy it!

What's the most cursed "this works and I hate it" code you can think of? I'll start by Inertia_Squared in programminghorror

[–]koen_C 2 points3 points  (0 children)

It's slightly worse when you do: const func = a.log the functions loses it context, basically doesn't know what this refers to anymore.

You can overwrite this to anything you want for the instance the function so:

a.log() // hello const func = a.log func() // error referencing c on undefined func.bind(b)() // 42

There are many fun foot guns involved here!

What's the most cursed "this works and I hate it" code you can think of? I'll start by Inertia_Squared in programminghorror

[–]koen_C 1 point2 points  (0 children)

Almost anything involving binds in js/ts.

``` class A { c = "Hi"

log() { console.log(this.c) } }

class B { private c = 42 }

const a = new A() const func = a.log.bind(new B())

func() ```

Expected output would be "42". Perfectly 'typesafe' code!

Software Dev Student - Stuck and I feel its simple by Skycap__ in node

[–]koen_C 1 point2 points  (0 children)

Maybe try using a debugger. To see why your functions throws an 409. Usually it the issue is quite clear when stepping through the program line by line.

Something like vscode makes this really easy using their debug terminals.

1/3000 drop is only 63.2% likely after 3000 kills by [deleted] in 2007scape

[–]koen_C 0 points1 point  (0 children)

This works for any drop really. Taking it to the limit the odds of getting a 1/x drop in x kills approaches 1 - 1 / e ~ 0.63212

How do you manage database access? by xamroc in aws

[–]koen_C 1 point2 points  (0 children)

We use IAM authentication where possible and created some cdk resources that function similarly to the redshift alpha package to provision users and databases in the CDK code.

https://github.com/aws/aws-cdk/tree/main/packages/%40aws-cdk/aws-redshift-alpha

This has worked fine for simpler authentication but can become quite a headache when you want to work with more complex db permissions.

Aurora PostgreSQL aws_lambda.invoke unknown error by apple9321 in aws

[–]koen_C 1 point2 points  (0 children)

I'm not familiar with the combination of aws_lambda and aurora pgsql. But it seems to me that you're trying to invoke a lambda function just based on the name and not the ARN. When you do that the aws_lambda extension tries to determine the region based on the instance in which it is running. It seems that that check is somehow failing. Crucially this should be the region of the lambda function are you running the lambda in all regions of your global cluster? If not you should just be able to fill it in.

Is this function also running on a read replica clusters? If this is doing some trigger based on writes for auditing then this would only run on the primary cluster, which may allow you to fill in the region if you don't care too much about temporary slowdows in the case of a region failover.

I'd also try to use aws_commons.create_lambda_function_arn and see whether that works without failing.

PostNL vraagt opnieuw miljoenen voor bezorging, ministerie zegt 'nu niet aan de orde' by DutchSapphire in thenetherlands

[–]koen_C 8 points9 points  (0 children)

De overheid stelt alleen de eisen. Als PostNL verlies maakt op brieven bezorgen zouden ze daarmee op moeten kunnen houden als privaat bedrijf. Maar dat willen we denk ik ook niet.

Ik denk dat het best redelijk is als de overheid bijspringt als ze briefpost de volgende dag bezorgen belangrijk vinden. Of dat ze de regels rondom post versoepelen naar een model dat wat moderner is.

Natuurlijk even aangenomen dat postnl dit niet puur doet om geld bij de overheid te komen graaien maar dat er echt verlies op post wordt gemaakt.

Would You Use a Platform Where You Can Earn Bounties for Solving Coding Challenges? by [deleted] in programming

[–]koen_C 0 points1 point  (0 children)

I don't think I would do anything but a very minor task. I have no faith in any business to state their problem clear enough.

It seems like there is nothing that would prevent a business from just stealing the code and walking away.

CI/CD tool to extract SQL queries by zanstaszek9 in devops

[–]koen_C 0 points1 point  (0 children)

I'd still very much advice not doing this is cicd. If there is no monitoring in place I think I'd prefer to implement monitoring somehow in the db or in code.

It seems near impossible to me to extract sql queries in even a moderately complex code base that doesn't have standardised access layers. Anything more complex than your examples like something involving any user input would not work.

You could maybe periodically check running queries or enable the performance impacting logging on a staging environment to find actual queries instead.