Reputation: 111
I have a protractor project, where I want to export multiple classes from another project into my test class. The first class of Helper
imports ok, but for the rest, I get an error: has no exported member - People, Groups
app.ts
export { Helper } from './src/helpers/helper';
export { People } from './src/helpers/people';
export { Groups } from './src/helpers/groups';
package.json
{
...
"name": "sub-project",
"main": "app.ts",
...
}
helper.ts
import { HttpClient } from './http-client';
export class Helper {
private httpClient = new HttpClient();
public async myFunction(): { }
}
people.ts
import { HttpClient } from './http-client';
export class People {
private httpClient = new HttpClient();
public async myFunction(): { }
}
test.ts
import { Helper, People, Groups} from 'sub-project'; // error, has no exported member - People, Groups, (Helper - ok)
tsconfig
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"rootDir": ".",
"target": "es5",
"module": "commonjs",
"types": [
"chai",
"chai-as-promised",
"mocha"
],
}
}
Upvotes: 2
Views: 3342
Reputation: 18493
Immediate re-exports is a new feature and might be buggy.
Avoid
export { Helper } from './src/helpers/helper';
export { People } from './src/helpers/people';
export { Groups } from './src/helpers/groups';
and use the following instead:
import { Helper } from './src/helpers/helper';
import { People } from './src/helpers/people';
import { Groups } from './src/helpers/groups';
export { Helper, People, Groups };
Upvotes: 3