Dan Vanderkam Profile
Dan Vanderkam

@danvdk

Followers
3,256
Following
126
Media
94
Statuses
1,327

Independent software developer, formerly @sidewalklabs and Google. Author of Effective TypeScript, now in its 2nd edition (May 2024):

Hudson Valley, NY
Joined February 2009
Don't wanna be here? Send us removal request.
Explore trending content on Musk Viewer
Pinned Tweet
@danvdk
Dan Vanderkam
6 months
It's here! 🎉 The 2nd edition of Effective TypeScript is now available in all formats. The bird on the cover is the same, but the content is throughly revised and expanded to reflect how TS is used in 2024. Get your copy today! @OReillyMedia
Tweet media one
8
25
179
@danvdk
Dan Vanderkam
4 years
Another use of @TypeScript 4.1's template literal types: extracting the URL parameters from an express route. Pretty amazing you can do this in the type system!
Tweet media one
24
170
646
@danvdk
Dan Vanderkam
8 months
Put up my second #TypeScript PR! It allows the type checker to infer "type predicates" when a function returns a boolean that's tied to a refinement on one of its parameters. I have no idea if it'll be accepted, but I sure learned a lot implementing it!
Tweet media one
8
22
243
@danvdk
Dan Vanderkam
2 years
New Effective #TypeScript blog post: a command to visualize what TypeScript is compiling using a treemap (the results may surprise you!). Or: how I found out I was compiling 80+ MB of types for Google APIs that I wasn't using.
Tweet media one
1
28
171
@danvdk
Dan Vanderkam
9 years
I’m excited to launch http://t.co/NFkT7kZRU1! Browse 40,000 mapped historic photos of #NYC from the @NYPL http://t.co/eH0R9AsbWb
Tweet media one
17
143
161
@danvdk
Dan Vanderkam
5 years
I wrote a book! Happy to announce that _Effective TypeScript: 62 Specific Ways to Improve Your TypeScript_ is now available for purchase. I learned a lot writing it and I hope you'll have the same experience reading it.
Tweet media one
10
12
107
@danvdk
Dan Vanderkam
7 months
After using TypeScript for 8+ years, I had a mind-blowing realization: type inference is implemented completely backwards from how I think about it! Read on for the "missing manual" on Flow Nodes and TS type inference internals.
1
8
83
@danvdk
Dan Vanderkam
8 months
For my PR to infer type predicates, I needed to understand TypeScript's control flow graph. So I added a graph visualization to @DavidSherret 's amazing TypeScript AST Viewer. It's live now and very fun to play with! Edges go backwards in execution order.
Tweet media one
2
7
77
@danvdk
Dan Vanderkam
7 months
One of my goals this year was to become a TypeScript contributor. Over the past three months, I did just that! This post tells the story of how Type Predicate Inference came about and what I learned along the way.
3
8
59
@danvdk
Dan Vanderkam
3 years
Which of these would you rather show your users when they call a function in @TypeScript ? As a library writer, you do have some control! Read more about the strange world of type display in the latest Effective TypeScript blog post:
Tweet media one
1
4
40
@danvdk
Dan Vanderkam
1 year
A quibble with @mattpocockuk 's excellent writeup : I'd call the "implicit index signature" for type a bug and a good reason to use interface instead because it can lead to unsoundness:
1
7
38
@danvdk
Dan Vanderkam
6 months
Very excited to see inferred type predicates headline TS 5.5! I hope everyone enjoys the bird-themed release notes 🦜
@typescript
TypeScript
6 months
Announcing TypeScript 5.5 Beta! 📣 Now with type predicate inference, more type narrowing, an @‍import tag for JSDoc, the --isolatedDeclarations flag, performance & reliability improvements, and much more!
12
197
916
0
3
33
@danvdk
Dan Vanderkam
5 years
Use @TypeScript ? Check out dtsearch, a tool search npm for just the packages that have types, whether bundled or on DefinitelyTyped. Thanks to @orta and @haroenv for all their help making this work!
1
7
30
@danvdk
Dan Vanderkam
2 years
Excited to get my copy of @LearningTSBook ! Congrats @JoshuaKGoldberg ! The cover looks great. Can you tell us more about your choice of the sun parakeet??
Tweet media one
2
2
32
@danvdk
Dan Vanderkam
4 years
I put together a small library for type-safe express routes using @typescript 4.1's new template literal types called crosswalk ("safe route", get it?). If you use Express and TypeScript, give it a try!
Tweet media one
2
10
27
@danvdk
Dan Vanderkam
8 months
Nice writeup of TypeScript's new ability to infer type predicates from @mattpocockuk . I'm 0% surprised that Matt beat me to writing a blog post about this :)
@mattpocockuk
Matt Pocock
8 months
I really can't believe they added it.
8
20
285
1
2
25
@danvdk
Dan Vanderkam
3 years
Most of my @typescript bug reports are misunderstandings on my part, but this alternative never gets old!
Tweet media one
1
1
21
@danvdk
Dan Vanderkam
8 months
@mattpocockuk You and me both, @mattpocockuk ! I learned a ton writing this PR and it’s been amazing to see the reaction to it getting merged. I guess I wasn’t the only one who’s been wanting this!
1
0
19
@danvdk
Dan Vanderkam
6 years
I just published “Testing Types: An Introduction to dtslint”
0
9
19
@danvdk
Dan Vanderkam
7 months
Excited to see that the new Flow Node Charts have at least one high-profile user. And may have even indirectly led to some TypeScript speedups! Visualizing something has a way of nudging you to make it better. @DavidSherret
@danvdk
Dan Vanderkam
8 months
For my PR to infer type predicates, I needed to understand TypeScript's control flow graph. So I added a graph visualization to @DavidSherret 's amazing TypeScript AST Viewer. It's live now and very fun to play with! Edges go backwards in execution order.
Tweet media one
2
7
77
1
0
17
@danvdk
Dan Vanderkam
4 years
The @typescript language is both coded and _designed_ in the open. You can keep up on their latest thinking through @drosenwasser 's weekly "Design Notes" issues. Here's an RSS feed for them!
1
5
15
@danvdk
Dan Vanderkam
3 years
Does anyone use @typescript twoslash as a test system? Basically I want to write the result of adding "// ^?" in code and have twoslash assert that what I wrote matches what it would show. I like that this would test how the types _display_ ala literate-ts @orta
Tweet media one
1
0
14
@danvdk
Dan Vanderkam
1 year
Four years ago, I cut one item from Effective @TypeScript during the final stages of editing. Now it finally sees the light of day as a blog post! I'm curious how widely-known this is and if it's useful beyond typing _.chain.
0
3
13
@danvdk
Dan Vanderkam
3 years
Very excited to be speaking at #TSConf tomorrow! I'll be talking about what types are, with an assist from renaissance master Michelangelo Buonarroti. Should be fun!
3
0
14
@danvdk
Dan Vanderkam
4 years
ts-mover is a small tool built using @dsherret 's ts-morph. You write a list of @typescript file moves and renames and it makes them happen. I've been doing some large-scale reorganizing recently and this has really helped!
0
3
13
@danvdk
Dan Vanderkam
10 years
Today on danvk blog: extracting text from an image using the @ocropus library http://t.co/CulGEMRx4b (with pictures!) http://t.co/4m1LJQZtBA
Tweet media one
0
11
13
@danvdk
Dan Vanderkam
10 years
Last blog post in my OCR series: Training an Ocropus OCR model. Witness the triumph! http://t.co/suu7JJnPzB http://t.co/L6LjihooCT
Tweet media one
0
11
11
@danvdk
Dan Vanderkam
1 year
👀 Searched on the @TypeScript type-challenges repo to see if anyone had filed a solution using the built-in Extract helper and… wait a minute, what? Memory works in funny ways!
Tweet media one
1
0
12
@danvdk
Dan Vanderkam
4 years
@tannerlinsley @TkDodo @lukemorales @typescript The comment from @TkDodo is exactly right, TypeScript does refinement on the types of individual symbols. Once you split them apart, it can't keep track of the relationship any more. Doing this in general would be computationally hard. It can also be hard for people.
0
1
13
@danvdk
Dan Vanderkam
8 years
I'm impressed that this works! In #TypeScript 2.1, you can pull a union of string literals tag type out of a tagged union type. #MappedTypes
Tweet media one
0
5
13
@danvdk
Dan Vanderkam
1 year
Hey @TitianCernicova @robpalmer2 was Bloomberg's "Dead Type Elimination" tool referenced in this post ever open sourced? Do you still use it? Is it too tied to Bloomberg's setup to be widely useful? I'm very curious about this topic!
1
1
13
@danvdk
Dan Vanderkam
8 months
@housecor I've thought about turning this into a typescript-eslint rule. Exceptions would be functions where the args have a canonical order (Math.pow) or the order doesn't matter (add, multiply).
1
0
13
@danvdk
Dan Vanderkam
8 months
Type guards are really having a moment! @Flowtype launched user-defined type guards today: Very similar to TypeScript's. They also have "if and only if" semantics. Unlike TypeScript's, they are checked. But evidently only in the "true" case:
Tweet media one
2
0
11
@danvdk
Dan Vanderkam
5 years
I put together a small site for Effective TypeScript: . Subscribe via RSS or follow on Twitter to get sample items and TypeScript tips & tricks!
1
4
12
@danvdk
Dan Vanderkam
4 years
literate-ts is a tool I built while writing Effective TypeScript to bring static analysis to books and blog posts. It proved invaluable but not in the ways I expected! Thanks to @haxor and @DonKnuth for the inspiration
1
3
11
@danvdk
Dan Vanderkam
3 years
@typescript This error message in the TS 4.7 beta is on point. Nice!!
Tweet media one
0
0
11
@danvdk
Dan Vanderkam
9 years
What an amazing response to http://t.co/NFkT7kZRU1. Millions of image views and improved text transcriptions on nearly 6,000 photos! @nypl
3
7
9
@danvdk
Dan Vanderkam
3 years
"strings that are actually numbers" wasn't a thing I ever expected @TypeScript 's type system to accurately model. Kudos on the TS 4.4 beta! Now there's some things in my book that I need to rewrite… :)
Tweet media one
@typescript
TypeScript
3 years
TypeScript 4.4 Beta is ready to try! We want your feedback on our new analyses, strictness flags, symbol/pattern indexers, --help menu revamp, perf improvements, and more, so read up on what's new and give it a shot!
6
164
548
3
1
11
@danvdk
Dan Vanderkam
4 years
Excited to publicly announce the project I've been working on at Sidewalk Labs! In case any of the @typescript crowd were curious why there were so many Mapbox and GeoJSON examples in _Effective TypeScript_ :)
@sidewalklabs
Sidewalk Labs
4 years
In an ideal world, developers, architects, and urban planners could explore endless options to design sustainable and affordable neighborhoods. But the traditional urban development process only produces a few options, leaving potentially better designs untapped.
3
13
74
0
0
10
@danvdk
Dan Vanderkam
3 years
My #TSConf 2021 presentation is now on YouTube!
@TypeScriptConf
TSConf
3 years
Delve into @danvdk 's #TSConf presentation - #TypeScript Types: The First 500 Years. Learn type theory with some help from Michelangelo:
Tweet media one
0
1
13
2
0
10
@danvdk
Dan Vanderkam
4 years
The @typescript 4.1 RC breaks exactly one example in Effective TypeScript, in Item 23: Create Objects All at Once. The inferred type that "comes as a surprise" now does exactly what you'd intuitively expect!
Tweet media one
2
1
10
@danvdk
Dan Vanderkam
3 years
@JoshuaKGoldberg If this works, it's going to set a very dangerous precedent!
1
0
10
@danvdk
Dan Vanderkam
4 years
Is this the simplest way to implement numeric addition in @typescript 's type system? Pretty nice how it works with unions of numbers. @JoshuaKGoldberg
Tweet media one
2
3
10
@danvdk
Dan Vanderkam
9 years
Read about this 1931 Chrysler building photo, taken from the ground AND a blimp! @nypl_labs
Tweet media one
0
13
9
@danvdk
Dan Vanderkam
3 years
Very excited to see type annotations coming to JS! “No build step” was always the Closure Compiler’s central dogma. Now we have a path to the same with @typescript . Nice work @drosenwasser and @robpalmer2 ! 🙌
1
2
9
@danvdk
Dan Vanderkam
1 year
TypeScript and SQL: Six Ways to Bridge the Divide. The video of my talk at TS Congress is up, along with a companion blog post. I have my favorite way to combine TypeScript and SQL. How do you like to do it?
Tweet media one
1
1
9
@danvdk
Dan Vanderkam
10 years
The about the odyssey that led to jss, my new JSON manipulation command line tool:
0
5
9
@danvdk
Dan Vanderkam
9 years
A few of my takeaways from #NIPS2015
0
0
7
@danvdk
Dan Vanderkam
3 years
@ddprrt nice post on React children types! small nit: {} means anything but null/undefined, not any object. (It includes number and string.) Then ReactNode adds null | undefined, so it really is anything!
2
1
9
@danvdk
Dan Vanderkam
8 months
@sebastienlorber @mattpocockuk filter(Boolean) scares me because you almost always want to be checking for null/undefined, not 0. They're only equivalent for object types. You can actually tell TS to only allow it in that situation by specializing on "this":
Tweet media one
1
0
7
@danvdk
Dan Vanderkam
3 years
Glad you noticed! :)
@johnny_reilly
John Reilly ❤️🌻
3 years
Awesome talk by @danvdk at #TSCongress - nicely placed copy of "Effective TypeScript" in the background 😅♥️
Tweet media one
0
0
16
0
0
9
@danvdk
Dan Vanderkam
6 months
@AdamRackis I see you like Effective books! There’s also Effective TypeScript, now (as of this week) in its second edition:
3
0
9
@danvdk
Dan Vanderkam
4 years
TIL @TypeScript 's mapped types work just as well on array and tuple types as they do on more typical object types:
Tweet media one
1
1
8
@danvdk
Dan Vanderkam
9 years
Nice writeup of http://t.co/NFkT7kZRU1 on The Guardian! http://t.co/GBStFmSRRC
0
8
7
@danvdk
Dan Vanderkam
10 years
Here's a roundup of the video, slides and tools from yesterday's #PyCon2015 talk on Screenshot Tests & Visual Diffs: http://t.co/HWOzTHeyej
0
1
8
@danvdk
Dan Vanderkam
3 years
Very excited to be speaking again at #tsconf !
@TypeScriptConf
TSConf
3 years
You may remember them from #TSConf 2019...it's Dan Vanderkam! Author of Effective TypeScript & Principal Software Engineer at @sidewalklabs , we can't wait to hear about the first 500 years of TypeScript Types at #TSConf 2021! Welcome back @danvdk !
Tweet media one
1
6
21
0
1
8
@danvdk
Dan Vanderkam
6 months
This has been on my list of most-desired TS features for years. I’m genuinely curious to see what breaks under —strictReadonly. In 2016 this felt too strict, but in 2024 it’s surprising we don’t have this.
@AndaristRake
Mateusz Burzyński
6 months
1
5
63
1
0
6
@danvdk
Dan Vanderkam
1 year
Great talk @TitianCernicova ! So satisfying to see those dependencies go away and your parallelism soar.
@TechAtBloomberg
Tech At Bloomberg
1 year
In his "Speeding up #TypeScript builds" presentation during @ts_congress today (11:55 AM EDT), @TitianCernicova will explore isolated declarations, a new feature of @typescript we've been working on in collaboration with @Google & @Microsoft
0
3
6
0
2
8
@danvdk
Dan Vanderkam
1 year
@AdamRackis @ThePrimeagen @t3dotgg Glad to hear you're a fan of the Effective series! This item is available free online. Here's they key quote: "Ideal TypeScript code includes type annotations for function/method signatures but not for the local variables created in their bodies."
1
1
8
@danvdk
Dan Vanderkam
8 months
Now available on a TS Playground so you can try it yourself!
0
0
8
@danvdk
Dan Vanderkam
4 years
TypeScript splits the atom! This post looks at @typescript 4.1's template literal types, why they're a particularly "TypeScripty" construct, and what I think tasteful use of them will eventually look like.
0
1
7
@danvdk
Dan Vanderkam
8 months
@mattpocockuk I’m especially happy that TS team went with the simplest, most maximal version of this change. It’s not just for arrow functions. It’s not just for contextually-typed functions. It works for all functions. No special cases. The clearest version, but also the scariest!
2
0
7
@danvdk
Dan Vanderkam
1 year
Funny enough, I got really into birding _after_ putting a bird on my book. The Oxpecker is a visual play on the cover of JavaScript: The Definitive Guide. Read the Colophon and see if you can figure it out!
@mattpocockuk
Matt Pocock
1 year
Learning TypeScript by @JoshuaKGoldberg Effective TypeScript by @danvdk
0
0
24
1
0
7
@danvdk
Dan Vanderkam
3 years
Excited to be talking Types Syntax with @orta at #TSCongress
1
3
6
@danvdk
Dan Vanderkam
3 years
Tune in tomorrow for my Twitch debut! I’m a little nervous, but mostly just excited to talk @typescript and open source with @JoshuaKGoldberg
@JoshuaKGoldberg
Josh Ghoulberg 👻
3 years
📣 My Twitch open source coding stream resumes tomorrow! @danvdk and I will go over Dan's PR adding "twoslash" support to eslint-plugin-expect-type! 🙌 * What is twoslash? * What is eslint-plugin-expect-type? Find out tomorrow!
5
1
11
0
1
6
@danvdk
Dan Vanderkam
8 years
Really enjoyed the @uglywalks through the Gowanus on Saturday! Maximum ugliness!
Tweet media one
0
1
4
@danvdk
Dan Vanderkam
7 months
@mattpocockuk The TypeScript playground is the best way to hammer this home. TypeScript on the left, JavaScript on the right.
2
0
6
@danvdk
Dan Vanderkam
1 year
Don’t Repeat Type Information in Documentation! This item from Effective @TypeScript has always been one of my favorites because it's so easy to apply its advice in code reviews. Now available as a free sample item:
1
0
6
@danvdk
Dan Vanderkam
3 years
Are @typescript project references a performance win if you use noEmit? e.g. for tsserver or ts-node or webpack. Curious to know before spending time on this. Context: @sheetalkamat
3
2
6
@danvdk
Dan Vanderkam
13 years
Really like http://t.co/amWpsgJH, the Manhattan grid extended to cover the entire world!
1
10
6
@danvdk
Dan Vanderkam
4 years
@TAbrodi @tannerlinsley If what you really want is named (not positional) generics, you can improvise something using conditional types:
0
0
6
@danvdk
Dan Vanderkam
4 years
@yawaramin @typescript In practice TypeScript would infer the string literal for you. No repetition necessary. Here's a playground showing that in action:
1
0
6
@danvdk
Dan Vanderkam
12 years
Just launched, NCAA March Madness brackets on Google: http://t.co/iHFC0ivnx4. Super-proud of my team for putting this together!
4
10
6