Slack Desktop 是使用 Electron 開發的 ,但是隨著 codebase 越來越大,Slack 桌面 App 團隊開始將原有的 javascript 轉移到 TypeScript ,這篇文章分享了他們的轉移經驗,還有獲得了哪些好處,在文章看到幾個重點
1. TypeScript 是有型別的,在安裝了編輯器 plugin 支援下可以動態檢查是否會呼叫到不存在的屬性或是 function
2. TypeScript 可以與 javascript 共存, 所以要從 javascript 轉移到 TypeScript 可以採用漸進式移轉, 而不是將 javascript 完全打掉重練
3. 在將 Javascript 移轉到 TypeScript 過程中,開發者使用 type checker 找到許多 bugs
4. 在 pre-commit hook 使用 TSLint 檢查修改的 code 是否有符合 linting rules
5. 第三方程式庫也必須是 TypeScript 相容,如果有些程式庫沒有型別定義, 這篇文章提到一個 DefinitelyTyped 專案可以找到 The repository for high quality TypeScript type definitions. 可以使用 npm install @types/react 安裝
▶對於 Typescript 有興趣可以參考這門熱門課程 Understanding TypeScript https://goo.gl/Q8GfI2
https://slack.engineering/typescript-at-slack-a81307fa288d
「react typescript function type」的推薦目錄:
- 關於react typescript function type 在 軟體開發學習資訊分享 Facebook 的最佳貼文
- 關於react typescript function type 在 React prop types with TypeScript - how to have a function type? 的評價
- 關於react typescript function type 在 React+TypeScript Cheatsheets - GitHub 的評價
- 關於react typescript function type 在 Typing React Props in TypeScript - DEV Community 的評價
- 關於react typescript function type 在 typescript-cheatsheet - GitHub Pages 的評價
- 關於react typescript function type 在 React Typescript Tutorial - YouTube 的評價
- 關於react typescript function type 在 TypeScript Function Types 的評價
react typescript function type 在 React+TypeScript Cheatsheets - GitHub 的推薦與評價
A list of TypeScript types you will likely use in a React+TypeScript app: type AppProps = { message: string; count: number ... ... <看更多>
react typescript function type 在 Typing React Props in TypeScript - DEV Community 的推薦與評價
One advantage of using React with TypeScript is that you can easily type the props of your (function) components. You don't have to use ... ... <看更多>
react typescript function type 在 React prop types with TypeScript - how to have a function type? 的推薦與評價
... <看更多>
相關內容