Sadanand gadwalsadanandgadwal.hashnode.dev·Apr 20, 2024Mastering TypeScript: A Comprehensive GuideTypeScript is an open-source programming language developed by Microsoft that builds upon JavaScript by adding optional static typing, interfaces, classes, and other features to help developers write robust and scalable code. It compiles to plain Jav...Discuss·10 likesTypeScript
Sarthak Batrablog.srthk.com·Apr 18, 2024Modern tsconfig template [2024]In this blog, I am keeping a draft example of the modern tsconfig file that works for me in the projects that I am making. { "compilerOptions": { "target": "ESNext", "experimentalDecorators": false, "module": "commonjs", "rootDir": ...Discussrapidcoding
chintanonwebchintanonweb.hashnode.dev·Apr 18, 2024Mastering Angular Hydration: The Key to Seamless User ExperiencesAngular Hydration: Demystifying its Importance in Web Development Introduction In the realm of web development, Angular stands out as a powerful framework for building dynamic and responsive web applications. Among its many features, Angular hydratio...DiscussAngular: Unveiling the Stars of Modern UI DesignAngular
Lokesh Sharmalokeshkavisth.hashnode.dev·Mar 26, 2024Level Up Your React: Adding Basic TypeScript for Stronger ComponentsBuilding React applications often involves moving data and manipulating the DOM. JavaScript, while strong, is prone to type mistakes at runtime. TypeScript, a superset of JavaScript, comes to the rescue by ensuring type safety, resulting in more robu...DiscussThe Dev Diaries: 100 Days, 100 BlogsTypeScript
Vincemynameisvince.hashnode.dev·Mar 25, 2024TypeScript - Advanced Object Types學習資源: Codecademy Introduction 在寫 TypeScript 一個常見的挑戰是如何在程式碼會遇到的狀況下使用型別,比如下面的例子: class Robot { identify(id: number) { console.log(`beep! I'm ${id}`); } } 在上面宣告一個 class 叫做 Robot,但要怎麼去使用它?並且,一些機器人可能比其他機器人有更多的功能,或者具有變化的屬性名稱。在這些情況下,要如何去應用型別? 所以這篇文...DiscussTypeScriptTypeScript
Brandon ClappProbrandonclapp.com·Mar 22, 2024TypeScript's `unknown` typeIn TypeScript, both unknown and any types represent values that could be anything. However, they are used in quite different contexts due to their safety characteristics. any Type The any type is essentially TypeScript's way of saying, "turn off type...Discuss·45 readsTypeScriptTypeScript
Vincemynameisvince.hashnode.dev·Mar 22, 2024TypeScript - Union Types學習資源: Codecademy 介紹 TypeScript 讓我們針對變數給予不同的型別。而通常若給予變數一個型別的話,我們就只允許給變數這個型別的值。 而另一方面,也可以給變數 any 型別,所以在 assign 值的時候就相對自由。 而有時候我們有可能會需要同時使用兩者。比方說,我們必須編寫一個程式來獲取員工的 ID,然後將 ID 印出到控制檯。問題是,員工的 ID 可以是字串或數字。 由於我們需要 ID 變數允許多個型別,因此我們可以使用 any 型別,例如: let ID: any; ...DiscussTypeScriptTypeScript
Alexanderr11baka.hashnode.dev·Mar 21, 2024Write 'once' function with TS from scratchTLDR I know about lodash implementation of once. I know about Parameters and ReturnType generic function in Typescript. I want to reinvent the wheel. Here is example full example on ts playground Example of code Once? Suppose I want to create functio...DiscussTypeScript
Vincemynameisvince.hashnode.dev·Mar 20, 2024TypeScript - Custom Types學習資源: Codecademy Enums 枚舉 在做型別註釋的時候,比如使用 Tuples ,變數很多的時,型別註釋也會跟著很多。但大多時候很多都是重複的,所以這時枚舉就派上用場了。 enum Direction { North, South, East, West } 在許多情況下,我們可能想要限制變數的可能值。 例如,上面的程式定義了枚舉方向,代表四個指南針方向:Direction.North, Direction.South, Direction.East, and ...DiscussTypeScriptTypeScript
Vincemynameisvince.hashnode.dev·Mar 20, 2024TypeScript - Array學習資源: Codecademy 介紹 陣列與使用 primitive 型別有點不同。這是因為陣列通常包含許多資料。追蹤陣列的型別意味著跟蹤每個元素的型別。 例如: let firstArray = [1, 2, 3, 4]; let secondArray = [5, '6', [7]]; 我們可以看到,firstArray的元素都是number 型別。 另一方面,secondArray具有不同型別的元素:number、string 和 array。兩者都是 JavaScript 陣列的例...DiscussTypeScriptTypeScript