Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JS: Disable type extraction#19640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
asgerf wants to merge28 commits intogithub:main
base:main
Choose a base branch
Loading
fromasgerf:js/no-type-extraction

Conversation

asgerf
Copy link
Contributor

@asgerfasgerf commentedJun 2, 2025
edited
Loading

Disabling type extraction

We used to rely on the TypeScript compiler's type checker for getting type information during extraction. As of this PR, we only use the TypeScript compiler for parsing, and instead use CodeQL logic to obtain the needed type information ourselves.

Why?

Faster extraction: We're seeing 20-80% faster extraction times for TypeScript code bases. The wins here tend to outweigh the added cost on the QL side.

Incremental extraction: Type extraction was incompatible with "overlay mode". With this change, TypeScript files can be extracted in isolation from each other, meaning we only have to parse the files that have changed when building an overlay database.

Robustness: TypeScript extraction rarely fails, but when it does, it is usually because of type extraction. At least three public issues (1,2,3) and several internal ones are ultimately about type extraction problems. Several issues with type extraction have surfaced and been fixed over the years, but there's been a tendency for the "fixes" to be workarounds for problems that we don't have enough control over from the extractor.

Deprecations and breaking changes

This PR deprecatesType and other APIs relating to extracted types, and introduces a simple interface for interacting with the new QL-based name/type resolution.

Queries relying onType and friends should still compile (with deprecation warnings) but won't have the same results sinceType is now empty. The change notes therefore lists this as a breaking change. We try to avoid breaking changes when at all possible, but there is no viable mechanism for avoiding it in this case.

Call graph changes

When I made the original call graph estimates in the previous PR, I had unfortunately not disabled the influence of type extraction completely, meaning we lose more call edges than originally estimated.

This PR adds a few more fixes to recover some of them, but as seen in theevaluation we still lose 25k call edges. However, this only results in 1 lost alert, which was a FP. I have some follow-up work with generics that recovers about a third of the call edges. Despite the lost call edges, I'd like to move ahead with this PR as the pros clearly outweigh the cons at this point, and it means we can unblock other works that depend on it.

hvitved reacted with rocket emoji
@github-actionsgithub-actionsbot added the JS labelJun 2, 2025
name = spec.getExportedName() and
result = spec.getLocal()
)
or

Check warning

Code scanning / CodeQL

Dead code Warning

This code is never used, and it's not publicly exported.
name = sig.getName()
)
private class MethodCallSig extends Function {
private MethodSignature signature;

Check notice

Code scanning / CodeQL

Field only used in CharPred Note

Field is only used in CharPred.
@asgerfasgerfforce-pushed thejs/no-type-extraction branch from7ba856a to2cd92efCompareJune 4, 2025 10:51
Comment on lines +10 to +12
/**
* Interface for accessing name-resolution info about type names.
*/

Check warning

Code scanning / CodeQL

Class QLDoc style. Warning

The QLDoc for a class should start with 'A', 'An', or 'The'.
Comment on lines +142 to +144
/**
* Interface for accessing name-resolution info about expressions.
*/

Check warning

Code scanning / CodeQL

Class QLDoc style. Warning

The QLDoc for a class should start with 'A', 'An', or 'The'.
@asgerfasgerfforce-pushed thejs/no-type-extraction branch 5 times, most recently from9521fbb to2035925CompareJune 11, 2025 08:48
This query depended on the cons-hashing performed by type extraction to determine if two types are the same.This is not trivial to restore, but not important enough to reimplement right now, so for now just simplifying the query's ability to recognise that two types are the same.
This was used in the very old dist-compare tool, but has no use anymore
@asgerfasgerfforce-pushed thejs/no-type-extraction branch from4ba014d toa039c1bCompareJune 23, 2025 10:57
@asgerfasgerfforce-pushed thejs/no-type-extraction branch 2 times, most recently from3a1fae6 to1729f7aCompareJune 24, 2025 15:50
This check existed on the code path for full type extraction, but not for plain single-file extraction.
The 'extractTypeScriptFiles' override did not incorporate the file type and one of our unit tests was expecting this. The test was previously passing for the wrong reasons.
@asgerfasgerfforce-pushed thejs/no-type-extraction branch from1729f7a to5289e4fCompareJune 25, 2025 12:37
@asgerfasgerf changed the titleJS: Deprecate type extractionJS: Disable type extractionJun 25, 2025
@asgerfasgerf marked this pull request as ready for reviewJune 25, 2025 13:16
@asgerfasgerf requested a review froma team as acode ownerJune 25, 2025 13:16
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@asgerf

[8]ページ先頭

©2009-2025 Movatter.jp