Willdune
Willdune11mo ago

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

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?
1 Reply
Deno AI Helper
Deno AI Helper11mo ago
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.