export new UserService(); throws an Error because when using named exports, export expects an identifier and new UserService() does not resolve to a valid identifier.
Try this:
export const userService = new UserService();
/** imported like this: */
import { userService } from '../../the-path'
So, the name of identifier MUST be the same when you import a named export.
If you change the export identifier name, you must change that in import as well:
export const service = new UserService(); // <- just service
/** imported like this: */
import { service } from '../../the-path' // <- userService would be undefined. you have to import service
Unlike named exports, default does not have restrictions on the name while importing.
For example:
export default new UserService();
/** while importing, */
import userService from '../../the-path'; // <- works!
import serviceOfUser from '../../the-path'; // <- Works!
Read more about export here