Menu

TypeScript 7.1 Can Now Import Almost Anything. So I Made It Import C++, C, and Rust.
📰

TypeScript 7.1 Can Now Import Almost Anything. So I Made It Import C++, C, and Rust.

DEV Community: cpp·Evgen Mykhailenko·about 15 hours ago
#qjWaN1fV
#devtocpp#devto#dev#include#types
Reading 0:00
15s threshold

I've been following the development of Content Mappers in TypeScript for quite a while.

Partly because I'm excited about what they make possible, but also because I've been working on another TypeScript extension project that relies heavily on Volar.js .

And God, that's a lot of code to maintain just to get all the language features working correctly and keep everything in sync with TypeScript.

But with TypeScript 7.1 , we finally have an official extension mechanism built directly into the compiler.

And I think this opens up some pretty interesting possibilities.

What if TypeScript could import anything?

Imagine being able to write something like this:

import { Rows , Columns } from " ./data.csv " ; import { exif } from " ./photo.jpeg " ; import { config } from " ./config.yml " ;

Enter fullscreen mode

Exit fullscreen mode

And not just import these files as strings or any , but have TypeScript actually understand their contents.

Imagine getting autocomplete for your YAML configuration, properly…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.