microsoft / microsoft/TypeScript
Support declaring @types as the supported route for typings dependencies in the package.json
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
Search Terms
package json types field types types module
Suggestion
Allow libraries written in JavaScript to be able to declare that they have types in DT (or other modules), and that they support a certain version of it.
For example:
Express does not support TypeScript but trusts that the DefinitelyTyped express maintainers know what they are doing generally. They want to declare that DT is the way for TypeScript users to get types out of the box. Today that's not really possible.
Examples
Two potential routes:
-
Override the "types" parameter to support:
"types": "@types/express:^3.0"in a package.json -
Recommend a new field in the package.json:
"typesModule": "@types/express:^3.0"- then when TypeScript normally offers a 'no types found', then it can offer the command to install with the correct semver range.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
/cc @wesleytodd @isaacs @ljharb
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
Beginnen Sie mit der Überprüfung, wie TypeScript Metadaten aus package.json liest und wie der bestehende Pfad „no types found“ funktioniert; im Issue werden keine Quelldateien oder Tests genannt. Beim Design muss zunächst festgelegt und spezifiziert werden, wie ein Paket ein externes Typings-Modul und seinen unterstützten semver-Bereich deklariert; anschließend muss überprüft werden, ob TypeScript diese Deklaration verwenden kann, um die Installation zu steuern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 32/100