⏪ Вернуться в оглавление

About the author


Author: https://t.me/ahillary

Resources


Channel: https://t.me/semolina_code_python

Chat: https://t.me/python_with_ahillary

YouTube: https://www.youtube.com/@semolinacode

Coding training: https://t.me/how_to_code_web3

Prop trading: https://t.me/semolina_prop


Содержание

Экспорт и импорт

Экспорт до объявления

Мы можем пометить любое объявление как экспортируемое, разместив export перед ним, будь то переменная, функция или класс.

Например, все следующие экспорты допустимы:

// экспорт массива
export let months: string[] = ['Jan', 'Feb', 'Mar', 'Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

// экспорт константы
export const MODULES_BECAME_STANDARD_YEAR: number = 2015;

// экспорт класса
export class User {
	name: string;

	constructor(name: string) {
		this.name = name;
	}
}

Точка с запятой