@@ -544,11 +544,11 @@ namespace ts.codefix {
544
544
545
545
function getFixesInfoForNonUMDImport ( { sourceFile, program, cancellationToken, host, preferences } : CodeFixContextBase , symbolToken : Identifier , useAutoImportProvider : boolean ) : FixesInfo | undefined {
546
546
const checker = program . getTypeChecker ( ) ;
547
- const symbolName = getSymbolName ( sourceFile , checker , symbolToken ) ;
547
+ const compilerOptions = program . getCompilerOptions ( ) ;
548
+ const symbolName = getSymbolName ( sourceFile , checker , symbolToken , compilerOptions ) ;
548
549
// "default" is a keyword and not a legal identifier for the import, so we don't expect it here
549
550
Debug . assert ( symbolName !== InternalSymbolName . Default , "'default' isn't a legal identifier and couldn't occur here" ) ;
550
551
551
- const compilerOptions = program . getCompilerOptions ( ) ;
552
552
const preferTypeOnlyImport = compilerOptions . importsNotUsedAsValues === ImportsNotUsedAsValues . Error && isValidTypeOnlyAliasUseSite ( symbolToken ) ;
553
553
const useRequire = shouldUseRequire ( sourceFile , program ) ;
554
554
const exportInfos = getExportInfos ( symbolName , getMeaningFromLocation ( symbolToken ) , cancellationToken , sourceFile , program , useAutoImportProvider , host ) ;
@@ -557,9 +557,9 @@ namespace ts.codefix {
557
557
return { fixes, symbolName } ;
558
558
}
559
559
560
- function getSymbolName ( sourceFile : SourceFile , checker : TypeChecker , symbolToken : Identifier ) : string {
560
+ function getSymbolName ( sourceFile : SourceFile , checker : TypeChecker , symbolToken : Identifier , compilerOptions : CompilerOptions ) : string {
561
561
const parent = symbolToken . parent ;
562
- if ( ( isJsxOpeningLikeElement ( parent ) || isJsxClosingElement ( parent ) ) && parent . tagName === symbolToken ) {
562
+ if ( ( isJsxOpeningLikeElement ( parent ) || isJsxClosingElement ( parent ) ) && parent . tagName === symbolToken && compilerOptions . jsx !== JsxEmit . ReactJSX && compilerOptions . jsx !== JsxEmit . ReactJSXDev ) {
563
563
const jsxNamespace = checker . getJsxNamespace ( sourceFile ) ;
564
564
if ( isIntrinsicJsxName ( symbolToken . text ) || ! checker . resolveName ( jsxNamespace , parent , SymbolFlags . Value , /*excludeGlobals*/ true ) ) {
565
565
return jsxNamespace ;
0 commit comments