Skip to content

Repository files navigation

js-types

github action status

Зачем это нужно

Помеченные данные: к значению приклеивается ярлык типа, и дальше по нему можно ветвиться. Так собирают диспетчеризацию вручную, до того как в языке появятся классы и интерфейсы.

Нужна курсам, где показывают, что «тип» это не магия компилятора, а всего лишь ещё одно значение рядом с данными.

Install

npm install @hexlet/tagged-types

Usage example

import { attach, typeTag, contents } from '@hexlet/tagged-types';

const data = 'text, pair, list or others';
const tag = attach('typeOfTag', data);
// ('typeOfTag', 'text, pair, list or others')

typeTag(tag); // 'typeOfTag'
contents(tag); // 'text, pair, list or others'

For more information, see the Full Documentation

Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages