FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: improve error message for JSX in non-module files (Issue #64438) by OMD-123 · Pull Request #64616 · microsoft/TypeScript · GitHub

Repository navigation

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .go  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 5 additions & 0 deletions tsc/internal/checker/jsx.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,11 @@ func (c *Checker) getJsxNamespaceContainerForImplicitImport(location *ast.Node)
if links.jsxImplicitImportContainer != nil {
return core.IfElse(links.jsxImplicitImportContainer == c.unknownSymbol, nil, links.jsxImplicitImportContainer)
}
// If the file is not an external module (no imports/exports), it cannot import the JSX runtime.
// Return nil to avoid the confusing "module path ... could not be found" error (Issue #64438).
if file.ExternalModuleIndicator == nil {
Comment on lines +1455 to +1457
return nil
}
canonicalErrorTag := links.firstJSXTagInFile
if canonicalErrorTag == nil {
var visit ast.Visitor
Expand Down

Back | FazBrowse Home | New Git URL