Skip to content

Conversation

@ntdiary
Copy link
Contributor

@ntdiary ntdiary commented Nov 19, 2025

PR Checklist

Overview

Make sure the current symbol doesn't have SymbolFlags.Value before resolving alias.

I submit the recursive version here, which is just 1 line shorter than the while iteration.
If we prefer using iteration, can be done like this:

while (symbol && !checker.isUnknownSymbol(symbol)) {
  if (
    symbol.getDeclarations()?.some(ts.isTypeOnlyImportOrExportDeclaration)
  ) {
    return true;
  }
  if (symbol.flags & ts.SymbolFlags.Value) {
    return false;
  }
  if (!(symbol.flags & ts.SymbolFlags.Alias)) {
    return true;
  }
  symbol = checker.getImmediateAliasedSymbol(symbol)
}
return undefined;

💖

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @ntdiary!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint.

@netlify
Copy link

netlify bot commented Nov 19, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 3e7a944
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/6926a44be8334f0008cc4b3d
😎 Deploy Preview https://deploy-preview-11769--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 97 (🔴 down 1 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link

nx-cloud bot commented Nov 19, 2025

View your CI Pipeline Execution ↗ for commit 3e7a944

Command Status Duration Result
nx test eslint-plugin --coverage=false ✅ Succeeded 5m 2s View ↗
nx run-many -t lint ✅ Succeeded 3m 13s View ↗
nx run-many -t typecheck ✅ Succeeded 1m 59s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 5s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 2s View ↗
nx run integration-tests:test ✅ Succeeded 4s View ↗
nx run types:build ✅ Succeeded 2s View ↗
nx run generate-configs ✅ Succeeded 6s View ↗
Additional runs (29) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-11-26 07:06:12 UTC

return false;
}
return symbol.flags & ts.SymbolFlags.Alias
? isSymbolTypeBased(checker.getImmediateAliasedSymbol(symbol))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace getAliasedSymbol with getImmediateAliasedSymbol.
Because the latter can handle this case as well:

// a.ts
export const NAME = 1;
export type NAME = 1;
// b.ts
import { type NAME as Foo } from './a';
export { Foo };

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.49%. Comparing base (17601fc) to head (3e7a944).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11769   +/-   ##
=======================================
  Coverage   90.49%   90.49%           
=======================================
  Files         522      522           
  Lines       53357    53359    +2     
  Branches     8909     8911    +2     
=======================================
+ Hits        48284    48286    +2     
  Misses       5057     5057           
  Partials       16       16           
Flag Coverage Δ
unittest 90.49% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...eslint-plugin/src/rules/consistent-type-exports.ts 96.00% <100.00%> (+0.02%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the quick fix!

Normally we try to wait a full week for changes to give @typescript-eslint/triage-team a chance to review. But since this is a fast follow and our weekly release is in a few hours, I'd like to merge today. FYI team

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Nov 24, 2025
@JoshuaKGoldberg
Copy link
Member

I ended up not having time to merge this in for the Monday release this week. Will leave open.

@JoshuaKGoldberg JoshuaKGoldberg merged commit bb9ba53 into typescript-eslint:main Nov 28, 2025
65 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: [consistent-type-exports] Importing a shadowing type breaks consistent-type-exports

2 participants