TS2459
Module './myFunction' declares 'myFunction' locally, but it is not exported.
Broken Code ❌
function myFunction(a: number, b: number): number {
return a + b;
}
export {};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:
export function myFunction(a: number, b: number): number {
return a + b;
}import { myFunction } from './myFunction';
myFunction(1, 2);