中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

TypeScript 3.0 正式發(fā)布:引入“項目引用”新概念

2018-07-31    來源:oschina

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
TypeScript

北京時間7月31日,微軟宣布推出 TypeScript 3.0 正式版。

TypeScript 3.0 是一個新的里程碑。官方表示,盡管版本號是一個大變化,但 3.0 版本幾乎沒有破壞性的變更(這意味著我們可以很輕松地升級到該版本),3.0 引入了一種新的靈活且可擴展的方式來構(gòu)建項目、提供對參數(shù)列表進行操作新的強大支持能力、強制顯式檢查的新類型、更好的 JSX 支持、整體更好的錯誤處理,等等。

下面簡單說說值得關(guān)注的更新,更詳細的更新說明請移步至 發(fā)布說明。

項目引用(Project references)

這是 3.0 版本中引入的一個新概念?紤]這樣一個場景 —— 對于開發(fā)者而言,為庫或應用程序提供幾個不同的構(gòu)建步驟是相當常見的。也許你的代碼庫有一個 src 和一個測試目錄。也許你將前端代碼放在一個名為 client 的文件夾中,將 Node.js 后端代碼放在名為 server 的文件夾中,每個文件夾都從共享文件夾中導入代碼。也許你使用所謂的“monorepo”并且有許多項目以復雜的方式相互依賴。

官方表示,針對上述的場景,他們?yōu)?TypeScript 3.0 開發(fā)了最重大的功能之一 ——“項目引用(project references)”。

項目引用允許 TypeScript 項目依賴于其他 TypeScript 項目 —— 特別是允許 tsconfig.json 文件引用其他 tsconfig.json 文件。指定這些依賴項可以更容易地將代碼拆分為更小的項目,因為它為 TypeScript(及其周圍的工具)提供了一種理解構(gòu)建順序和輸出結(jié)構(gòu)的方法。這意味著更快的構(gòu)建可以逐步工作,并支持跨項目導航、編輯和重構(gòu)。由于 3.0 奠定了基礎(chǔ)并公開了 API,因此任何構(gòu)建工具都能夠提供這一功能。

在JSX 中支持 defaultProps

該特性使得調(diào)用者可以通過不需要某些參數(shù)來更輕松地使用函數(shù)。

破壞性變更

API 的破壞性變更

  • The deprecated internal method LanguageService#getSourceFile has been removed, as it has been deprecated for two years. See #24540.

  • The deprecated function TypeChecker#getSymbolDisplayBuilder and associated interfaces have been removed. See #25331. The emitter and node builder should be used instead.

  • The deprecated functions escapeIdentifier and unescapeIdentifier have been removed. Due to changing how the identifier name API worked in general, they have been identity functions for a few releases, so if you need your code to behave the same way, simply removing the calls should be sufficient. Alternatively, the typesafe escapeLeadingUnderscores and unescapeLeadingUnderscores should be used if the types indicate they are required (as they are used to convert to or from branded __String and string types).

  • The TypeChecker#getSuggestionForNonexistentPropertyTypeChecker#getSuggestionForNonexistentSymbol, and TypeChecker#getSuggestionForNonexistentModule methods have been made internal, and are no longer part of our public API. See #25520.

相關(guān)鏈接

發(fā)布說明 https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/
TypeScript 3.0 新特性 https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#typescript-30
TypeScript 3.0 文檔 https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-0.html
破壞性變化 https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#typescript-30

下載地址

npm
Visual Studio 2015 plugin
Visual Studio 2017 (Select new version in project options)
NuGet package

標簽: isp 代碼 開發(fā)者

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:Android Studio 3.2 Beta 5 發(fā)布,包含錯誤修復和改進

下一篇:Vue-Rap 1.1.0 發(fā)布:構(gòu)建基于 Vue 的流應用