Node.js添加實驗性TypeScript支援,版本穩定性疑慮引發社群激烈討論
支付動態 · 2024-07-29

Node.js新增實驗性TypeScript支援,引發社群對類型剝離、版本相容性的熱烈討論,並擔憂版本可能因TypeScript頻繁變更而需經常更新

Node.js開發團隊在新版本增加實驗性TypeScript支援,要讓Node.js開發者可以直接執行TypeScript檔案,但是社群成員卻在該功能相關的GitHub拉取請求頁面,表達對該功能實作的疑慮,包括對支援的方法以及版本相容性都提出許多意見,該GitHub頁面甚至一度因為討論過激而鎖定。

TypeScript是微軟所開發的程式語言,其源自於JavaScript但是擁有更多的功能,靜態型別系統便是其重要功能之一。靜態型別系統在大型或是複雜系統的開發扮演重要的角色,具有增加安全性、效能和可維護性等優點。

之所以Node.js會添加TypeScript實驗性支援,是基於回應社群的需求,這對於推動Node.js生態系發展,以及未來提供原生支援TypeScript是重要的一步,以更直接的方式執行TypeScript檔案,而不需要額外安裝相依項目或是載入程式。

原本以JavaScript為基礎的Node.js要能支援TypeScript,需要進行一系列處理,像是類型剝除,移除TypeScript特有的型別,對於Enum和命名空間等原本不存在於JavaScript的功能,則需要進行額外轉換。

新增TypeScript支援的拉取請求頁面,這幾天大量在社交平臺、網路論壇上曝光,引來許多開發者的關注。討論的內容圍繞在型別剝離的方法上,不少開發者認為TypeScript型別剝離並非簡單的操作,會需要完整的TypeScript語法解析器,但是TypeScript語法又不斷改變,因此這增加了支援的難度,使用者可能需要不斷更新Node.js版本才能支援TypeScript功能。

錯誤堆疊的正確性也受到關注,社群擔心在剝離類型之後,編譯器無法取得正確的錯誤位置資訊。有一派的支持者認為應該分離更新,採用類似NPM的策略,將TypeScript解析器作為一個可單獨更新的套件,甚至是推出專門支援TypeScript的Node.js版本,避免專案之間的相容性問題。

不過,早在之前,開發者與社群就已經過一輪討論,會在保有穩定、高效能的前提下實作,採用型別剝離的方法,不支援TypeScript的所有功能,盡量保持簡單。

目前作者也傾向以解耦的方式在Node.js支援TypeScript,透過創建獨立的套件,如此既能夠維持核心穩定版本,也能夠當TypeScript發布Node.js不支援的新功能、重大變更,或是用戶想要自己使用新的實驗功能,可以獨立升級TypeScript。

热门文章
1spin4win releases unique slot Don Catleone Hold and Win featuring gangster cats
Online Game
SBC Summit Canada to Make Player Safety a Key Pillar of 2026 Agenda
Marketing
Full House at GAT Expo Cartagena 2026 Academic Agenda
Online Game
Gaming & Technology Expo Makes a Powerful Entrance in CDMX
Marketing
British gambling levy rates confirmed for each vertical
Regulation
Brazil Proposes Raising Gambling Tax Rate to 24%, With Revenue Allocated to Social Security and Healthcare
Regulation
Vietnam's tightening online gaming policy creates new market opportunities
Southeast Asia
New Jersey July Gambling Revenue Hits $606M, Sweeps Casinos Banned
Regulation
Institutional Academy that exceeded expectations marked the opening of GAT CDMX
Online Game
B2B Tech Infrastructure Gains Momentum in Philippine Gaming Sector
Southeast Asia
GGC Awards 2026 Shines in Colombo: Honoring Leaders and Innovators in the iGaming Industry
HUIDU Focus
Indiana online casino bill stalls in House committee
Regulation
UK MPs reopen 2025 gambling inquiry as reform stalls
Regulation
PropellerAds Shared a New iGaming Case Study: 97,674 Installs and 12,701 Deposits in 3 Months
Marketing
Vietnam’s Controlled Gaming Shift Gains Ground, But Domestic Demand Still Lags
Southeast Asia
首页
游戏
合作
发现
我的