microsoft / microsoft/TypeScript
In scripthost.d.ts add `WScript` interface for extendibility
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
lib Update Request
I want to write a type lib to extend WScript, allow CreateObject to recognize some specified ProgId, and make the returned COMObject typed:
var app = WScript.CreateObject("Microsoft.Excel");
// ^^
// make this typed
But in scripthost.d.ts, The type of WScript is inlined with it's declearation:
declare var WScript: { /* inlined type definition */ };
To make it possible to extend, we can add a interface using the same name WScript and set this as the type of the var WScript:
interface WScript { /* type definition of WScript */ }
declare var WScript: WScript;
In thiry part lib, they could extend WScript var by extends the interface WScript. for example, In my lib, I could write:
interface WScript {
CreateObject("Microsoft.Excel"): Excel.App;
}
declare namespace Excel {
interface App {
//...
}
}
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 in scripthost.d.ts, indem du die Inline-Deklaration von WScript und die Signatur von CreateObject suchst. Überarbeite die Deklaration so, dass WScript eine von der globalen Variable verwendete Schnittstelle ist, und bestätige, dass eine Erweiterung der Schnittstelle durch Drittanbieter CreateObject für eine angegebene ProgId spezialisieren und ein typisiertes COM-Objekt zurückgeben kann.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 52/100