{"id":463096,"date":"2025-06-13T09:01:53","date_gmt":"2025-06-13T09:01:53","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=463096"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=463096","title":{"rendered":"<span>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 TypeScript \u2014 \u0438 \u043d\u0438 \u043e \u0447\u0451\u043c \u043d\u0435 \u0436\u0430\u043b\u0435\u0435\u043c<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/846\/eec\/86b\/846eec86bb846b169e64b008e8ed0082.jpeg\" alt=\"TypeScript \u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u0438-\u043f\u0430\u0437\u043b\u044b\" title=\"TypeScript \u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u0438-\u043f\u0430\u0437\u043b\u044b\" width=\"780\" height=\"440\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/846\/eec\/86b\/846eec86bb846b169e64b008e8ed0082.jpeg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/846\/eec\/86b\/846eec86bb846b169e64b008e8ed0082.jpeg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>TypeScript \u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u0438-\u043f\u0430\u0437\u043b\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0434\u00bb? \u0412 \u041d\u041b\u041c\u041a \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0442\u0441\u044f, \u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438 \u0438 \u0432\u0438\u0434\u0435\u043d\u0438\u0435\u043c. \u0412 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 JavaScript \u0438 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0436\u0438\u0437\u043d\u0438, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0432\u0432\u0438\u0434\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0435\u0433\u043e \u201c\u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u0435\u0439\u201d.\u00a0<\/p>\n<p>\u0414\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445, \u043d\u043e \u044d\u0442\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432 \u0432\u0430\u043a\u0443\u0443\u043c\u0435, \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0430\u044f\u0441\u044f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044f\u0437\u044b\u043a\u0430 TypeScript \u2013 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u043d\u0432\u0435\u0441\u0442\u0438\u0446\u0438\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u0435: \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u0432 JavaScript \u2013 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0435\u0440\u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0443\u0447\u0438\u0442\u044c \u0434\u0436\u0443\u043d\u043e\u0432 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u0439 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0435\u0437 \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439\u00bb.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 TypeScript, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a TypeScript \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u044b \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043f\u0443\u0442\u044c \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043c\u0438\u043d\u0443\u0441\u044b \u0438 \u043f\u043b\u044e\u0441\u044b Typescript<\/h4>\n<p>Typescript \u2013 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044f\u0437\u044b\u043a\u0430 Javascript. \u041a\u043e\u0434, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Typescript (\u0434\u0430\u043b\u0435\u0435 &#8212; TS), \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 JS, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u043b\u044e\u0431\u044b\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b. \u0412\u0441\u0435 \u0444\u0438\u0448\u043a\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 JS \u2013 \u0443\u0436\u0435 \u0438\u0434\u0443\u0442 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 TS. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 &#8212; \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u201c0 == \u20180\u2019\u201d \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u041e\u041e\u041f \u2013 \u0442\u0438\u043f\u044b, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043b\u0430\u0441\u0441\u044b, \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.\u00a0<\/p>\n<p>\u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0434\u0430, \u043d\u0435\u0436\u0435\u043b\u0438 \u0432 JS, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043c\u0438\u043c\u043e \u043e\u0441\u043d\u043e\u0432 \u044f\u0437\u044b\u043a\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u041e\u041e\u041f, \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432 JS (\u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441) \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2013 \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u043b\u0438 \u043d\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044d\u0442\u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u044e\u0442.<\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u044b &#8212; \u0442\u0438\u043f\u044b, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u201c\u0437\u0432\u0435\u0440\u0438\u201d<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f TS, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f (enum) \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430-\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443: \u043f\u043e \u0446\u0432\u0435\u0442\u0443, \u043f\u043e \u0442\u0438\u043f\u0443 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \u2013 \u0442\u0430\u043a\u043e\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c HTML-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0432 \u0444\u043e\u0440\u043c\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">enum Component {\u00a0 \u00a0BUTTON, \u00a0INPUT, \u00a0CHECKBOX, \u00a0SELECT }<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u043b\u043b\u0435\u0433\u0438: <a href=\"https:\/\/habr.com\/ru\/companies\/nlmk\/articles\/770974\/\">https:\/\/habr.com\/ru\/companies\/nlmk\/articles\/770974\/<\/a><\/p>\n<ul>\n<li>\n<p>\u0422\u0438\u043f\u044b (type) \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0442\u0438\u043f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u043c \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 TS (number \u0438\u043b\u0438 string, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440), \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0438\u043f \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type Button = {\u00a0 \u00a0id: number, \u00a0label: string, \u00a0color: string, }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0442\u0438\u043f \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u201c\u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f\u201d \u043d\u0430 \u043d\u0435\u0433\u043e, \u043a\u0430\u043a \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b (interface) \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u201c\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u201d \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0438\u043f\u0430 Button \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">interface Button {\u00a0 \u00a0id: number; \u00a0label: string; \u00a0color: string; }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u043e\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430, \u043e\u0431\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0446\u0435\u043b\u0435\u0439 \u0438 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.\u00a0<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 (\u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c, \u0438 TS \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0438\u0445 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439), \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043f\u043e\u043b\u0435\u0439) \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.\u00a0<\/p>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 type \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0438 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u043f\u043e \u0442\u0438\u043f\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043e\u0431\u0435\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c. \u0418\u043d\u043e\u0433\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0435: \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u2013 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043c\u044b \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442 \u0432\u0430\u0441 \u0432 \u0433\u0443\u0440\u0443 \u044f\u0437\u044b\u043a\u0430 Typescript. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<h4>\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b keyof \u0438 typeof \u2013 \u201c\u043a\u043e\u043f\u0430\u0435\u043c\u0441\u044f\u201d \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445<\/h4>\n<ul>\n<li>\n<p><strong>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 keyof<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e key \u043d\u0430 \u044d\u0442\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 type Button \u0432\u044b\u0448\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type Button = { \u00a0id: number, \u00a0label: string, \u00a0color: string, }  type TButton = keyof Button \/\/ type TButton = \u2018id\u2019 | \u2018label\u2019 | \u2018color\u2019 const buttonKey: TButton = 'label';<\/code><\/pre>\n<p>\u041c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 buttonKey \u0434\u043e 3\u0445 &#8212; \u043a\u043b\u044e\u0447\u0435\u0439 \u0442\u0438\u043f\u0430 Button. \u041f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0439 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<ul>\n<li>\n<p><strong>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 typeof<\/strong> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">const button = 'buttonValue' type TString = typeof button  const newButton: TString = 'newButtonValue'<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d \u0438\u0437-\u0437\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043a\u0430\u043a \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f: \u043e\u043d \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 TS \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0438\u043f \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0438 \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2013 TString \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f string, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c, \u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f buttonValue. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c:<\/p>\n<pre><code class=\"typescript\">let button = 'buttonValue' type TString = typeof button  const newButton: TString = 'newButtonValue' \/\/ \u0412\u0430\u0448\u0435 \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e!<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c TString \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0442\u0438\u043f string, \u043d\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 const. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 const \u043c\u043e\u0436\u043d\u043e \u201c\u043e\u0431\u043e\u0439\u0442\u0438\u201d \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 \u044f\u0432\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439:<\/p>\n<pre><code class=\"typescript\">const button: string = 'buttonValue' type TString = typeof button  const newButton: TString = 'newButtonValue'<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 (Generic Types)<\/strong> \u2013 \u044d\u0442\u043e \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b. \u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e) \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u042d\u0442\u043e \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0440\u0430\u0437\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c-\u0442\u0438\u043f\u043e\u043c. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">function print(value: string) {\u00a0 \u00a0console.log(value) }  print('hello') print(2025)<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u044b\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0434\u043e string. \u0414\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f any, \u043d\u043e \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u0438\u043f\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0442\u0435\u0440\u044f\u043d. \u0412\u0434\u0440\u0443\u0433 \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0441 \u043d\u0435\u0439 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0442\u0435\u043c \u0436\u0435 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"typescript\">function printAndReturn(value: any): any { \u00a0console.log(value) \u00a0return String(value) }  printAndReturn('hello') printAndReturn(2025)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 value, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0439 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u043c:<\/p>\n<pre><code class=\"typescript\">function printAndReturn&lt;T&gt;(value: T): T { \u00a0console.log(value) \u00a0return String(value) \/\/ Type 'string' is not assignable to type 'T' }  printAndReturn('hello') printAndReturn(2025)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u043a\u0443\u0441 \u0441 \u201c\u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0439\u201d \u0441\u043c\u0435\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u0442: \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0442\u0435\u043c \u0436\u0435 \u0442\u0438\u043f\u043e\u043c, \u0447\u0442\u043e \u0438 \u0431\u044b\u043b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 value. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"typescript\">interface ValueWithGeneric&lt;T&gt; { \u00a0\u00a0\u00a0value: T; \u00a0\u00a0\u00a0getValue: () =&gt; T; }  const stringItem: ValueWithGeneric&lt;string&gt; = { \u00a0\u00a0\u00a0value: \"Hello\", \u00a0\u00a0\u00a0getValue: function() { return this.value; } \/\/ \u0418\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e };<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432 stringItem \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 stringItem.\u00a0<\/p>\n<h4>Conditional \u0438 mapped \u0442\u0438\u043f\u044b \u2013 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432 \u0442\u0438\u043f\u0430\u0445?\u00a0<\/h4>\n<p>\u0412 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0438 \u0435\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u2013 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043a\u043d\u043e\u043f\u043a\u0438 \u0438 \u0441\u0435\u043b\u0435\u043a\u0442\u0430:<\/p>\n<pre><code class=\"typescript\">interface IComponent { \u00a0id: number \u00a0label: string }  interface IButton extends IComponent { \u00a0color: string; }  interface ISelect extends IComponent { \u00a0options: Array&lt;string&gt; }<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f <em>extends<\/em>: \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 IButton \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u043e\u0432\u043e\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 color (\u043a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u043f\u043e\u043a\u0440\u0430\u0441\u043a\u0438 \u043a\u043d\u043e\u043f\u043e\u0447\u0435\u043a). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0435\u043b\u0435\u043a\u0442\u0430 ISelect \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 IComponent \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0435\u043c options. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u043b\u044f \u043d\u0438\u0445, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b:<\/p>\n<pre><code class=\"typescript\">type ComponentType&lt;T&gt; = T extends IButton ? \"Button\" : T extends ISelect ? \"Select\" : \"Unknown Component\";  type ButtonType = ComponentType&lt;IButton&gt;;\u00a0 \/\/ \"Button\" type SelectType = ComponentType&lt;ISelect&gt;;\u00a0 \u00a0 \/\/ \"Select\" type ComponentTypeUnknown = ComponentType&lt;IComponent&gt;; \/\/ \"Unknown Component\"<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c <em>extends<\/em> \u043a\u0430\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:\u00a0<\/p>\n<pre><code class=\"typescript\">if (\u0443\u0441\u043b\u043e\u0432\u0438\u0435) { \u00a0\u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f } else { \u00a0\u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f }  \/\/ \u0438\u043b\u0438  \u0443\u0441\u043b\u043e\u0432\u0438\u0435 ? \u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f : \u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f<\/code><\/pre>\n<p>\u0422\u0438\u043f ComponentType \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u2013 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f T \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043e\u0442 \u0442\u0438\u043f\u0430 TButton? \u0415\u0441\u043b\u0438 \u0434\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u201cButton\u201d, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043b\u044f \u0442\u0438\u043f\u0430 ISelect. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0442\u0438\u043f T \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043e\u0442 TSelect, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u201cUnknown Component\u201d \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u0418\u0442\u043e\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0430, \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u043d\u0430\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f. \u0427\u0442\u043e\u0431\u044b \u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u2013 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432\u044b\u0448\u0435.\u00a0<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <strong>mapped types.<\/strong><\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438, \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f\/\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e. \u0417\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>mapped types<\/em> (\u043f\u043e-\u0440\u0443\u0441\u0441\u043a\u0438 \u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u043e\u0432). \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>in<\/em> \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <em>keyof<\/em>:<\/p>\n<pre><code class=\"typescript\">type NullProperty&lt;T&gt; = { \u00a0[Property in keyof T]: T[Property] | null }  type TComponentNullProperty = NullProperty&lt;IComponent&gt;  \/\/ type TComponentNullProperty = { \/\/ \u00a0 \u00a0 id: number | null; \/\/ \u00a0 \u00a0 label: string | null; \/\/ }<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>keyof<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0439 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u201cid\u201d | \u201clabel\u201d), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <em>in<\/em>. \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u043c\u043e\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043a\u043b\u044e\u0447 \u0432 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f (<em>T[Property]<\/em>). \u0418 \u0432\u0441\u0435! \u0414\u0430\u043b\u044c\u0448\u0435 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2013 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 nullable.\u00a0<\/p>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u044c, <em>keyof<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 union. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u043b\u0435\u0439, \u043f\u0440\u0438\u0447\u0435\u043c \u0442\u0430\u043a \u0436\u0435 \u0432 \u0432\u0438\u0434\u0435 <em>union<\/em>:<\/p>\n<pre><code class=\"typescript\">type TComponentKeys = keyof IComponent \/\/ TComponentKeys = \"id\" | \"label\"  type TComponentKeyTypes = IComponent[TComponentKeys] \/\/ type TComponentKeyTypes = string | number<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0434\u043b\u044f mapped types \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, readonly \u0438 ?), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u201c-\u201d \u0438\u043b\u0438 \u201c+\u201d:<\/p>\n<pre><code class=\"typescript\">interface ICheckbox extends IComponent { \u00a0checked: boolean \u00a0required?: boolean }  type CustomRequired&lt;T&gt; = { \u00a0[K in keyof T] -?: T[K] }  type TCheckboxRequired = CustomRequired&lt;ICheckbox&gt;  \/\/ type ICheckboxRequired = { \/\/ \u00a0 checked: boolean; \/\/ \u00a0 required: boolean; \/\/ \u00a0 id: number; \/\/ \u00a0 label: string; \/\/ }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 required, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u201c-\u201d \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u201c?\u201d, \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f TCheckboxRequired, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0441\u0442\u0430\u043b\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<pre><code class=\"typescript\">type MandatoryProperties&lt;T&gt; = { \u00a0\u00a0\u00a0[K in keyof T]-?: undefined extends T[K] ? never : K }[keyof T];  type CheckboxMandatoryProps = MandatoryProperties&lt;ICheckbox&gt;; \/\/ type CheckboxMandatoryProps = \"checked\" | \"id\" | \"label\"<\/code><\/pre>\n<ul>\n<li>\n<p>\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>never<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u043f\u043e\u043b\u044f;<\/p>\n<\/li>\n<li>\n<p><em>undefined extends T[K]<\/em> \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043b\u0438 \u0442\u0438\u043f <em>undefined<\/em> \u0441\u0440\u0435\u0434\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>extends<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <em>never<\/em>, \u0435\u0441\u043b\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f, \u0438 \u0441\u0430\u043c \u043a\u043b\u044e\u0447 (\u0438\u043c\u044f \u043f\u043e\u043b\u044f, \u043d\u0435 \u0442\u0438\u043f) \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u042d\u0442\u043e\u0442 \u0442\u0440\u044e\u043a \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0448\u0430\u0433\u0430;\u00a0<\/p>\n<\/li>\n<li>\n<p><em>[keyof T]<\/em> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c union \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u043b\u0435\u0439, \u043d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u0442\u0438\u043f\u044b, \u0430 \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u0435\u0439, \u0442\u043e \u0432\u0435\u0440\u043d\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e <em>union<\/em> \u0438\u043c\u0435\u043d <strong>\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445<\/strong> \u043f\u043e\u043b\u0435\u0439 (never \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0435\u0442).\u00a0<\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<h4>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e infer \u2013 \u0437\u0430\u0434\u0430\u0447\u043a\u0430 \u0441\u043e \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u043e\u0439<\/h4>\n<p>\u0414\u043b\u044f \u0447\u0435\u0433\u043e \u043d\u0443\u0436\u0435\u043d <em>infer<\/em>? \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u201c\u0432\u044b\u0432\u0435\u0441\u0442\u0438\u201d \u0438\u043b\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0438\u043f \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>infer<\/em> \u0432 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u0430\u0445, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u201c\u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c\u201d \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0442\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.\u00a0<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u043c CustomReturnType:<\/p>\n<pre><code class=\"typescript\">type CustomReturnType&lt;T&gt; = T extends (...args: any[]) =&gt; infer R ? R : any;  type StringType = ReturnType&lt;() =&gt; string | string[]&gt; \/\/ type StringType = string | string[]  type AnyType = ReturnType&lt;() =&gt; any&gt; \/\/ type AnyType = any<\/code><\/pre>\n<ul>\n<li>\n<p>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 T \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d \u0442\u0438\u043f, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0442\u0438\u043f any;<\/p>\n<\/li>\n<li>\n<p><em>infer<\/em> \u0441\u0442\u043e\u0438\u0442 \u043f\u0435\u0440\u0435\u0434 R \u2013 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f R \u0438 \u0437\u0430\u043d\u043e\u0441\u0438\u0442 \u0435\u0433\u043e \u0432 \u0442\u0443 \u0436\u0435 \u201c\u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e\u201d (\u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0442\u0435\u043f\u0435\u0440\u044c \u201c\u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f\u201d R).<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 <em>infer<\/em> \u043a\u0430\u043a \u0431\u044b \u201c\u0434\u043e\u0431\u044b\u0432\u0430\u0435\u0442\u201d \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0438\u043f\u0430.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">type ReverseType&lt;T&gt; = T extends ${infer R}${infer K} ? ${ReverseType&lt;K&gt;}${R} : T  type ReversePasswordType = ReverseType&lt;'qwerty123'&gt; \/\/ '321ytrewq' type ReverseHelloType = ReverseType&lt;'\u043f\u0440\u0438\u0432\u0435\u0442'&gt; \/\/ '\u0442\u0435\u0432\u0438\u0440\u043f'<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u0443\u0436\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0438\u043f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e (\u201c\u0432\u044b\u0437\u043e\u0432 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f\u201d). \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u044d\u0442\u0430\u043f\u043d\u043e, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044f \u043d\u0430 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0437\u0430\u043d\u043e\u0441\u0438\u0442 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b, \u0432\u043e \u0432\u0442\u043e\u0440\u0443\u044e \u2013 \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 (R \u0438 K \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e):<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type ReverseTypeTrainee&lt;T&gt; = T extends ${infer R}${infer K} ? ${R}.${K} : T  type ReverseTypeTraineeExample = ReverseTypeTrainee&lt;'qwerty123'&gt; \/\/ 'q.werty123'<\/code><\/pre>\n<ul>\n<li>\n<p>\u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438 (\u0438 \u0443\u0431\u0435\u0440\u0435\u043c \u0442\u043e\u0447\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0434\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438):<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type ReverseTypeTrainee&lt;T&gt; = T extends ${infer R}${infer K} ? ${K}${R} : T  type ReverseTypeTraineeExample = ReverseTypeTrainee&lt;'qwerty123'&gt; \/\/ 'werty123q'<\/code><\/pre>\n<ul>\n<li>\n<p>\u0434\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0443\u0436\u043d\u043e \u201c\u043f\u0440\u043e\u0432\u0435\u0440\u043d\u0443\u0442\u044c\u201d \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0439\u0441\u044f \u0447\u0430\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c <em>${R}${K}<\/em> \u043d\u0430\u00a0 <em>${ReverseType&lt;R&gt;}${K}<\/em> \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c infer \u0438 \u0434\u0432\u0438\u043d\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435 \u2013 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f <em>spread<\/em> \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>infer<\/em>:<\/p>\n<pre><code class=\"typescript\">type Last&lt;T extends any[]&gt; = T extends [...args: any, infer L] ? L : never  type LastQWERTY = Last&lt;['q', 'w', 'e', 'r', 't', 'y']&gt; \/\/ type LastQWERTY = \"y\"<\/code><\/pre>\n<h4>Type inference \u2013 \u043e\u043d \u0443\u043c\u043d\u044b\u0439, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u043e \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442<\/h4>\n<p>\u042f\u0437\u044b\u043a TS \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 (\u201c\u043b\u0443\u0447\u0448\u0438\u0439 \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f\u201d), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">const password = ['q', 'w', 'e', 'r', 't', 'y', 1, 2, 3] \/\/ const password: (string | number)[]<\/code><\/pre>\n<p>\u041d\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u043c\u0435\u044e\u0442 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441-\u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u0430, \u043d\u043e \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439:<\/p>\n<pre><code class=\"typescript\">\/\/ \u0441\u043c. \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b IButton \u0438 ISelect \u0432\u044b\u0448\u0435 const button: IButton = { \u00a0id: 1, \u00a0label: '\u041a\u043d\u043e\u043f\u043a\u0430', \u00a0color: 'blue' }  const select: ISelect = { \u00a0id: 2, \u00a0label: '\u0421\u0435\u043b\u0435\u043a\u0442', \u00a0options: ['\u041f\u0435\u0440\u0432\u044b\u0439', '\u0412\u0442\u043e\u0440\u043e\u0439', '\u0420\u0430\u0441\u0447\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0435\u043d'] }  const components = [button, select]; \/\/ const components: (IButton | ISelect)[]<\/code><\/pre>\n<p>\u0421\u0440\u0435\u0434\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 components \u043d\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>IComponent<\/em>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0441\u043f\u0438\u0441\u043a\u0430 \u2013 \u043c\u0430\u0441\u0441\u0438\u0432 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0438\u043f\u043e\u0432 <em>IButton<\/em> \u0438 <em>ISelect<\/em>. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <em>IComponent<\/em>:<\/p>\n<pre><code class=\"typescript\">const unknownComponent: IComponent = { \u00a0id: 777, \u00a0label: '\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442' }  const components = [button, select, unknownComponent]; \/\/ const components: IComponent[]<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u2013 <em>IComponent<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u0435\u0434\u0435\u043d (<em>inferred<\/em>) \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437 <em>unknownComponent<\/em>. \u041d\u043e \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0442\u0438\u043f \u043c\u0430\u0441\u0441\u0438\u0432\u0443 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"typescript\">const components: IComponent[] = [button, select]; \/\/ const components: IComponent[] \/\/ \u043a\u0442\u043e \u0431\u044b \u043c\u043e\u0433 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c...<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, Typescript \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0442\u0438\u043f\u044b \u043a \u0441\u0432\u043e\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u0430 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0441\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u044f\u0432\u043d\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u0442\u043e\u0433\u0434\u0430 TS \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u0436\u0435 \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u0435, \u0431\u0435\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0438\u043f\u0430 (<em>type inference<\/em>).\u00a0<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c TS \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u0438 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c (\u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c, \u0438 \u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443), \u0438 \u043a \u0446\u0438\u043a\u043b\u0430\u043c \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">\/\/ \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f type inference const components = [button, select];  for (let component of components) { \u00a0console.log(component.id) }<\/code><\/pre>\n<h4>Type guards \u2013 \u0411\u0423! \u0418\u0441\u043f\u0443\u0433\u0430\u043b\u0441\u044f? \u041d\u0435 \u0431\u043e\u0439\u0441\u044f, \u044f \u0442\u0435\u0431\u044f \u0437\u0430\u0449\u0438\u0449\u0443!<\/h4>\n<p>\u042f\u0437\u044b\u043a TypeScript, \u043a\u0430\u043a \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u0438\u043f\u044b \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u044f\u0432\u043d\u043e \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u0438\u043f\u0430\u0445 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439.<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0433\u043e \u043d\u0430\u043c <strong>typeof<\/strong>, \u043e\u0431\u044b\u0447\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u043a \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443 (number, string, boolean, object \u0438 \u0442.\u0434.). \u0422\u0430\u043a\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <strong>Type Narrowing<\/strong>. \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 border-\u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u043e\u043c, \u0442\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u043e\u0439. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0447\u0438\u0441\u043b\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">interface IButton extends IComponent {\u00a0 \u00a0border: string }  const button: IButton = { \u00a0id: 1, \u00a0label: '\u041a\u043d\u043e\u043f\u043a\u0430', \u00a0border: '1px' }  const setBorder = (border: string | number) =&gt; { \u00a0\/\/ \u0435\u0441\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u0430, \u0442\u043e \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0430\u043a \u0435\u0441\u0442\u044c \u00a0if (typeof border === 'string') { \u00a0\u00a0\u00a0button.border = border \u00a0\u00a0\u00a0return \u00a0}  \u00a0\/\/ \u0435\u0441\u043b\u0438 \u0447\u0438\u0441\u043b\u043e, \u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443 css \u00a0\/\/ \u0434\u0430\u043d\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0442\u043a TS \u0431\u0443\u0434\u0435\u0442 \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e number, \u043d\u0435 string \u00a0if (typeof border === 'number') { \u00a0\u00a0\u00a0button.border = ${border}px \u00a0} }  setBorder('2px') console.log(button.border) \/\/ \u20182px\u2019  setBorder(5) console.log(button.border) \/\/ \u20185px\u2019<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u0432\u0435\u0434\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u2013 <strong>instanceof, <\/strong>\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043a \u0442\u0438\u043f\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u043c. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0438 \u0432\u0432\u0435\u0434\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432, \u043a\u043d\u043e\u043f\u043e\u043a \u0438 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0432:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">\/\/ \u0432\u0435\u0440\u043d\u0435\u043c \u043f\u043e\u043b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 interface IButton extends IComponent { \u00a0color: string }  class Component implements IComponent { \u00a0constructor(public id: number, public label: string) {} }  class Button extends Component implements IButton { \u00a0constructor(id: number, label: string, public color: string) { \u00a0\u00a0\u00a0super(id, label); \u00a0} }  class Select extends Component implements ISelect { \u00a0constructor(id: number, label: string, public options: Array&lt;string&gt;) { \u00a0\u00a0\u00a0super(id, label); \u00a0} }<\/code><\/pre>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>extends<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (\u043f\u043e\u0447\u0442\u0438 \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432), <em>implements<\/em> \u2013 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043f\u043e\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441\u0442\u0430\u043d\u0443\u0442 <em>public<\/em> \u043f\u043e\u043b\u044f\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430. \u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <em>constructor<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439, \u0430 <em>super<\/em> \u2013 \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0443 \u043a\u043b\u0430\u0441\u0441\u0430 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f. \u041d\u043e \u044d\u0442\u043e \u0435\u0441\u043b\u0438 \u0432\u043a\u0440\u0430\u0442\u0446\u0435, \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u0432\u044b\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u043c \u0432 TypeScript \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<pre><code class=\"typescript\">function describeComponent(component: Component) { \u00a0\/\/ \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Button, \u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0446\u0432\u0435\u0442 \u00a0if (component instanceof Button) { \u00a0\u00a0\u00a0console.log(\u042d\u0442\u043e \u043a\u043d\u043e\u043f\u043a\u0430, \u0446\u0432\u0435\u0442: ${component.color}); \u00a0\/\/ \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 Select, \u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u0433\u043e \u043e\u043f\u0446\u0438\u0439 \u00a0} else if (component instanceof Select) { \u00a0\u00a0\u00a0console.log(\u042d\u0442\u043e \u0441\u0435\u043b\u0435\u043a\u0442 \u0441 \u043e\u043f\u0446\u0438\u044f\u043c\u0438: ${component.options.join(\", \")}); \u00a0} }  const components: Component[] = [ \u00a0new Button(1, \"\u041a\u043d\u043e\u043f\u043a\u0430 1\", \"\u041a\u0440\u0430\u0441\u043d\u044b\u0439\"), \u00a0new Select(2, \"\u0421\u0435\u043b\u0435\u043a\u0442 1\", [\"\u041f\u0435\u0440\u0432\u044b\u0439\", \"\u0412\u0442\u043e\u0440\u043e\u0439\", \"\u0420\u0430\u0441\u0447\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0435\u043d!\"]), ];  components.forEach(describeComponent); \/\/ \"\u042d\u0442\u043e \u043a\u043d\u043e\u043f\u043a\u0430, \u0446\u0432\u0435\u0442: \u041a\u0440\u0430\u0441\u043d\u044b\u0439\" \/\/ \"\u042d\u0442\u043e \u0441\u0435\u043b\u0435\u043a\u0442 \u0441 \u043e\u043f\u0446\u0438\u044f\u043c\u0438: \u041f\u0435\u0440\u0432\u044b\u0439, \u0412\u0442\u043e\u0440\u043e\u0439, \u0420\u0430\u0441\u0447\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0435\u043d!\"<\/code><\/pre>\n<ul>\n<li>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u044b (\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0432\u043d\u044b\u0435 true\/false) \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <strong>is, <\/strong>\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u0432 \u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0443\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 Button:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">class Component implements IComponent { \u00a0constructor(public id: number, public label: string) {} }  class Button extends Component implements IButton { \u00a0constructor(id: number, label: string, public color: string) { \u00a0\u00a0\u00a0super(id, label); \u00a0} }  function isButton(component: Component): component is Button { \u00a0return component instanceof Button; }  console.log(isButton(new Button(1, \"\u041a\u043d\u043e\u043f\u043a\u0430 1\", \"\u041a\u0440\u0430\u0441\u043d\u044b\u0439\"))) \/\/ true<\/code><\/pre>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0432 \u0445\u043e\u0434\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u0442\u043e \u0435\u0433\u043e \u0442\u0438\u043f \u0441\u0442\u0430\u043d\u0435\u0442 <em>never<\/em>:<\/p>\n<pre><code class=\"typescript\">function resetComponent(component: Button | Select) {   if (component instanceof Button) {     \/\/ Button     component.color = '#FFFFFF'   } else if (component instanceof Select) {     \/\/ Select     component.options = []   } else {     \/\/ never     console.log('\u0422\u0438\u043f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d', typeof component)   } }<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u0441 <em>is<\/em> \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 JavaScript:<\/p>\n<pre><code class=\"typescript\">function isSelect(component: Component): component is Select { \u00a0return Array.isArray((component as Select).options) }  console.log(isSelect(new Select(2, \"\u0421\u0435\u043b\u0435\u043a\u0442 1\", [\"\u041f\u0435\u0440\u0432\u044b\u0439\", \"\u0412\u0442\u043e\u0440\u043e\u0439\", \"\u0420\u0430\u0441\u0447\u0435\u0442 \u043e\u043a\u043e\u043d\u0447\u0435\u043d!\"]))) \/\/ true<\/code><\/pre>\n<h4>Type Utils \u2013 \u043f\u0438\u0448\u0435\u043c \u0441\u0432\u043e\u0438 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0431\u0435\u0437 \u0433\u043e\u043b\u043e\u0432\u043d\u043e\u0439 \u0431\u043e\u043b\u0438<\/h4>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0441\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u044f\u0437\u044b\u043a\u0430 TS, \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 Type Utils \u2013 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0432 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Pick, Omit \u0438\u043b\u0438 Partial. \u041d\u043e, \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u043f\u0440\u0438\u044f\u0442\u043d\u0435\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0430\u0440\u044b \u0442\u0430\u043a\u0438\u0445 \u0443\u0442\u0438\u043b\u0438\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u044b \u0432\u044b\u0448\u0435.<\/p>\n<ul>\n<li>\n<p><strong>Pick<\/strong> \u2013 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0432 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0438\u043f, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u043f\u043e\u043b\u044f (T), \u0432\u0442\u043e\u0440\u044b\u043c \u2013 \u0441\u043f\u0438\u0441\u043e\u043a (\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435, union) \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f (K).<\/p>\n<\/li>\n<li>\n<p>\u0411\u0443\u0434\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u0435\u0439 \u2013 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0435\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430:<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type CustomPick&lt;T, K extends keyof T&gt; = \u2026<\/code><\/pre>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a union K \u0443\u0436\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d, \u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f K \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Mapped Types \u0438 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 T, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 T[Key]:<\/p>\n<pre><code class=\"typescript\">type CustomPick&lt;T, K extends keyof T&gt; = { [Key in K]: T[Key] }  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c:  type TButton = { \u00a0id: number, \u00a0label: string, \u00a0color: string, }  type TButtonWithoutColor = CustomPick&lt;TButton, 'id' | 'label'&gt; \/\/ type TButtonWithoutColor = { \/\/ \u00a0 id: number; \/\/ \u00a0 label: string; \/\/ }<\/code><\/pre>\n<ul>\n<li>\n<p><strong>Omit<\/strong> \u2013 \u0442\u0438\u043f-\u0443\u0442\u0438\u043b\u0438\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0438\u0437 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u0435\u0439. \u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0448\u0435\u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e\u043c\u0443 Pick.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e, \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c TypeScript 4.1 \u0432\u0435\u0440\u0441\u0438\u0438 \u2013 \u0440\u0435\u043c\u0430\u043f\u043f\u0438\u043d\u0433 (<em>remapping<\/em>) \u043a\u043b\u044e\u0447\u0435\u0439. \u041e\u0431\u044b\u0447\u043d\u043e \u043e\u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Mapped Types \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u0438 \u043a\u043b\u044e\u0447\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <em>as<\/em>:<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type CustomOmit&lt;T, K extends keyof T&gt; = { [Key in keyof T as Key]: T[Key] }  type TButtonOmitColor = CustomOmit&lt;TButton, 'color'&gt;  const buttonOmitColor: TButtonOmitColor = { id: 1, label: '\u041a\u043d\u043e\u043f\u043a\u0430' } \/\/ Property 'color' is missing in type '{ id: number; label: string; }' but required in type 'CustomOmit&lt;TButton, \"color\"&gt;'<\/code><\/pre>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0430\u0448\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0443\u0432\u0438\u0434\u0435\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0440\u0435\u043c\u0430\u043f\u043f\u0438\u043d\u0433\u0430 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438.<\/p>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0443\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u043b\u044f: \u0435\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 K, \u0442\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0438\u043c never \u0432\u043c\u0435\u0441\u0442\u043e \u043a\u043b\u044e\u0447\u0430. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2013 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043a\u043b\u044e\u0447 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0432\u0438\u0434\u0435. \u0417\u0430\u0447\u0435\u043c? \u041a\u043b\u044e\u0447\u0438 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c never \u0432 \u0442\u0438\u043f \u043d\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442, \u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0444\u0438\u043b\u044c\u0442\u0440:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type CustomOmit&lt;T, K extends keyof T&gt; = { [Key in keyof T as Key extends K ? never : Key]: T[Key] }  type TButtonOmitColor = CustomOmit&lt;TButton, 'color'&gt;  const buttonOmitColor: TButtonOmitColor = { id: 1, label: '\u041a\u043d\u043e\u043f\u043a\u0430' } \/\/ \u0433\u043e\u0442\u043e\u0432\u043e!<\/code><\/pre>\n<ul>\n<li>\n<p><strong>Partial<\/strong> \u2013 \u0442\u0438\u043f-\u0443\u0442\u0438\u043b\u0438\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0441\u0435 \u043f\u043e\u043b\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u2013 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Mapped Types \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043a\u043b\u044e\u0447\u0435\u0439 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 ? \u0434\u043b\u044f \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u044f:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type CustomPartial&lt;T&gt; = { [Key in keyof T]?: T[Key] }  type TButtonPartial = CustomPartial&lt;TButton&gt;  \/\/ \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u043b\u044f - \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u0432\u0441\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b const buttonEmpty: TButtonPartial = { id: 0 }<\/code><\/pre>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u2013 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <strong>PartialByKeys<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u0438\u0441\u044c \u0432\u044b\u0448\u0435:<\/p>\n<ul>\n<li>\n<p>\u0412\u0441\u043a\u043e\u043b\u044c\u0437\u044c \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type IntersectionType = { field1: string } &amp; { field2?: string }  \/\/ \u0437\u0434\u0435\u0441\u044c field2 \u0435\u0441\u0442\u044c... const intersectedFields: IntersectionType = { field1: '\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 1', field2: '\u041d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 2' }  \/\/ ... \u0430 \u0442\u0443\u0442 \u0435\u0433\u043e \u043d\u0435\u0442, \u0442\u0430\u043a \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e :) const intersectedFieldsSequel: IntersectionType = { field1: '\u041e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 1' }<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <em>&amp;<\/em>.<\/p>\n<ul>\n<li>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438, \u0430 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0441\u0442\u0430\u043d\u0443\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c 2 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u043a \u043d\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u043a\u043e\u0434 \u043d\u0438\u0436\u0435, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <strong>Omit<\/strong>, \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0448\u0438\u0445 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043e\u043a \u0432\u044b\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0437\u0434\u0435\u0441\u044c.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type TButton = { \u00a0id: number, \u00a0label: string, \u00a0color: string, }  type CustomPartialByKeys&lt;T, K extends keyof T&gt; = { \u00a0[Key in keyof T as Key extends K ? Key : never]?: T[Key] } &amp; { \u00a0[Key in keyof T as Key extends K ? never : Key]: T[Key] }  type TButtonPartialByKeys = CustomPartialByKeys&lt;TButton, 'label' | 'color'&gt;  const buttonPartial: TButtonPartialByKeys = { id: 0, label: '\u041a\u043d\u043e\u043f\u043a\u0430' }<\/code><\/pre>\n<p>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e: \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0438\u043f \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u0438\u0437 K, \u0432\u0442\u043e\u0440\u043e\u0439 \u2013 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 (\u044d\u0442\u043e \u0436\u0435 Omit!). \u0418\u0442\u043e\u0433 \u2013 label \u0438 color \u0441\u0442\u0430\u043b\u0438 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438, \u0447\u0442\u043e \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c.<\/p>\n<h4>\u0427\u0442\u043e \u0436\u0435 \u043f\u043e \u0438\u0442\u043e\u0433\u0443?<\/h4>\n<p>\u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 TypeScript, \u043d\u043e \u0438\u0445 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0449\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u042d\u0442\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u201c\u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u043c\u0438\u201d, \u0438 \u043c\u044b, \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u041d\u041b\u041c\u041a-\u0418\u0422, \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u0441\u0432\u043e\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.\u00a0<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438 \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0444\u0438\u0448\u043a\u0430\u0445 TypeScript, \u0447\u0442\u043e \u0434\u0443\u043c\u0430\u0435\u0442\u0435? \u0414\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0432\u043e\u0438\u043c\u0438 \u043a\u0435\u0439\u0441\u0430\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 Typescript \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0441, \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \ud83d\ude42<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/893270\/\"> https:\/\/habr.com\/ru\/articles\/893270\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>TypeScript \u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u0438-\u043f\u0430\u0437\u043b\u044b<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0430\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u00ab\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u0434\u00bb? \u0412 \u041d\u041b\u041c\u041a \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u0443\u043b\u0443\u0447\u0448\u0430\u044e\u0442\u0441\u044f, \u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0430\u0434 \u043d\u0438\u043c\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u043e\u043f\u044b\u0442\u043e\u043c, \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u043c\u0438 \u0438 \u0432\u0438\u0434\u0435\u043d\u0438\u0435\u043c. \u0412 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 JavaScript \u0438 \u0440\u0430\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0436\u0438\u0437\u043d\u0438, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0432\u0432\u0438\u0434\u0443 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0435\u0433\u043e \u201c\u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u0435\u0439\u201d.\u00a0<\/p>\n<p>\u0414\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0430\u043c\u043e\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u043c \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445, \u043d\u043e \u044d\u0442\u043e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0432 \u0432\u0430\u043a\u0443\u0443\u043c\u0435, \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0430\u044f\u0441\u044f \u043a \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u044f\u0437\u044b\u043a\u0430 TypeScript \u2013 \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u043d\u0432\u0435\u0441\u0442\u0438\u0446\u0438\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u0435: \u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u0433\u0443\u044e \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u0432 JavaScript \u2013 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e\u043d\u044f\u0442\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0435\u0440\u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u0443\u0447\u0438\u0442\u044c \u0434\u0436\u0443\u043d\u043e\u0432 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0438\u0441\u0442\u044b\u0439 \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0435\u0437 \u00ab\u043a\u043e\u0441\u0442\u044b\u043b\u0435\u0439\u00bb.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430 TypeScript, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0433\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430\u043c \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a TypeScript \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u044b \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u0438\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u043f\u0443\u0442\u044c \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043c\u0438\u043d\u0443\u0441\u044b \u0438 \u043f\u043b\u044e\u0441\u044b Typescript<\/h4>\n<p>Typescript \u2013 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u044f\u0437\u044b\u043a\u0430 Javascript. \u041a\u043e\u0434, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Typescript (\u0434\u0430\u043b\u0435\u0435 &#8212; TS), \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 JS, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u043b\u044e\u0431\u044b\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b. \u0412\u0441\u0435 \u0444\u0438\u0448\u043a\u0438, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 JS \u2013 \u0443\u0436\u0435 \u0438\u0434\u0443\u0442 \u0432 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0441 TS. \u0422\u0443\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>\u0412\u0430\u0436\u043d\u043e\u0435 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435 &#8212; \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u201c0 == \u20180\u2019\u201d \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0422\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u041e\u041e\u041f \u2013 \u0442\u0438\u043f\u044b, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043b\u0430\u0441\u0441\u044b, \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b, \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u0441 \u044d\u0442\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.\u00a0<\/p>\n<p>\u0418\u0437 \u043c\u0438\u043d\u0443\u0441\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0432\u0445\u043e\u0434\u0430, \u043d\u0435\u0436\u0435\u043b\u0438 \u0432 JS, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u043c\u0438\u043c\u043e \u043e\u0441\u043d\u043e\u0432 \u044f\u0437\u044b\u043a\u0430 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u041e\u041e\u041f, \u0432\u0440\u0435\u043c\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0432 JS (\u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0438\u043d\u0443\u0441) \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2013 \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u043b\u0438 \u043d\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0433\u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044d\u0442\u0438 \u043c\u0438\u043d\u0443\u0441\u044b \u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u044e\u0442.<\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u044b &#8212; \u0442\u0438\u043f\u044b, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u201c\u0437\u0432\u0435\u0440\u0438\u201d<\/h4>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f TS, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f (enum) \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430-\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443: \u043f\u043e \u0446\u0432\u0435\u0442\u0443, \u043f\u043e \u0442\u0438\u043f\u0443 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435 \u2013 \u0442\u0430\u043a\u043e\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u044e\u0431\u044b\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c HTML-\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u0432 \u0444\u043e\u0440\u043c\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">enum Component {\u00a0 \u00a0BUTTON, \u00a0INPUT, \u00a0CHECKBOX, \u00a0SELECT }<\/code><\/pre>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u043b\u043b\u0435\u0433\u0438: <a href=\"https:\/\/habr.com\/ru\/companies\/nlmk\/articles\/770974\/\">https:\/\/habr.com\/ru\/companies\/nlmk\/articles\/770974\/<\/a><\/p>\n<ul>\n<li>\n<p>\u0422\u0438\u043f\u044b (type) \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0435-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0442\u0438\u043f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u043c \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 TS (number \u0438\u043b\u0438 string, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440), \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0438\u043f \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0438:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type Button = {\u00a0 \u00a0id: number, \u00a0label: string, \u00a0color: string, }<\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u0442\u0438\u043f \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u201c\u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f\u201d \u043d\u0430 \u043d\u0435\u0433\u043e, \u043a\u0430\u043a \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435.<\/p>\n<ul>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b (interface) \u2013 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u201c\u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430\u201d \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0438\u043f\u0430 Button \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">interface Button {\u00a0 \u00a0id: number; \u00a0label: string; \u00a0color: string; }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u043e\u043c \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430, \u043e\u0431\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437 \u0446\u0435\u043b\u0435\u0439 \u0438 \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.\u00a0<\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 (\u043c\u043e\u0436\u043d\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043e\u0434\u043d\u0438\u043c \u0438 \u0442\u0435\u043c \u0436\u0435 \u0438\u043c\u0435\u043d\u0435\u043c, \u0438 TS \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0438\u0445 \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0439), \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 (\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438 \u043f\u043e\u043b\u0435\u0439) \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.\u00a0<\/p>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 type \u0434\u043b\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0438 \u043a\u043e\u0440\u0442\u0435\u0436\u0438, \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f, \u0438 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u043f\u043e \u0442\u0438\u043f\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043e\u0431\u0435\u0438\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u043c. \u0418\u043d\u043e\u0433\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0435: \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u2013 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c\u044b\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0437\u0430 \u0441\u0447\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0435\u043c\u044b \u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043a \u0441\u043b\u043e\u0436\u043d\u043e\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u044f\u0442 \u0432\u0430\u0441 \u0432 \u0433\u0443\u0440\u0443 \u044f\u0437\u044b\u043a\u0430 Typescript. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c!<\/p>\n<h4>\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b keyof \u0438 typeof \u2013 \u201c\u043a\u043e\u043f\u0430\u0435\u043c\u0441\u044f\u201d \u0432 \u043e\u0441\u043d\u043e\u0432\u0430\u0445<\/h4>\n<ul>\n<li>\n<p><strong>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 keyof<\/strong> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u0438\u043b\u0438 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0435\u0433\u043e \u043a\u043b\u044e\u0447\u0435\u0439 (\u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e key \u043d\u0430 \u044d\u0442\u043e \u043d\u0430\u043c\u0435\u043a\u0430\u0435\u0442). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043d\u0430\u0448 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 type Button \u0432\u044b\u0448\u0435:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">type Button = { \u00a0id: number, \u00a0label: string, \u00a0color: string, }  type TButton = keyof Button \/\/ type TButton = \u2018id\u2019 | \u2018label\u2019 | \u2018color\u2019 const buttonKey: TButton = 'label';<\/code><\/pre>\n<p>\u041c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 buttonKey \u0434\u043e 3\u0445 &#8212; \u043a\u043b\u044e\u0447\u0435\u0439 \u0442\u0438\u043f\u0430 Button. \u041f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c \u0435\u0439 \u0447\u0442\u043e-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<ul>\n<li>\n<p><strong>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 typeof<\/strong> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043b\u0438\u0431\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">const button = 'buttonValue' type TString = typeof button  const newButton: TString = 'newButtonValue'<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0435\u043d \u0438\u0437-\u0437\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043a\u0430\u043a \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f: \u043e\u043d \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 TS \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0438\u043f \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0441 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0438 \u043a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2013 TString \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f string, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c, \u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f buttonValue. \u0418\u0441\u043f\u0440\u0430\u0432\u0438\u043c:<\/p>\n<pre><code class=\"typescript\">let button = 'buttonValue' type TString = typeof button  const newButton: TString = 'newButtonValue' \/\/ \u0412\u0430\u0448\u0435 \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043d\u043e\u043f\u043a\u0438 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e!<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c TString \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043e\u0431\u0449\u0438\u0439 \u0442\u0438\u043f string, \u043d\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u043a \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0447\u0435\u0440\u0435\u0437 const. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 const \u043c\u043e\u0436\u043d\u043e \u201c\u043e\u0431\u043e\u0439\u0442\u0438\u201d \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0447\u0435\u0440\u0435\u0437 \u044f\u0432\u043d\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439:<\/p>\n<pre><code class=\"typescript\">const button: string = 'buttonValue' type TString = typeof button  const newButton: TString = 'newButtonValue'<\/code><\/pre>\n<ul>\n<li>\n<p><strong>\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 (Generic Types)<\/strong> \u2013 \u044d\u0442\u043e \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b. \u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (\u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044e) \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u042d\u0442\u043e \u0441\u0432\u043e\u0435\u043e\u0431\u0440\u0430\u0437\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0440\u0430\u0437\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c-\u0442\u0438\u043f\u043e\u043c. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"typescript\">function print(value: string) {\u00a0 \u00a0console.log(value) }  print('hello') print(2025)<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0439\u0434\u0435\u0442 \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u044b\u043b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d \u0434\u043e string. \u0414\u0430, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f any, \u043d\u043e \u044d\u0442\u043e \u043f\u043b\u043e\u0445\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u0438\u043f\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0443\u0442\u0435\u0440\u044f\u043d. \u0412\u0434\u0440\u0443\u0433 \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0441 \u043d\u0435\u0439 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0442\u0435\u043c \u0436\u0435 \u0442\u0438\u043f\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"typescript\">function printAndReturn(value: any): any { \u00a0console.log(value) \u00a0return String(value) }  printAndReturn('hello') printAndReturn(2025)<\/code><\/pre>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043a \u0441\u0442\u0440\u043e\u043a\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 value, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c\u044b\u0439 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0442\u0438\u043f\u044b \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442. \u0412\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u043c:<\/p>\n<pre><code class=\"typescript\">function printAndReturn&lt;T&gt;(value: T): T { \u00a0console.log(value) \u00a0return String(value) \/\/ Type 'string' is not assignable to type 'T' }  printAndReturn('hello') printAndReturn(2025)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u043a\u0443\u0441 \u0441 \u201c\u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0439\u201d \u0441\u043c\u0435\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u0442: \u043d\u0443\u0436\u043d\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u0442\u0435\u043c \u0436\u0435 \u0442\u0438\u043f\u043e\u043c, \u0447\u0442\u043e \u0438 \u0431\u044b\u043b \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 value. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430:<\/p>\n<pre><code class=\"typescript\">interface ValueWithGeneric&lt;T&gt; { \u00a0\u00a0\u00a0value: T; \u00a0\u00a0\u00a0getValue: () =&gt; T; }  const stringItem: ValueWithGeneric&lt;string&gt; = { \u00a0\u00a0\u00a0value: \"Hello\", \u00a0\u00a0\u00a0getValue: function() { return this.value; } \/\/ \u0418\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e };<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432 stringItem \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 stringItem.\u00a0<\/p>\n<h4>Conditional \u0438 mapped \u0442\u0438\u043f\u044b \u2013 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0431\u043e\u0440 \u0432 \u0442\u0438\u043f\u0430\u0445?\u00a0<\/h4>\n<p>\u0412 \u043e\u0431\u044b\u0447\u043d\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0431\u044b\u043b\u0438 \u0438 \u0435\u0441\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u2013 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044e. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432 \u043a\u043d\u043e\u043f\u043a\u0438 \u0438 \u0441\u0435\u043b\u0435\u043a\u0442\u0430:<\/p>\n<pre><code class=\"typescript\">interface IComponent { \u00a0id: number \u00a0label: string }  interface IButton extends IComponent { \u00a0color: string; }  interface ISelect extends IComponent { \u00a0options: Array&lt;string&gt; }<\/code><\/pre>\n<p>\u041c\u044b \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f <em>extends<\/em>: \u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 IButton \u043f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u043e\u0432\u043e\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 color (\u043a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u043f\u043e\u043a\u0440\u0430\u0441\u043a\u0438 \u043a\u043d\u043e\u043f\u043e\u0447\u0435\u043a). \u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0435\u043b\u0435\u043a\u0442\u0430 ISelect \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 IComponent \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0435\u043c options. \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0434\u043b\u044f \u043d\u0438\u0445, \u0447\u0442\u043e\u0431\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0438\u0445 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b:<\/p>\n<pre><code class=\"typescript\">type ComponentType&lt;T&gt; = T extends IButton ? \"Button\" : T extends ISelect ? \"Select\" : \"Unknown Component\";  type ButtonType = ComponentType&lt;IButton&gt;;\u00a0 \/\/ \"Button\" type SelectType = ComponentType&lt;ISelect&gt;;\u00a0 \u00a0 \/\/ \"Select\" type ComponentTypeUnknown = ComponentType&lt;IComponent&gt;; \/\/ \"Unknown Component\"<\/code><\/pre>\n<p>\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c <em>extends<\/em> \u043a\u0430\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0432 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u044f\u0437\u044b\u043a\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:\u00a0<\/p>\n<pre><code class=\"typescript\">if (\u0443\u0441\u043b\u043e\u0432\u0438\u0435) { \u00a0\u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f } else { \u00a0\u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f }  \/\/ \u0438\u043b\u0438  \u0443\u0441\u043b\u043e\u0432\u0438\u0435 ? \u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f : \u0442\u0435\u043b\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f<\/code><\/pre>\n<p>\u0422\u0438\u043f ComponentType \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u2013 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f T \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043e\u0442 \u0442\u0438\u043f\u0430 TButton? \u0415\u0441\u043b\u0438 \u0434\u0430, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u201cButton\u201d, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0434\u043b\u044f \u0442\u0438\u043f\u0430 ISelect. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0442\u0438\u043f T \u0442\u0430\u043a \u0436\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u043c \u043e\u0442 TSelect, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u201cUnknown Component\u201d \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f. \u0418\u0442\u043e\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0430, \u0437\u0430\u043d\u0435\u0441\u0435\u043d\u043d\u0430\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f. \u0427\u0442\u043e\u0431\u044b \u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u2013 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d \u0432\u044b\u0448\u0435.\u00a0<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c <strong>mapped types.<\/strong><\/p>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u0440\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438\u043b\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438, \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u0443 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f\/\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e. \u0417\u0434\u0435\u0441\u044c \u0438 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>mapped <\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-463096","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=463096"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/463096\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=463096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=463096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=463096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}