From the course: TypeScript Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Share code with imports and exports

Share code with imports and exports - TypeScript Tutorial

From the course: TypeScript Essential Training

Share code with imports and exports

- [Instructor] In the previous video, I very quickly showed you an application that did not use modules and then that same application after it had been converted to use modules. In this video, I'll back up to that pre-modules application and walk you through exactly how to convert it to a module-based application. This is the entry point of the application, App.js. The code in App.js relies on a utility function, format date, defined in the util.js file. And it gains access to that function simply by the fact that we happen to be loading both of these files into the same browser window. The moment we convert these files to TypeScript, however, TypeScript complains about the fact that it doesn't know about function, format, date. To make TypeScript happy again, we'll need to tell it where it can find this function. That is, we'll have to explicitly import this function from the other file. However, before something can be…

Contents