Working on TypeScript at Microsoft. I appear when someone says “module resolution” three times in the dark. He/him

Joined January 2013
228 Photos and videos
Andrew Branch retweeted
11 Mar 2025
The new TypeScript is *really* fast
9
13
236
30,232
Andrew Branch retweeted
11 Mar 2025
Today we're thrilled to announce our effort to port the TypeScript compiler and language service to native code, gaining a 10x speed boost in build times and editor responsiveness! devblogs.microsoft.com/types…
159
1,344
6,749
1,226,434
Andrew Branch retweeted
Node.js v23.6.0 is out! 🥳🎉 This release enables the flag --experimental-strip-types by default. Node.js will execute TypeScript files without additional configuration! ⚠️ This feature is experimental, has limitations and is subject to change. nodejs.org/en/blog/release/v…
18
165
860
90,083
23 Aug 2024
Editing with @britto_gab's work on region-prioritized diagnostics has been so great: > in our testing on TypeScript’s own checker.ts, a full semantic diagnostics response took 3330ms. In contrast, the response for the first region-based diagnostics response took 143ms! 👏
23 Aug 2024
The release candidate for TypeScript 5.6 is now available for testing! Give it a try today for more new checks, ways to speed-up your builds, new JS features, and more! devblogs.microsoft.com/types…
1
1
21
3,175
Andrew Branch retweeted
Dual publishing ESM and CJS is hard. Getting the types incorrect in your package.json is disappointingly easy. If you want something to help you with both, then maybe tsup and Are the Types Wrong can help. Thanks to @atcb for his assistance with this ❤️🌻 johnnyreilly.com/dual-publis…
1
6
41
4,856
27 May 2024
Update for 2024: do whatever you want 🙃
Do not use `import type` unless you need to.
Community note
This comment was written before TypeScript shipped the `verbatimModuleSyntax` configuration option, which improves upon the behavior of `import type`: typescriptlang.org/tsconfig/#verb… Several experts on TypeScript, including the original author of this comment, no longer stand by this guidance: x.com/atcb/status/17… x.com/mattpocockuk/s…
10
49
506
155,051
27 May 2024
Early on, I was reluctant to make type-only imports easier to adopt as a wholesale stylistic choice because I thought it would add to the confusion. Eventually, you all changed my mind, and I added a VS Code preference to make auto-imports use them as much as possible.
3
4
39
4,920
27 May 2024
I personally tend to use type-only imports via auto-imports (with `verbatimModuleSyntax`) in new projects, but maybe I just like using stuff I made 😄Do what makes you happy, and go deeper into understanding how your tools work if you can. It might be more complex than you think.
1
48
4,059
28 Apr 2024
This brings up some great questions about a confusing topic, but the advice Brandon found in his research is bad advice! My full explanation via blog post: blog.andrewbran.ch/default-e…
Apparently, I've been doing NPM package exports in TSC wrong my entire life. I usually use the ESM `export default _` if I'm doing a default export. This generated CJS output appears to break when require'd in a CJS environment, requiring a property ref of `packageName.default` instead of simply `packageName`. After much research, it appears the generally recommended fix is to use `module.exports =` in your main ESM file that TSC processes. WHAT. That's not a typo. You can use any ESM imports or syntax you need in that file, but for the CJS output file to use `module.exports`, the ESM needs to use it too. Why can't TSC convert `export default` to `module.exports =` for the CJS target? Doing this also appears to mess with the export types, so the `.d.ts` files sometimes get emptied out unless you export your exports with both ESM and CJS syntax together, even like this: export default myFunction; module.exports = myFunction; Has anyone else run into this? Twilight Zone moment with a simple fix? 🤞🏼
3
6
45
16,848
Andrew Branch retweeted
25 Apr 2024
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! devblogs.microsoft.com/types…
9
185
867
129,311
Andrew Branch retweeted
19 Apr 2024
TypeScript excitement 😉 Congrats to @TitianCernicova @TechAtBloomberg on landing --isolatedDeclarations in upstream TypeScript 🎉 It's the start of a journey to faster type-checking at scale 🔥 An epic collab between folk in TS, Bloomberg & Google 👍 github.com/microsoft/TypeScr…
9
40
272
46,109
Andrew Branch retweeted
18 Mar 2024
Node excitement 😉 Congrats to @JoyeeCheung at @igalia on landing **experimental** support for require(ESM) in Node 🎉 The intent is to allow more CommonJS packages to migrate to ESM without breaking compatibility. This should help eliminate the [ERR_REQUIRE_ESM] error 👍
Landed experimental support for synchronous require(esm) to load ES modules without top-level await 🥳 github.com/nodejs/node/pull/…
3
23
130
15,319
Andrew Branch retweeted
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. ts-ast-viewer.com/#code/GYVw…
2
7
76
9,518
30 Jan 2024
Touched some rock this weekend 😎
11
883
19 Jan 2024
`--module preserve` allows you to write imports and requires in the same file. When combined with `--moduleResolution bundler`, these get resolved with accurate conditional package.json "exports" lookups. (TS is shown here, but `const pkg2 = require("pkg")` works in JS files.)
1
1
17
1,167
19 Jan 2024
[Video description: VS Code screen capture with code: import pkg1 from "pkg"; import pkg2 = require("pkg"); console.log({ import: pkg1, require: pkg2, }); Terminal: > bun index.ts { import: "import.mjs", require: "require.js" } TS hovers show the same thing.]
1
5
838