DeveloperISH Initiatives: Introduction to Typescript, w/ Mercy Muchai @muchaimercy_
Subscribe to our newsletter and never miss any upcoming articles
Our speaker today is Mercy Muchai, a software engineer based in Nairobi. She is currently specialised in web development and enjoys singing and playing the piano when she isn't building features and squashing bugs. She will be taking us through everything we need to know about getting started with Typescript.
You can watch the video call recording on YouTube here:
Questions from the chat (truncated to include questions and comments to the questions) Most were answered during the call.
14:01:51 EAT From Mark Ng'ang'a : We’re live.
From Ho Slack : Please walk through the JS file for a second.
From Stanley Ndagi : Ho Slack, please remember to ask Muchai to do that after she's concluded
From Ryan Marvin : Please feel free to post any questions that come to mind here and Muchai will answer them at the Q&A at the end
From Moffat : Question: I noticed in some places, the boolean operator “OR” is used as “ | “ and in other places “ || “. Do they have any difference?
From joy warugu : what's the difference between types and interfaces and when do you choose one over the other
From creez : +100 @ joy
From Bonny Mwenda : How do you go about introducing typescript to an old code base? Eg, what are the best practices
From Stanley Ndagi : Do you setup files and include @ the same time in the .tsconfig? Or does include disregard the files?
From creez : I normally see people using custom types and others using interfaces…What is the difference and when should I use types over interfaces and vice verser.
From Paul Kiplimo Morogo : is there a standard naming pattern for interfaces? I see a lot of them defined with prefix ‘I’ ie IUser, IResponse etc
From Ho Slack : Yeah @ Bonny’s Question. Can I introduce Typescript in my react JS codebase without breaking other things?
From Stanley Ndagi : Difference between .tsx and .ts file extensions?
From Moffat : Does the compilation step affect the performance of TS compared to JS?
From creez : Tax is when you have tsx in your code base ts is when you aint using jsx
From Kelvin Chirchir : How do you handle a function that returns a Promise
From Mo : Why not put the JS files in the same folders as the TS files?
From Brian Odhiambo : @ stanley .tsx is syntax sugar. Typescript XML - Mostly for React not sure about Vue. …. .ts a typescript file
From Lemayian : I understand that I can use ts-node to run typescript code directly, but I have not seen this being used in production. Does this mean that typescript is less performant than JS? Basically, why can’t I just run TypeScript straight on my web server without transpiling to JS?
From joy warugu : the qn about type set user | null and ?... they aren't the same .. opro
From Gilbert N : At what instance do we declare our own types using declare keyword.
From joy warugu : optional ? means you whatever can be undefined..not null
From joy warugu : so it would be the same as user | undefined
From Lemayian : Interface vs Types: ducba.com/typescript-type-vs-interface
From creez : Yeah Thanks @ josee
From zacharianjoroge : Can we say that interfaces allow polymorphism like in Java
From david ngugi : Interfaces simply just describe the structure of say a class…it’s properties and methods
From Austin Roy : There’s also a great cheat sheet for TS with React