AI/ML

TypeScript inventor Anders Hejlsberg: AI is 'a big regurgitator of stuff someone has done'

Published

Microsoft technical fellow Anders Hejlsberg, inventor of both C# and TypeScript, said that existing languages are the ones best optimized for AI coding since they have the largest available training set, and AI is a “big regurgitator of stuff someone has done, with some extrapolation on top.”

He was interviewed by GitHub research advisor Eirini Kalliamvakou, and discussed his own team’s use of AI as well as reflecting on the past and speculating on the future of TypeScript.

The big coming change in TypeScript is the use of a native compiler, part of TypeScript 7.0 which is currently in preview. The port to native code from the original compiler, written in TypeScript and executed by the V8 JavaScript engine, was necessary for performance reasons, Hejlsberg said. “We quickly realized we could get 10x, half of it from being native code, and the other half from being able to take advantage of shared memory concurrency.”

The team decided to port the code, rather than writing a new compiler from scratch, because “we have a pretty huge and very complex type checker that has a whole bunch of behaviors that are not captured anywhere but in the exact semantic behavior of that code.”

The consequence is that anything other than a function-by-function port would have different output, introducing a “long tail of issues” for those migrating. Therefore the new compiler is designed to be the same as the old one, complete with quirks.

The choice of programming language for the native compiler proved controversial. The requirement for a port ruled out the use of Rust, Hejlsberg said, because Rust lacks the cyclic data structures and automatic garbage collection the port required. “We experimented with C#. We ended up choosing Go … because it is quite similar to JavaScript,” Hejlsberg said.

The decision went down badly with the C# community, who asked why did Hejlsberg not choose the language he himself designed, and thereby boost its usage? Although not addressing the question directly, Hejlsberg said “a lot of people felt like, you should have gone with a different programming language,” but “I firmly believe we picked the right tool for the job. I think it’s proven itself out over the past year.”

On the matter of AI, Hejlsberg said the team initially attempted to use AI for the port from TypeScript to Go. “That went not so great … we want a very deterministic outcome here. We want to port half a million lines of code and know that they do exactly what the old lines of code did. If you ask AI to translate them, it might hallucinate a little bit here and there, and now you’ve got to go carefully examine every line of code.”

These remarks echo those of developers complaining about Microsoft deprecating a .NET upgrade assistant in Visual Studio, which was deterministic, in favor of one based on Copilot which was not.

Hejlsberg said it might be better to “ask AI to generate a program that helps you do the port, because then when you run that program, you get a deterministic outcome.”

That said, he recognizes the value of AI and said the TypeScript language service, which checks code syntax and suggests fixes, is getting “dramatically adapted to this new universe … AI is gonna do a way better job here.”

He also said the team successfully uses AI for another part of the porting project, which is migrating new pull requests in the old code base, – that happened after the initial port – to the Go code. “We’ve actually been using AI fairly successfully to do that.”

Regarding the future of TypeScript, Hejlsberg said it will “evolve through the standardization process of JavaScript and then through us adding whatever type system features are necessary on top of that.”

TypeScript is a superset of JavaScript, and has also influenced the JavaScript standard as it progresses. The implication is not to expect radical changes in the TypeScript language itself.

The bigger changes, said Hejlsberg, will be in the tooling. “I thought IDEs were like the bee’s knees … but there’s this whole switch that has happened in AI,” he said. AI is no longer an assistant in the IDE but rather, “you’re supervising what it’s doing, and it doesn’t necessarily need an IDE in the same way,” he said. “It still needs the services, and that’s why all of this MCP stuff is becoming interesting, and connecting language services to MCP, and giving AI the ability to ask semantic questions or refactoring questions.”

AI will need “the equivalent of what you would do in an IDE, but do it the LLM (large language model) way or the agent way. That’s going to change development tools dramatically.”

The full interview is worth watching, including the story of how the idea for TypeScript originated from the Outlook Web team, who were using a tool called Script# to write in C# and compile it to JavaScript for running in the browser. Hejlsberg took that idea, but rather than using C# decided to create a typed superset of JavaScript. “By extending JavaScript, we were saying, we’re not going to create a whole new language here … no, we’re just going to fix what’s broken about it.”

TypeScript is now established among the popular programming languages, though the fact that Microsoft has ported the compiler away from the language is in effect an acknowledgement of its performance limitations. Redmonk analyst Stephen O’Grady asked last year whether the “fact that Microsoft felt [the compiler] needed to be reimplemented in the first place could throw shade on the language.”