What is the difference between require(x) and import x in TypeScript/Node.js?
Hi everyone! I started learning TypeScript and Node.js, and I'm confused about the difference between the two ways of importing modules.\n\nIn all the old tutorials I see code like this:\n```typescript\nconst express = require('express');\nconst fs = require('fs');\n```\n\nBut in new TypeScript projects they write like this:\n```typescript\nimport express from 'express';\nimport * as fs from 'fs';\n```\n\nI tried to figure it out myself, but got even more confused. For example, I tried doing this:\n```typescript\n// Old way\nconst myModule = require('./myModule');\n// New way\nimport myModule from './myModule';\n```\n\nBoth seem to work, but sometimes require throws an error "Cannot find module", while import works. Or vice versa — import throws "Module '".../myModule"' has no default export", while require works fine.