The Fantastic 4: #typescript features I’ve come to know and love
▻https://hackernoon.com/the-fantastic-four-typescript-features-ive-come-to-know-and-love-eab5b1d
The chat interfaceThis article will showcase the usage of these four great features in the context of creating a chat app:Async/AwaitUnion typesType guardsReadonly propertiesAsync/AwaitThis feature enables you to define and call asynchronous code simply and concisely.In the context of the chat app, users need to logon to the chat room via a network call. To keep the UI responsive you need to:Make the call asynchronouslyInform the user that the logon is pendingUpdate the UI once the user is successfully logged on as below:Logon processThe code to carry this out is very straightforward:▻https://medium.com/media/435d28d1e5942e87a259640b2854449d/hrefUnion typesThis feature enables you to define a family of types using a lightweight syntax. You are able to do so without defining a class (...)
#javascript #react #html #vuejs