Within TypeScript, I have Class1 defined in class.ts, along with some functions from helper.ts and variables from variables.ts:
For instance, the content of variables.ts is as follows:
export const test1 = 'test1';
export const test2 = 0;
export const test3 = 'test3';
export const test4 = 'test4';
Subsequently, using Webpack, I specify api.ts as the entry point to build a module.
api.ts
export { Class1 } from './class1';
export { helper1, helper2 } from './helper';
export * from './variables';
Within my web application, when working with JavaScript, I import necessary elements from this module. However, rather than importing each variable individually like so:
import { test1, test2, test3, test4 } from 'api';
I am interested to know if it is feasible to achieve an import structure similar to this:
import { variables } from 'api';
test1 = variables.test1;
or possibly something like:
import { variables.test1, variables.test3} from 'api';
What adjustments should be made in TypeScript to enable this functionality?