Skip to main content


The concept of modules first appeared in the ECMAScript 2015 standard. Modules allow you to split a complex application into separate files, each of which contains strictly defined functionality, and then, using import, to put them together. Variables, classes, functions declared in a module are not available from outside this module, unless they are exported using the export command. And in order to use the exported parts in another module, you need to import them using the import command.


Any declaration can be exported using the export keyword.

Playground Link

// Экспорт переменной
let fruit: string = 'banana',
device: string = 'smartphone',
bool: boolean = true
export { fruit, device, bool as isBool }
// Экспорт константы
export const e = 2.7182818284590452353602874713526625
// Экспорт функции
export function sum(x, y: number): number {
return x + y
// Экспорт интерфейса
export interface Fruit {
name: string;
sweetness: number;
bones: boolean;
// Экспорт класса
export class Animal {
move(distanceInMeters: number = 0) {
console.log(`Animal moved ${distanceInMeters}m.`)
// Экспорт всего сразу
export { fruit, e, sum, Fruit, Animal }


Now you are on a stripped-down version of the site, after subscribing to Patreon, you will get full access to the training course, as well as access to our server's private channels in Discord.

Download our mobile application or get tested in our JavaScript telegram bot, and also subscribe to our news.

Become a Patron!

Sumerian school

Contributors ✨#

Thanks goes to these wonderful people (emoji key):



Dmitriy Vasilev


Become a Patron!