D
Deno

help

The requested module does not provide an export named 'default'

WWilldune9/10/2023
I'm trying to export the following interface:
import User from '../models/User.ts';

export default interface AuthRepository {
signUp(uer: User): Promise<void>;
}
import User from '../models/User.ts';

export default interface AuthRepository {
signUp(uer: User): Promise<void>;
}
And the import:
import AuthRepository from '../domain/repository/AuthRepository.ts';
import AuthRepository from '../domain/repository/AuthRepository.ts';
But when running it says The requested module '../domain/repository/AuthRepository.ts' does not provide an export named 'default' But i already did export other interfaces and imported them, and it worked. I don't know what am i doing wrong, any clue?
DAHDeno AI Helper9/10/2023
Based on the documentation, it seems like there might be a typo in your interface definition. You've written signUp(uer: User): Promise<void>; instead of signUp(user: User): Promise<void>;. Here's the corrected code:
import User from '../models/User.ts';

export default interface AuthRepository {
signUp(user: User): Promise<void>;
}
import User from '../models/User.ts';

export default interface AuthRepository {
signUp(user: User): Promise<void>;
}
And the import should remain the same:
import AuthRepository from '../domain/repository/AuthRepository.ts';
import AuthRepository from '../domain/repository/AuthRepository.ts';
If you've already corrected the typo and you're still encountering the issue, it might be worth checking the path to make sure it's correct and that the file is being found. If the path is incorrect, it could lead to the error message you're seeing. If none of these solutions work, there might be an issue outside of the provided code snippet. In that case, I would recommend checking the rest of your code for potential issues.

Looking for more? Join the community!