microsoft / microsoft/TypeScript
Add API to query if SourceFile originated from typeRoots lookup
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
This proposes to add an API Program#isSourceFileFromTypeRoots that is similar to Program#isSourceFileFromExternalLibrary but for typeRoots.
Currently the only way to determine if a SourceFile comes from typeRoots is to use ts.getEffectiveTypeRoots and check if a given SourceFile#fileName starts with any of the paths.
That works if there are no symlinks. With symlinks one needs to use realpath on all of the typeRoots before comparing to fileName as that is already a realpath.
And even that doesn't cover cases where a subdirectory (like node_modules/@types/foo) or an individual file (node_modules/@types/foo/index.d.ts) is a symlink.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Lesen von Program#isSourceFileFromExternalLibrary, ts.getEffectiveTypeRoots und der Verarbeitung von SourceFile#fileName. Verfolge, wie typeRoots und symbolisch verknüpfte Verzeichnisse oder Dateien dargestellt werden, und füge dann die vorgeschlagene Program#isSourceFileFromTypeRoots API mit Abdeckung für diese Fälle hinzu. Erledigt ist die Aufgabe, wenn Aufrufer Pfade nicht mehr selbst vergleichen müssen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- api, compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100