2
votes

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


sub-project code

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(): { }
}

main-project code

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"
        ],
    }
}
1
Can you create a stackblitz that reproduces the issue?Tyler Church
Also, do you have any .d.ts files or anything for sub-project? I'm wondering if test.ts is referencing out-of-date typings or something.Tyler Church
no d.ts files in the projectuser6086008
Show your peoplefile. I think you don't export class in a proper way in this file.Oleksii
Immediate re-exports is a new feature and might be buggy. Have you tried import { Helper } from './src/helpers/helper'; export { Helper }?Nino Filiu

1 Answers

3
votes

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 };