From the course: SharePoint Framework for Developers: 1 Understanding the Toolchain

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

TypeScript modules and renaming across modules

TypeScript modules and renaming across modules

From the course: SharePoint Framework for Developers: 1 Understanding the Toolchain

Start my 1-month free trial

TypeScript modules and renaming across modules

- [Instructor] TypeScript also allows me to import and export from other libraries. This is invaluable when it comes to referencing others' code or simply organizing my own code. Let me show you how. Remember we saw this library called momentJS. So let's go ahead and add that as a dependency in our code. So dependencies moment and let's go ahead and just pick the latest version. And let's go ahead and run npm install. Now, once momentJS is installed, I'll come back into VS Code, go to scripts.ts. Now, notice that the JS file is not going to update on the right-hand side, because a TypeScript transpilation is currently not running. That's okay. So here, I can simply say import star as moment from moment, so see the IntelliSense picks it up. And now I can say moment dot. And you see here that I get a whole bunch of help here. So isDate. What does isDate do? Now the reason I get all of this help is because momentJS has chosen to write a dts file inside here. So let's look for moment…

Contents