I'm starting to try some TypeScript features and I want to export two constants in one module and import them and use it in another module like this:
// module1.ts
export const CAMPUS = 'campus';
export const TOKIO = 'tokio';
// module2.ts
import * as ThemeNameEnum from './module1';
export type IState = ThemeNameEnum.CAMPUS | ThemeNameEnum.TOKIO;
The VSCode is not recognizing the exported members and the compiler is giving me this error:
ERROR in /Users/elias/Documents/agora-binaria/crm-front/src/app/redux/theme/theme-reducer.ts (4,36): Namespace '"/Users/elias/Documents/agora-binaria/crm-front/src/app/redux/theme/theme-name-enum"' has no exported member 'CAMPUS'.
ERROR in /Users/elias/Documents/agora-binaria/crm-front/src/app/redux/theme/theme-reducer.ts (4,59): Namespace '"/Users/elias/Documents/agora-binaria/crm-front/src/app/redux/theme/theme-name-enum"' has no exported member 'TOKIO'.
What am I doing wrong? Thanks.
PS: This is my tsconfig.json file:
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2017"
],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"removeComments": true,
"outDir": "../dist/client",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
},
"exclude": [
"node_modules"
]
}