I currently have the following file structure:
---utilities
-----index.ts
-----tools.ts
allfunctions.ts
Within the tools.ts
file, I have defined several functions that I export using export const
. One of them is the helloWorld
function:
export const helloWorld = () => console.log('Hello World');
In the utilities/index.ts
file, I've imported the tools file and exported it like this:
import * as toolsFunction from './tools';
export { toolsFunction }
Now in my allfunctions.ts
file, I am trying to use the helloWorld
function in the following way:
import { taskFunctions as Utility } from './utilities/';
taskFunctions.helloWorld();
Before compiling the code, everything works fine. However, when I try to compile, I encounter the following error message:
TypeError: Cannot read property 'helloWorld' of undefined
I'm not sure what mistake I might be making here. Could you provide some insight?