Array of Functions as exported as Constants
I want to define few functions which will be treated as constants within a file and then export them in an array, but being new to typescript not sure how to do it.
For example I want how to declare Objs below. Objs will hold all the functions in an array.
interface Prop {
readonly var1: string;
readonly var2: string;
}
const Obj1 = (stage: string): Props => {
return {
var1: `a1-${stage}`,
var2: 'a2'
}
}
const Obj2 = (stage: string): Props => {
return {
var1: `b1-${stage}`,
var2: 'b2'
}
}
export const Objs (????????)
I want to use Objs in a different file like this
Objs.obj2("Test") or Objs.obj1("Test")
from Recent Questions - Stack Overflow https://ift.tt/3cCDhVN
https://ift.tt/eA8V8J
Comments
Post a Comment