I'm trying to work with TypeScript in my node project, but I have some issues with that.
This is my index.ts file:
import express from 'express';
const app = express();
I'm running:
tsc --module commonsjs -d index.ts
My output is index.js:
var express_1 = require('express');
var app = express_1["default"]();
Where did this ["default"]
came from? It is making my code not to run properly:
var app = express_1["default"]();
^
TypeError: express_1.default is not a function
As far as I understand, I should have got the code without the "default" brackets and it would have worked fine - I tried removing the brackets and it worked.
What am I missing here?