TS2459

Module './myFunction' declares 'myFunction' locally, but it is not exported.

Broken Code ❌

myFunction.ts
function myFunction(a: number, b: number): number {
  return a + b;
}
 
export {};
index.ts
import { myFunction } from './myFunction';
 
myFunction(1, 2);

Fixed Code ✔️

When you want to import your function in another file, you have to make sure that it is exported using the export keyword:

myFunction.ts
export function myFunction(a: number, b: number): number {
  return a + b;
}
index.ts
import { myFunction } from './myFunction';
 
myFunction(1, 2);