December 2017
Beginner
372 pages
10h 32m
English
TypeScript modules are defined by the filesystem, meaning that every file is a separate module and the filename becomes the module name. There's no special keyword to define a module. So, we can create a new file, which becomes a module; all the content inside the module is encapsulated and cannot be accessed from outside, unless explicitly defined.
For example, as shown in the following code snippet, we create a file named service.ts, which has a class and a function. This would create a module named service, which can then be referenced in another module:
interface iBoardService{ url: string; getBoardInformation();}class BoardService{ url: string;getBoardInformation(){ return "No boards available"; } }
Read now
Unlock full access