Twitter | Search | |
bterlson.d.ts
JavaScript, TypeScript, Azure, ECMA TC39 co-chair nee ECMA262 editor-in-chief. Microsoft employee but my opinions are my own.
3,438
Tweets
577
Following
7,051
Followers
Tweets
bterlson.d.ts Jun 20
Replying to @bterlson
It is actually possible to solve #2 without overloads (as of 3.0) by using a rest parameter typed as a union of tuple types: (...args: [number, number] | [string, string]) => {} Downside is you can't name your parameters and users get super complex argument errors.
Reply Retweet Like
bterlson.d.ts Jun 20
Replying to @bterlson
To illustrate point #2, consider a function which takes two string arguments or two number arguments, but not a mix. The implementation signature `(a: number | string, b: number | string)` allows invalid arguments like (number, string) while overloads don't.
Reply Retweet Like
bterlson.d.ts Jun 20
Replying to @bterlson
There are at least two benefits to overloads: 1. You can document each signature separately, so users see documentation tailored to that usage. 2. Overloads declare sets of related parameters and so are actually more expressive.
Reply Retweet Like
bterlson.d.ts Jun 20
People often wonder: what use are TypeScript overloads when we have unions? Especially since you often have to write the "union form" anyway as your implementation signature. Why not just roll with that?
Reply Retweet Like
bterlson.d.ts Jun 19
Replying to @sebmck @drosenwasser
TS should always be a dev dependency IMO. I've argued repeatedly for scrubbing the global install instructions everywhere we have it but it's a work in progress. /cc
Reply Retweet Like
bterlson.d.ts Jun 19
Replying to @sebmck @danbucholtz
You can also use the `import =` form, i.e. `import fs = require('fs')`. This form maps directly to CJS semantics and is preferred, especially if you're a library. Unfortunately, you can't target ES6 when you use this.
Reply Retweet Like
bterlson.d.ts Jun 14
Replying to @IllusionMH
I think so, then the question reduces to, how often do you update VSCode?
Reply Retweet Like
bterlson.d.ts Jun 14
On average, how far behind TypeScript's latest stable version are you?
Reply Retweet Like
bterlson.d.ts Jun 13
TIL when calling an overloaded function, TypeScript will often only report errors based on the last signature. Ref: . Pro debugging tip: delete overloads until you get a meaningful error. Pro UX tip: if an overload is the most commonly used, put it last!
Reply Retweet Like
bterlson.d.ts Jun 11
Replying to @orta @typescript
Welcome to the team!!
Reply Retweet Like
bterlson.d.ts Jun 7
Replying to @southpolesteve
I guess they were unsure if you're good at computers generally or just really good at one specific computer?
Reply Retweet Like
bterlson.d.ts Jun 7
I'm all about any and all efforts to counter the damage MS-PAC does to our society.
Reply Retweet Like
bterlson.d.ts Jun 6
+1 for :never-have-i-ever-been-visible. Value is `drink` if it has been visible, and empty otherwise.
Reply Retweet Like
bterlson.d.ts Jun 6
Replying to @alephnaught2tog
Ah, a classic mistake! No doubt they are now busily getting involved in a land war in Asia.
Reply Retweet Like
bterlson.d.ts retweeted
Nathan Shively-Sanders Jun 5
More on estimating how much of npm is typed: suggested a simpler method: checking whether dependencies of sampled packages are typed. There's no fancy math here; just the percent of dependencies in random packages that have types. Here's the last 4 years:
Reply Retweet Like
bterlson.d.ts Jun 4
Working with the architects on this team is so fun. The debates are really strange sometimes. A: Why not do X? B: You literally wrote the book on this and it says never to do X. A: What edition? 2nd edition? 3rd edition won't say that. B: Well let us know when you publish!
Reply Retweet Like
bterlson.d.ts Jun 4
If you've used Azure, we're collecting opinions about the Azure SDK and you can tell us what you think here: . Should take no more than a couple minutes!
Reply Retweet Like
bterlson.d.ts retweeted
yulia May 29
I am running an experiment to see if we can use evidence based methods to identify how a proposal fits into JavaScript. I need your help! Please share
Reply Retweet Like
bterlson.d.ts May 24
Just make sure to hook up your fax machine to a phone line with ITU T.38 support.
Reply Retweet Like
bterlson.d.ts May 21
Replying to @_shu @MylesBorins
Good pens are what I miss most about writing.
Reply Retweet Like