pub enum ResolutionFailure {
NotFound {
specifier: String,
containing_file: String,
span: Span,
},
InvalidSpecifier {
message: String,
containing_file: String,
span: Span,
},
PackageJsonError {
message: String,
containing_file: String,
span: Span,
},
CircularResolution {
message: String,
containing_file: String,
span: Span,
},
PathMappingFailed {
message: String,
containing_file: String,
span: Span,
},
ImportPathNeedsExtension {
specifier: String,
suggested_extension: String,
containing_file: String,
span: Span,
},
ImportingTsExtensionNotAllowed {
extension: String,
containing_file: String,
span: Span,
},
JsxNotEnabled {
specifier: String,
resolved_path: PathBuf,
containing_file: String,
span: Span,
},
ModuleResolutionModeMismatch {
specifier: String,
containing_file: String,
span: Span,
},
JsonModuleWithoutResolveJsonModule {
specifier: String,
containing_file: String,
span: Span,
},
}Expand description
Reason why module resolution failed
Variants§
NotFound
Module specifier not found
Fields
InvalidSpecifier
Invalid module specifier
Fields
PackageJsonError
Package.json not found or invalid
Fields
CircularResolution
Circular resolution detected
Fields
PathMappingFailed
Path mapping did not resolve to a file
Fields
ImportPathNeedsExtension
TS2834: Relative import paths need explicit file extensions in EcmaScript imports
when ‘–moduleResolution’ is ‘node16’ or ‘nodenext’.
Fields
ImportingTsExtensionNotAllowed
TS5097: Import path ends with a TypeScript extension without allowImportingTsExtensions.
Fields
JsxNotEnabled
TS6142: Module resolved to JSX/TSX without jsx option enabled.
Fields
ModuleResolutionModeMismatch
TS2792: Cannot find module. Did you mean to set the ‘moduleResolution’ option to ‘nodenext’? Emitted when package.json has ‘exports’ but resolution mode doesn’t support it.
Fields
JsonModuleWithoutResolveJsonModule
TS2732: Cannot find module. Consider using ‘–resolveJsonModule’ to import module with ‘.json’ extension. Emitted when trying to import a .json file without resolveJsonModule enabled.
Implementations§
Source§impl ResolutionFailure
impl ResolutionFailure
Sourcepub fn to_diagnostic(&self) -> Diagnostic
pub fn to_diagnostic(&self) -> Diagnostic
Convert a resolution failure to a diagnostic
All resolution failure variants produce TS2307 diagnostics with proper source location information for IDE integration and error reporting.
The message format matches TypeScript’s exactly: “Cannot find module ‘{specifier}’ or its corresponding type declarations.”
Sourcepub fn containing_file(&self) -> &str
pub fn containing_file(&self) -> &str
Get the containing file for this resolution failure
Sourcepub const fn is_not_found(&self) -> bool
pub const fn is_not_found(&self) -> bool
Check if this is a NotFound error
Trait Implementations§
Source§impl Clone for ResolutionFailure
impl Clone for ResolutionFailure
Source§fn clone(&self) -> ResolutionFailure
fn clone(&self) -> ResolutionFailure
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResolutionFailure
impl Debug for ResolutionFailure
Source§impl PartialEq for ResolutionFailure
impl PartialEq for ResolutionFailure
impl Eq for ResolutionFailure
impl StructuralPartialEq for ResolutionFailure
Auto Trait Implementations§
impl Freeze for ResolutionFailure
impl RefUnwindSafe for ResolutionFailure
impl Send for ResolutionFailure
impl Sync for ResolutionFailure
impl Unpin for ResolutionFailure
impl UnsafeUnpin for ResolutionFailure
impl UnwindSafe for ResolutionFailure
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more