This question might be dum. I am a beginner for typescript. In file A, I want to call a function defined in file B. How do I do this?
3 Answers
Use the appropriate import and export statements.
Given the following file layout:
├── a.ts
└── b.ts
a.ts
import {myFn} from 'b';
myFn();
b.ts
export function myFn() {
/* ... */
}
2 Comments
redevill
... as an extension to the question, based on a configuration file e.g. targetFn='myFn', how would you call targenFn() and have it invoke the named code?
redevill
found an answer here: stackoverflow.com/questions/62446219/…