TypeScript · Middle · Frage 61 von 75
Was behebt esModuleInterop?
import express from 'express'; // a CommonJS module- 1Default-Importe von CommonJS-Modulen so, wie Bundler es tun
- 2Import von JSON-Dateien mit vollständig typisiertem Inhalt
- 3Umwandlung der ESM-Ausgabe in CommonJS beim Build
Antwort zeigen
Richtige Antwort: Default-Importe von CommonJS-Modulen so, wie Bundler es tun
Erklärung
Ohne die Option bräuchte man import * as express from 'express', was kaputtgeht, wenn das Modul aufrufbar ist.