Skip to content

refactor: prioritize project references and check file extension per referenced tsconfig#1087

Draft
shulaoda wants to merge 1 commit intooxc-project:mainfrom
shulaoda:03-28-refactor_prioritize_project_references_and_check_file_extension_per_referenced_tsconfig
Draft

refactor: prioritize project references and check file extension per referenced tsconfig#1087
shulaoda wants to merge 1 commit intooxc-project:mainfrom
shulaoda:03-28-refactor_prioritize_project_references_and_check_file_extension_per_referenced_tsconfig

Conversation

@shulaoda
Copy link
Copy Markdown
Contributor

@shulaoda shulaoda commented Mar 28, 2026

closes #1086

  1. resolve_tsconfig_solution: Removed the parent-level is_file_extension_allowed_in_tsconfig and !is_file_included_in_tsconfig guards, so project references are always prioritized.
  2. is_file_included_in_tsconfig: Moved the extension check into the beginning of this method, so each referenced tsconfig uses its own allowJs setting.
  3. is_glob_match: Removed the now-redundant extension fast check, and since the path parameter was no longer needed, converted is_glob_match/is_glob_matches to static methods.

I found that many behaviors in tsconfck are inconsistent with TypeScript and are therefore incorrect.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Mar 28, 2026

Merging this PR will degrade performance by 5.67%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 12 untouched benchmarks
⏩ 5 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
resolver_real[multi-thread] 424.1 µs 449.6 µs -5.67%

Comparing shulaoda:03-28-refactor_prioritize_project_references_and_check_file_extension_per_referenced_tsconfig (f754867) with main (65854d1)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@shulaoda shulaoda force-pushed the 03-28-refactor_prioritize_project_references_and_check_file_extension_per_referenced_tsconfig branch from d8fc2ba to 9dc0d4f Compare April 12, 2026 23:14
@shulaoda shulaoda marked this pull request as ready for review April 12, 2026 23:52
@shulaoda shulaoda marked this pull request as draft April 13, 2026 00:07
@shulaoda shulaoda force-pushed the 03-28-refactor_prioritize_project_references_and_check_file_extension_per_referenced_tsconfig branch from 9dc0d4f to f754867 Compare April 15, 2026 02:02
@shulaoda shulaoda marked this pull request as ready for review April 15, 2026 02:06
@Boshen
Copy link
Copy Markdown
Member

Boshen commented Apr 20, 2026

This diverges from tsconfck https://github.com/dominikg/tsconfck/blob/01060798e4af4679231c433eb203c21a17ac5ffb/packages/tsconfck/src/util.js#L146-L148

can you figure out why tsconfck passes?

@shulaoda
Copy link
Copy Markdown
Contributor Author

This diverges from tsconfck https://github.com/dominikg/tsconfck/blob/01060798e4af4679231c433eb203c21a17ac5ffb/packages/tsconfck/src/util.js#L146-L148

can you figure out why tsconfck passes?

This is because we actually only changed two things. First, if references are present, they are matched with higher priority, which you can see from the changes in the test case results. Second, allowJs is now determined by each referenced config, rather than inheriting the parent tsconfig’s allowJs setting for all references.

@shulaoda shulaoda marked this pull request as draft April 21, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align tsconfig project references resolution priority with typescript

2 participants