TypeScript · Senior · Question 58 of 75

What does rewriteRelativeImportExtensions (TS 5.7) enable?

import { util } from './util.ts'; // emitted as './util.js'

Explanation

It pairs with Node's type stripping: the same source runs directly and also compiles to correct JS imports.

Further reading

Problem with a question

TypeScript · Senior · question 58

Test yourself

Take the TypeScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz