TS2613

Module 'add' has no default export. Did you mean to use 'import { add } from "add"' instead?

Broken Code ❌

add.ts
export function add(a: number, b: number): number {
  return a + b;
}
main.ts
import add from './add';
 
console.log(add(1000, 337));

Fixed Code ✔️

To fix the bug we have to convert our named export into a default export:

add.ts
export default function add(a: number, b: number): number {
  return a + b;
}