Discover and read the best of Twitter Threads about #typescript

Most recents (5)

While last #TypeScriptTuesday we looked at #TypeScript Generics Basics, today we continue where we left off, by taking a closer look at type argument inference, pitfalls and workarounds. We will take a look at a simplified version of #redux-toolkit's `createAction` function.
🧵👇 interface PayloadAction<P, T = string> {<br />
  type: T;<br />
  payload: P;<br />
}<br />
<br />
type ActionCreator<P, T> = (payload: P) => PayloadAction<P, T>;<br />
<br />
function createAction<P, T = string>(type: T): ActionCreator<P, T> {<br />
  return (payload: P) => ({<br />
    type,<br />
    payload<br />
  });<br />
Here, we call this function three ways:

1. With explicit type arguments. Everything is fine.
2. With inferred type arguments. P cannot be inferred, because it does not relate to any method argument.
3. With one explicit type argument. But why is the second argument not inferred? function createAction<P, T = string>(type: T): ActionCreator<P, T> {<br />
  /* ... */<br />
}<br />
<br />
const type =
// ActionCreator
const incrementAction = createAction(type);

// ActionCreator
const actionCreator2 = createAction(type);

// ActionCreator
const actionCreator3 = createAction(type);" src="/images/1px.png" data-src="">
This is because #TypeScript cannot mix explicit and inferred type arguments.
There is a PR for that at…, but there is still discussion on what syntax to use.
Let's just assume that this is impossible and try to work around it.
Read 6 tweets
I *LOVE* what the @awscloud #EventBridge team is doing for #serverless, and this new Schema Registry is an amazing next step! Here are my initial thoughts on this...…
EventBridge _should_ become the glue that ties together all your cloud services (eventually w/ two-way message bindings). This means that the number of event types (don't forget SaaS partners) is going to increase exponentially...
Security best-practices will evolve to prefer multiple event buses so you'll have fine-grained access control across SaaS vendors, AWS service events, and custom messaging. The cognitive load to understand all those nuances, limitations, and event structures is overwhelming...
Read 9 tweets
such a treat to see this in person
@dataandme gotta tell you, @Elijah_Meeks sounds _sooo_ good amidst all this acoustic foam 🎤
such eats, so healthy.
Read 51 tweets
Little story about biases in technologies. Before I joined @wavesplatform, I thought that #scala is a very complex, non-obvious and little supported programming language, there is too much magic and you can draw ascii emojis with special characters in your code.
I heard and read a lot about troubles with #scala, and it looked reasonable. But as I dived in it (thanks to @wavesplatform deva and scala courses by @BinaryDistrict), I began to realize that these "troubles" are only my (and people in my bubble) biases.
In fact, scala is like any other popular languages with its own advantages and disadvantages. Same like #Java, #Javascript, #TypeScript, #Python in which I wrote before.
Read 7 tweets
#Java's death will be due to SEO mess, lack of centralized docs, outdated tutorials & no one-stop-shop place to find it all


This site was supposed to be the answer, but it only raises even more questions. The information here is mostly marketing-related, and has pointers to other online locations, outside

Potential: very high.
Reality: waste of TLD.

The Java source, no doubt. Yet, devs who want to just learn/code Java apps will only find binaries downloads. Nothing else serves the average Java software developer. "Developer's Guide" is for contributors.

Potential: high.
Reality: confusion.
Read 8 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!