Support symbol properties on namespaces

未關閉
#36,813 6 則留言 6 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
typescript
領域
compilers

研究方向

首先查看 doSomething.d.ts 中的範例宣告以及連結的 DefinitelyTyped 討論;payload 未提及任何編譯器檔案或測試。完成的標準是:接受 namespace 上要求的 symbol 屬性,同時保留所述的宣告和執行階段限制。

由索引模型根據 Issue 內容生成。

描述

In Discussion Suggestion

Search Terms

  • namespace symbol
  • namespace symbol property
  • namespace symbol properties

Suggestion

The ability to declare symbol properties on TypeScript namespaces.

Use Cases

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/42154#discussion_r376739320.

Examples

// doSomething.d.ts
import { promisify } from "util";

declare function doSomething(
	foo: any,
	onSuccessCallback: (result: string) => void,
	onErrorCallback: (reason: any) => void
);
declare namespace doSomething {
	function [promisify.custom](foo: any): Promise<string>;
}

export = doSomething;

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.
主要語言
Go
星號
111k
分支
14.4k
平均合併
1 天 19 小時
30 天內合併 PR
117

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/TypeScript 的其他 Issue

查看 microsoft/TypeScript 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。