microsoft / microsoft/TypeScript
In scripthost.d.ts add `WScript` interface for extendibility
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
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 {
//...
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in scripthost.d.ts by locating the inline WScript declaration and the CreateObject signature. Refactor the declaration so WScript is an interface used by the global variable, and confirm that a third-party interface augmentation can specialize CreateObject for a specified ProgId and return a typed COM object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100