Hands-OnIt is possible to use regular JavaScript code in a TypeScript application. TypeScript is a superset of JavaScript, which means that any valid JavaScript code is also valid TypeScript code. This allows developers to gradually adopt TypeScript by starting with their existing JavaScript codebase and gradually migrating it to TypeScript. Additionally, developers can use legacy JavaScript libraries and frameworks in a TypeScript application without any issues.
Continue reading →Best PracticesAn assertion function is the implementation of a runtime check that is able to identify the type of unknown input. When the conditions of the assertion functions are passed, TypeScript’s compiler will then assume that the input is of the type claimed by the signature of the assertion function.
Continue reading →New FeaturesTypeScript 2.1 introduced mapped types which allow you to build new types based on the properties of an existing type.
Continue reading →New FeaturesTypeScript 3.4 introduced const assertions, a feature that allows you to claim a value as immutable. This feature is particularly valuable in combination with array literals, as it prevents new values from being pushed into an existing array.
Continue reading →Hands-OnYou can extend your Express.js server easily with custom middleware. All you have to do is to write a function that accepts three parameters (req
, res
, next
).
Continue reading →ReactIn this post, we are going to take a look on how to add CSS styling to React Components with TypeScript. Our teacher Amir shows you how to structure your components and how to type your props, so that you won’t run into error TS2739. There will be also an introduction to CSS Modules.
Continue reading →Best PracticesBy default, TypeScript’s compiler doesn’t allow you to add a custom type annotation to an error in a try-catch statement (TS1196). That’s because the underlying code can throw any type of error, even system generated exceptions, which makes it impossible for TypeScript to know the error type from the start. Luckily, there is the concept called “type guards“ which can help the TypeScript compiler to infer a specific type.
Continue reading →Hands-OnCreating a screencast is harder than it seems. Despite from the idea, you need the right hardware and software to produce high quality content. Especially the post-production is often underestimated. To make your work easier, we would like to give you a few tips on the way.
Continue reading →ReactIn the second episode of Amir’s “React with TypeScript“ course you will learn how to render multiple elements in React. Amir also shows you how to create a TypeScript interface which helps you to specify known properties of your objects.
Continue reading →Best PracticesIn this tutorial Benny shows you simple techniques on how to improve your switch statements. Using the tips and tricks from the video, you will never miss a switch case again. You will also learn how to fix error TS2322, TS2366 and TS7030.
Continue reading →