{"id":361871,"date":"2024-05-21T01:22:50","date_gmt":"2024-05-21T01:22:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=361871"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=361871","title":{"rendered":"<span>TypeScript: \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 Union \u0438 Intersection \u0432 \u0441\u0432\u0435\u0442\u0435 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/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<blockquote>\n<p><em>\u2014\u00a0\u0422\u043e\u043d\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f,\u00a0\u2014 \u0441\u043b\u0430\u0431\u044b\u043c \u0433\u043e\u043b\u043e\u0441\u043e\u043c \u0441\u043a\u0430\u0437\u0430\u043b \u0411\u0443\u0448,\u00a0\u2014 \u043a\u0430\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f, \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0432\u0441\u0435\u043c\u043e\u0433\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0438 \u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0432\u0441\u0435\u0431\u043b\u0430\u0433\u043e\u0441\u0442\u044c.<br \/>\u2014\u00a0\u0418 \u043a\u0430\u043a \u0442\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u0435\u043c\u0443, \u043e \u0414\u0436\u043e\u0440\u0434\u0436\u0430\u0439\u044f?\u00a0\u2014 \u0432\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u044f.<br \/>\u2014\u00a0\u042f \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u2026 \u042f \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u0413\u043e\u0441\u043f\u043e\u0434\u0438, \u0447\u0442\u043e \u0438\u0437 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\u0435\u0441 \u0442\u043a\u0443\u0442 \u0441\u0432\u043e\u044e \u0441\u0435\u0442\u044c \u0444\u0430\u0440\u0438\u0441\u0435\u0438, \u0430 \u0438\u0441\u0442\u0438\u043d\u0430 \u0414\u0443\u0445\u0430 \u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u043b\u0438\u0448\u044c \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435. \u0418 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435 \u0435\u0435 \u043d\u0435\u0442.<\/em><\/p>\n<p>\u0412. \u041f\u0435\u043b\u0435\u0432\u0438\u043d, &#171;\u0411\u043e\u0433\u0438 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b&#187;<\/p>\n<\/blockquote>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441 &#171;\u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432 TypeScript \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u043a\u0430\u043a \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442?&#187;  <\/p>\n<p>\u041e\u0437\u0430\u0434\u0430\u0447\u0438\u043b\u0441\u044f, \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u0438 \u0441\u0442\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f, \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 &#171;\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435&#187; \u0438 &#171;\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435&#187; \u0432 TypeScript \u0438 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432? \u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432 TypeScript \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e?<\/p>\n<h2>\u0412\u0432\u043e\u0434\u043d\u044b\u0435<\/h2>\n<ol>\n<li>\n<p>\u0412 TypeScript \u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 &#171;<a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/typescript-in-5-minutes-func.html#unions\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/a>&#187; (Union, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <strong>I<\/strong>) \u0438 &#171;<a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/typescript-in-5-minutes-func.html#intersections\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435<\/a>&#187; (Intersection, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <strong>&amp;<\/strong>), \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c:<\/p>\n<ol>\n<li>\n<p>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f <strong>\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442<\/strong> \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043d\u043e\u0432\u043e\u043c\u0443 \u0442\u0438\u043f\u0443,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f <strong>\u0441\u0443\u0436\u0430\u0435\u0442<\/strong> \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043d\u043e\u0432\u043e\u043c\u0443 \u0442\u0438\u043f\u0443<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 &#171;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9E%D0%B1%D1%8A%D0%B5%D0%B4%D0%B8%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BC%D0%BD%D0%BE%D0%B6%D0%B5%D1%81%D1%82%D0%B2\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/a>&#187; \u0438 &#171;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D0%B5%D1%80%D0%B5%D1%81%D0%B5%D1%87%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BC%D0%BD%D0%BE%D0%B6%D0%B5%D1%81%D1%82%D0%B2\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435<\/a>&#171;:<\/p>\n<ol>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 &#8212; \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 (\u0438\u043d\u0430\u0447\u0435 &#8212; <strong>\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0435<\/strong> \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e): <br \/><code>A = {1, 2}, B = {2, 3}, \u0442\u043e\u0433\u0434\u0430 A \u222a B = {1, 2, 3} <\/code><\/p>\n<\/li>\n<li>\n<p> \u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0432\u0441\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c (\u0438\u043d\u0430\u0447\u0435 &#8212; <strong>\u0441\u0443\u0436\u0435\u043d\u043d\u043e\u0435<\/strong> \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e): <br \/><code>A = {1, 2}, B = {2, 3}, \u0442\u043e\u0433\u0434\u0430 A \u2229 B = {2}<\/code><\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/09b\/61f\/d1e\/09b61fd1ec950a10a22806d9d192983b.jpg\" width=\"3297\" height=\"1204\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/09b\/61f\/d1e\/09b61fd1ec950a10a22806d9d192983b.jpg\" data-blurred=\"true\"\/><\/figure>\n<h2>\u0423\u0441\u043f\u0435\u0445 \u0441 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c<\/h2>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f &#171;\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435&#187; \u0438 \u0442\u0430\u043c \u0438 \u0442\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0430 \u0435\u0451 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043b\u0438\u0431\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u0441\u0440\u0430\u0437\u0443. <\/p>\n<p><strong>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432:<\/strong><\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"typescript\">type IPrimitiveSetA = 1 | 2; type IPrimitiveSetB = 2 | 3;  type IUnionPrimitive = IPrimitiveSetA | IPrimitiveSetB;   \/\/ \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionPrimitiveOk1: IUnionPrimitive = 1; const unionPrimitiveOk2: IUnionPrimitive = 2; const unionPrimitiveOk3: IUnionPrimitive = 3; \/\/ \u043e\u0448\u0438\u0431\u043a\u0430 TS \u043f\u0430\u0434\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0442 \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0442\u0438\u043f\u0435 const unionPrimitiveErr: IUnionPrimitive = 4;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><strong>\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"typescript\">type IObjectSetA = {     a: number;     b: number;     isValid: boolean; }; type IObjectSetB = {     x: number;     y: number;     isValid: boolean; }; type IUnionObject = IObjectSetA | IObjectSetB;   \/\/ \u043f\u043e\u043b\u044f \u0438\u0437 \u043e\u0431\u043e\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectAll: IUnionObject = {     a: 1,     b: 2,     x: 3,     y: 4,     isValid: true }; \/\/ \u043f\u043e\u043b\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0438\u043f\u0430 \u0410 - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectA: IUnionObject = {     a: 1,     b: 2,     isValid: true }; \/\/ \u043f\u043e\u043b\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0438\u043f\u0430 B - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectB: IUnionObject = {     a: 1,     b: 2,     isValid: true }; \/\/ \u0432\u0441\u0451 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438 \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectAB: IUnionObject = {     a: 1,     b: 2,     x: 3,     isValid: true }; \/\/ \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e - \u043e\u0448\u0438\u0431\u043a\u0430 const unionObjectErr: IUnionObject = {     a: 1,     x: 3 };<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c<\/h2>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <strong>\u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b<\/strong>. \u0421 \u043d\u0438\u043c\u0438 \u0432\u0441\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u043f\u043e\u043f\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0432 \u043e\u0431\u043e\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0432\u043e\u0439\u043a\u0430. \u0412\u0441\u0451 \u043a\u0430\u043a \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<pre><code class=\"typescript\">type ISetLiteralA = 1 | 2; type ISetPrimitiveB = 2 | 3;  type IIntersectionPrimitive = ISetPrimitiveA &amp; ISetPrimitiveB;   \/\/ \u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, 1 \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 (Type '1' is not assignable to type '2') const intersectionPrimitive1: IIntersectionPrimitive = 1;  \/\/ \u043e\u0448\u0431\u0438\u043a\u0438 \u043d\u0435\u0442, 2 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0431\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 const intersectionPrimitive2: IIntersectionPrimitive = 2;<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/8f8\/943\/94c\/8f894394c187d22797ea025f65ce5212.jpg\" width=\"1629\" height=\"1020\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f8\/943\/94c\/8f894394c187d22797ea025f65ce5212.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c <strong>\u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/strong>. <\/p>\n<p>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u0442\u0435\u043e\u0440\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, <strong>\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u0449\u0435\u0435 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u043b\u0435<\/strong> isValid. \u041d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 <strong>\u0432\u0441\u0435 \u043f\u043e\u043b\u044f<\/strong> <strong>\u0438\u0437 \u0432\u0441\u0435\u0445<\/strong> \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. <\/p>\n<pre><code class=\"typescript\">type ISetObjectA = {     a: number;     b: number;     isValid: boolean; }; type ISetObjectB = {     x: number;     y: number;     isValid: boolean; };  type IIntersectionObject = ISetObjectA &amp; ISetObjectB;  \/\/ \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 const intersectionObj:IIntersectionObject = {     a: 1,     b: 2,     x: 3,     y: 4,     isValid: true }<\/code><\/pre>\n<blockquote>\n<p>intersected\u00a0<code>Colorful<\/code>\u00a0and\u00a0<code>Circle<\/code>\u00a0to produce a <strong>new type that has all the members<\/strong> of\u00a0<code>Colorful<\/code>\u00a0<em>and<\/em>\u00a0<code>Circle<\/code>  &#8212; \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0446\u0438\u0442\u0430\u0442\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f, \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e &#171;\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0430 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0443 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u043e&#187;. \u041d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0436\u0435 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435\u043c?<\/p>\n<h2>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c<\/h2>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0435\u0449\u0435 \u0440\u0430\u0437 \u043a\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0441\u0443\u0436\u0430\u0435\u0442 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u0442\u0438\u043f\u043e\u043c \u0441\u0442\u0430\u043b <br \/><code>type IIntersectionObject = { isValid: boolean; }<\/code>, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043b\u0435,<br \/> \u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0442\u0438\u043f, \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u044b \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 <code>ISetObjectA<\/code> \u0438  <code>ISetObjectB<\/code><\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0443\u0436\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0448\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0438\u043f\u0430  <code>IIntersectionObject<\/code> \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u0430\u043c <code>ISetObjectA<\/code> \u0438  <code>ISetObjectB.<\/code> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0442\u0438\u043f\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0442\u0438\u043f\u0435 \u043d\u0430\u0434\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0435 \u043a\u0430\u043a \u043e \u0441\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0430 \u043a\u0430\u043a \u043e \u0441\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u0443.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/63b\/e16\/91b\/63be1691b45ce48565c22d77dbcb73ac.jpg\" width=\"2997\" height=\"1667\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/63b\/e16\/91b\/63be1691b45ce48565c22d77dbcb73ac.jpg\" data-blurred=\"true\"\/><\/figure>\n<p>\u041f\u043e\u0431\u0435\u0434\u0430? \u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c&#8230; \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c\u0438, \u0447\u0438\u0441\u043b\u043e 2 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u043e \u0438 \u043f\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u0439, \u0438 \u043f\u043e\u0434 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0438\u043f. \u0410 \u0432\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>IIntersectionObject<\/code> \u043d\u0438 \u043f\u043e\u0434 \u043e\u0434\u0438\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0435\u0441\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u043e\u043b\u044f. \u041a\u0430\u043a \u0431\u044b\u0442\u044c \u0441 \u044d\u0442\u0438\u043c?<\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0432 TS<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">type FnObjArg = { n: number };  const fn = (data: FnObjArg): number => {     return data.n; } const arg = {n: 1, m: 2} as const;  \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442 - \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e const res1 = fn(arg); \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0437\u0434\u0430\u0432 \u0435\u0433\u043e \u043d\u0430 \u043c\u0435\u0441\u0442\u0435,  \/\/ \u0438 \u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 TS: 'm' does not exist in type 'FnObjArg' const res2 = fn( { n: 1, m: 2} );<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 TS, \u043a\u0430\u043a <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/objects.html#excess-property-checks\" rel=\"noopener noreferrer nofollow\">Excess Property Checks<\/a>. \u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445 &#8212; \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0447\u0435\u043c \u0435\u0441\u0442\u044c \u0432 \u0442\u0438\u043f\u0435, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c &#8212; \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u043f\u0430\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<pre><code class=\"typescript\">type FnObjArg = { n: number, m: number };  const fn = (data: FnObjArg): number =>  data.n + data.m;  \/\/ \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u0438 \u044f\u0432\u043d\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 \/\/ Object literal may only specify known properties, and 'p' does not exist in type 'FnObjArg' const arg1:FnObjArg = {n: 1, p: 2};  \/\/ \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 const arg2 = {n: 1}; \/\/ Property 'm' is missing in type '{ n: number; }' but required in type 'FnObjArg' fn(arg2);<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0448\u0435\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c\u0443 \u0442\u0438\u043f\u0443, \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c, \u0442.\u043a. TS &#171;\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0433\u043b\u0430\u0437\u0430&#187; \u043d\u0430 \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u043e\u043b\u044f, \u043b\u0438\u0448\u044c \u0431\u044b \u0431\u044b\u043b\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/ad6\/3a4\/518\/ad63a4518c49be49b1f9cdef9265ef15.jpg\" width=\"4207\" height=\"2555\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad6\/3a4\/518\/ad63a4518c49be49b1f9cdef9265ef15.jpg\" data-blurred=\"true\"\/><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f &#171;\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435&#187; \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u0441 TypeScript, \u0432 \u0447\u0435\u043c \u043c\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0414\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u043c\u0435\u043b\u044c\u043a\u043e\u043c \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f &#171;<a href=\"https:\/\/habr.com\/ru\/articles\/713800\/\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u043d\u044f\u0442\u044c TypeScript c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/a>&#187; (\u0433\u043b\u0430\u0432\u0430 &#171;\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432&#187;), \u0432 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u043c stackoverflow \u0435\u0441\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u0442\u0435\u043c\u0435 &#171;\u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432 TS \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432&#187;. \u0414\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u0433 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0432\u0432\u0451\u043b \u0432 \u0441\u0442\u0443\u043f\u043e\u0440, \u0442\u0430\u043a \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043a \u0442\u0435\u043c\u0435 \u0435\u0441\u0442\u044c.<\/p>\n<p><strong>P.S.<\/strong> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 Union \u0438 Intersection \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%94%D0%B8%D0%B7%D1%8A%D1%8E%D0%BD%D0%BA%D1%86%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0437\u044a\u044e\u043d\u043a\u0446\u0438\u044e<\/a> \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BD%D1%8A%D1%8E%D0%BD%D0%BA%D1%86%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u044a\u044e\u043d\u043a\u0446\u0438\u044e<\/a> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<\/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\/778060\/\"> https:\/\/habr.com\/ru\/articles\/778060\/<\/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<blockquote>\n<p><em>\u2014\u00a0\u0422\u043e\u043d\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f,\u00a0\u2014 \u0441\u043b\u0430\u0431\u044b\u043c \u0433\u043e\u043b\u043e\u0441\u043e\u043c \u0441\u043a\u0430\u0437\u0430\u043b \u0411\u0443\u0448,\u00a0\u2014 \u043a\u0430\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f, \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0432\u0441\u0435\u043c\u043e\u0433\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0438 \u0431\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0432\u0441\u0435\u0431\u043b\u0430\u0433\u043e\u0441\u0442\u044c.<br \/>\u2014\u00a0\u0418 \u043a\u0430\u043a \u0442\u044b \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u0435\u043c\u0443, \u043e \u0414\u0436\u043e\u0440\u0434\u0436\u0430\u0439\u044f?\u00a0\u2014 \u0432\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u044f.<br \/>\u2014\u00a0\u042f \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u2026 \u042f \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u0413\u043e\u0441\u043f\u043e\u0434\u0438, \u0447\u0442\u043e \u0438\u0437 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\u0435\u0441 \u0442\u043a\u0443\u0442 \u0441\u0432\u043e\u044e \u0441\u0435\u0442\u044c \u0444\u0430\u0440\u0438\u0441\u0435\u0438, \u0430 \u0438\u0441\u0442\u0438\u043d\u0430 \u0414\u0443\u0445\u0430 \u043e\u0431\u0438\u0442\u0430\u0435\u0442 \u043b\u0438\u0448\u044c \u0432 \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u0435. \u0418 \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0435 \u0435\u0435 \u043d\u0435\u0442.<\/em><\/p>\n<p>\u0412. \u041f\u0435\u043b\u0435\u0432\u0438\u043d, &#171;\u0411\u043e\u0433\u0438 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b&#187;<\/p>\n<\/blockquote>\n<p>\u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043c\u043d\u0435 \u0437\u0430\u0434\u0430\u043b\u0438 \u0432\u043e\u043f\u0440\u043e\u0441 &#171;\u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432 TypeScript \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u043a\u0430\u043a \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u0430 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442?&#187;  <\/p>\n<p>\u041e\u0437\u0430\u0434\u0430\u0447\u0438\u043b\u0441\u044f, \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u0438 \u0441\u0442\u0430\u043b \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f, \u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 &#171;\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435&#187; \u0438 &#171;\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435&#187; \u0432 TypeScript \u0438 \u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432? \u0418 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432 TypeScript \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e?<\/p>\n<h2>\u0412\u0432\u043e\u0434\u043d\u044b\u0435<\/h2>\n<ol>\n<li>\n<p>\u0412 TypeScript \u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 &#171;<a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/typescript-in-5-minutes-func.html#unions\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/a>&#187; (Union, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <strong>I<\/strong>) \u0438 &#171;<a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/typescript-in-5-minutes-func.html#intersections\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435<\/a>&#187; (Intersection, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a <strong>&amp;<\/strong>), \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c:<\/p>\n<ol>\n<li>\n<p>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f <strong>\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442<\/strong> \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043d\u043e\u0432\u043e\u043c\u0443 \u0442\u0438\u043f\u0443,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f <strong>\u0441\u0443\u0436\u0430\u0435\u0442<\/strong> \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u043d\u043e\u0432\u043e\u043c\u0443 \u0442\u0438\u043f\u0443<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u0412 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 &#171;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9E%D0%B1%D1%8A%D0%B5%D0%B4%D0%B8%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BC%D0%BD%D0%BE%D0%B6%D0%B5%D1%81%D1%82%D0%B2\" rel=\"noopener noreferrer nofollow\">\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/a>&#187; \u0438 &#171;<a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9F%D0%B5%D1%80%D0%B5%D1%81%D0%B5%D1%87%D0%B5%D0%BD%D0%B8%D0%B5_%D0%BC%D0%BD%D0%BE%D0%B6%D0%B5%D1%81%D1%82%D0%B2\" rel=\"noopener noreferrer nofollow\">\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435<\/a>&#171;:<\/p>\n<ol>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 &#8212; \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 (\u0438\u043d\u0430\u0447\u0435 &#8212; <strong>\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0435<\/strong> \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e): <br \/><code>A = {1, 2}, B = {2, 3}, \u0442\u043e\u0433\u0434\u0430 A \u222a B = {1, 2, 3} <\/code><\/p>\n<\/li>\n<li>\n<p> \u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 &#8212; \u044d\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u0432\u0441\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c (\u0438\u043d\u0430\u0447\u0435 &#8212; <strong>\u0441\u0443\u0436\u0435\u043d\u043d\u043e\u0435<\/strong> \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e): <br \/><code>A = {1, 2}, B = {2, 3}, \u0442\u043e\u0433\u0434\u0430 A \u2229 B = {2}<\/code><\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0423\u0441\u043f\u0435\u0445 \u0441 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c<\/h2>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f &#171;\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435&#187; \u0438 \u0442\u0430\u043c \u0438 \u0442\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u043d\u0430 \u0435\u0451 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0438\u043f\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043b\u044e\u0431\u043e\u0433\u043e \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043b\u0438\u0431\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u0441\u0440\u0430\u0437\u0443. <\/p>\n<p><strong>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043e\u0432:<\/strong><\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"typescript\">type IPrimitiveSetA = 1 | 2; type IPrimitiveSetB = 2 | 3;  type IUnionPrimitive = IPrimitiveSetA | IPrimitiveSetB;   \/\/ \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionPrimitiveOk1: IUnionPrimitive = 1; const unionPrimitiveOk2: IUnionPrimitive = 2; const unionPrimitiveOk3: IUnionPrimitive = 3; \/\/ \u043e\u0448\u0438\u0431\u043a\u0430 TS \u043f\u0430\u0434\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0442 \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0442\u0438\u043f\u0435 const unionPrimitiveErr: IUnionPrimitive = 4;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p><strong>\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"typescript\">type IObjectSetA = {     a: number;     b: number;     isValid: boolean; }; type IObjectSetB = {     x: number;     y: number;     isValid: boolean; }; type IUnionObject = IObjectSetA | IObjectSetB;   \/\/ \u043f\u043e\u043b\u044f \u0438\u0437 \u043e\u0431\u043e\u0438\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectAll: IUnionObject = {     a: 1,     b: 2,     x: 3,     y: 4,     isValid: true }; \/\/ \u043f\u043e\u043b\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0438\u043f\u0430 \u0410 - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectA: IUnionObject = {     a: 1,     b: 2,     isValid: true }; \/\/ \u043f\u043e\u043b\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0442\u0438\u043f\u0430 B - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectB: IUnionObject = {     a: 1,     b: 2,     isValid: true }; \/\/ \u0432\u0441\u0451 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438 \u0447\u0430\u0441\u0442\u044c \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e - \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442 const unionObjectAB: IUnionObject = {     a: 1,     b: 2,     x: 3,     isValid: true }; \/\/ \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e - \u043e\u0448\u0438\u0431\u043a\u0430 const unionObjectErr: IUnionObject = {     a: 1,     x: 3 };<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c<\/h2>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 <strong>\u0447\u0438\u0441\u043b\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b<\/strong>. \u0421 \u043d\u0438\u043c\u0438 \u0432\u0441\u0435 \u043e\u0442\u043b\u0438\u0447\u043d\u043e, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u043f\u043e\u043f\u0430\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0432 \u043e\u0431\u043e\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0432\u043e\u0439\u043a\u0430. \u0412\u0441\u0451 \u043a\u0430\u043a \u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<pre><code class=\"typescript\">type ISetLiteralA = 1 | 2; type ISetPrimitiveB = 2 | 3;  type IIntersectionPrimitive = ISetPrimitiveA &amp; ISetPrimitiveB;   \/\/ \u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430, 1 \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 (Type '1' is not assignable to type '2') const intersectionPrimitive1: IIntersectionPrimitive = 1;  \/\/ \u043e\u0448\u0431\u0438\u043a\u0438 \u043d\u0435\u0442, 2 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043e\u0431\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 const intersectionPrimitive2: IIntersectionPrimitive = 2;<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c <strong>\u043e\u0431\u044a\u0435\u043a\u0442\u044b<\/strong>. <\/p>\n<p>\u041e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044f\u0441\u044c \u043d\u0430 \u0442\u0435\u043e\u0440\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442, <strong>\u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043e\u0431\u0449\u0435\u0435 \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u043b\u0435<\/strong> isValid. \u041d\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0432 \u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0432 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0432\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0434 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 <strong>\u0432\u0441\u0435 \u043f\u043e\u043b\u044f<\/strong> <strong>\u0438\u0437 \u0432\u0441\u0435\u0445<\/strong> \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. <\/p>\n<pre><code class=\"typescript\">type ISetObjectA = {     a: number;     b: number;     isValid: boolean; }; type ISetObjectB = {     x: number;     y: number;     isValid: boolean; };  type IIntersectionObject = ISetObjectA &amp; ISetObjectB;  \/\/ \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 const intersectionObj:IIntersectionObject = {     a: 1,     b: 2,     x: 3,     y: 4,     isValid: true }<\/code><\/pre>\n<blockquote>\n<p>intersected\u00a0<code>Colorful<\/code>\u00a0and\u00a0<code>Circle<\/code>\u00a0to produce a <strong>new type that has all the members<\/strong> of\u00a0<code>Colorful<\/code>\u00a0<em>and<\/em>\u00a0<code>Circle<\/code>  &#8212; \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0446\u0438\u0442\u0430\u0442\u0435 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c\u0441\u044f, \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e &#171;\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0430 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0443 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u043e&#187;. \u041d\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0436\u0435 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435\u043c?<\/p>\n<h2>\u0420\u0430\u0437\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0441 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c<\/h2>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0435\u0449\u0435 \u0440\u0430\u0437 \u043a\u0430\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0440\u0435\u0448\u0430\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f:<\/p>\n<ol>\n<li>\n<p>\u0441\u0443\u0436\u0430\u0435\u0442 \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e,<\/p>\n<\/li>\n<li>\n<p>\u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c<\/p>\n<\/li>\n<\/ol>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u0431\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u0442\u0438\u043f\u043e\u043c \u0441\u0442\u0430\u043b <br \/><code>type IIntersectionObject = { isValid: boolean; }<\/code>, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0449\u0435\u0435 \u043f\u043e\u043b\u0435,<br \/> \u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0442\u0438\u043f, \u043d\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0431\u044b \u043d\u0438 \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 <code>ISetObjectA<\/code> \u0438  <code>ISetObjectB<\/code><\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u0430\u0434\u0430\u0447\u0430 \u0441\u0443\u0436\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0448\u0435\u043d\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0442\u0438\u043f\u0430  <code>IIntersectionObject<\/code> \u043d\u0435\u0441\u043e\u043c\u043d\u0435\u043d\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u0430\u043c <code>ISetObjectA<\/code> \u0438  <code>ISetObjectB.<\/code> \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0442\u0438\u043f\u0435 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>\u0424\u043e\u043a\u0443\u0441 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c \u0442\u0438\u043f\u0435 \u043d\u0430\u0434\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0435 \u043a\u0430\u043a \u043e \u0441\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0430 \u043a\u0430\u043a \u043e \u0441\u0443\u0436\u0435\u043d\u043d\u043e\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u0443.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0431\u0435\u0434\u0430? \u041d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c&#8230; \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c\u0438, \u0447\u0438\u0441\u043b\u043e 2 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u043b\u043e \u0438 \u043f\u043e\u0434 \u043f\u0435\u0440\u0432\u044b\u0439, \u0438 \u043f\u043e\u0434 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0438\u043f. \u0410 \u0432\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 <code>IIntersectionObject<\/code> \u043d\u0438 \u043f\u043e\u0434 \u043e\u0434\u0438\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0435\u0441\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u043e\u043b\u044f. \u041a\u0430\u043a \u0431\u044b\u0442\u044c \u0441 \u044d\u0442\u0438\u043c?<\/p>\n<h2>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0432 TS<\/h2>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"typescript\">type FnObjArg = { n: number };  const fn = (data: FnObjArg): number => {     return data.n; } const arg = {n: 1, m: 2} as const;  \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442 - \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e const res1 = fn(arg); \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u043e\u0442 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0437\u0434\u0430\u0432 \u0435\u0433\u043e \u043d\u0430 \u043c\u0435\u0441\u0442\u0435,  \/\/ \u0438 \u043f\u0430\u0434\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 TS: 'm' does not exist in type 'FnObjArg' const res2 = fn( { n: 1, m: 2} );<\/code><\/pre>\n<p>\u042d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a\u043e\u0439 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 TS, \u043a\u0430\u043a <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/objects.html#excess-property-checks\" rel=\"noopener noreferrer nofollow\">Excess Property Checks<\/a>. \u0412 \u0434\u0432\u0443\u0445 \u0441\u043b\u043e\u0432\u0430\u0445 &#8212; \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432, \u0447\u0435\u043c \u0435\u0441\u0442\u044c \u0432 \u0442\u0438\u043f\u0435, \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c &#8212; \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430. \u041e\u0448\u0438\u0431\u043a\u0430 \u0443\u043f\u0430\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<pre><code class=\"typescript\">type FnObjArg = { n: number, m: number };  const fn = (data: FnObjArg): number =>  data.n + data.m;  \/\/ \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043d\u0435\u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u0438 \u044f\u0432\u043d\u043e\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 \/\/ Object literal may only specify known properties, and 'p' does not exist in type 'FnObjArg' const arg1:FnObjArg = {n: 1, p: 2};  \/\/ \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0441 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 const arg2 = {n: 1}; \/\/ Property 'm' is missing in type '{ n: number; }' but required in type 'FnObjArg' fn(arg2);<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043d\u0430\u0448\u0435\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u043c\u0443 \u0442\u0438\u043f\u0443, \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c, \u0442.\u043a. TS &#171;\u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0433\u043b\u0430\u0437\u0430&#187; \u043d\u0430 \u043b\u0438\u0448\u043d\u0438\u0435 \u043f\u043e\u043b\u044f, \u043b\u0438\u0448\u044c \u0431\u044b \u0431\u044b\u043b\u0438 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435.<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f &#171;\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435&#187; \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u0443\u044e\u0442\u0441\u044f \u0441 TypeScript, \u0432 \u0447\u0435\u043c \u043c\u044b \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0414\u0430\u043d\u043d\u043e\u0439 \u0442\u0435\u043c\u044b \u043c\u0435\u043b\u044c\u043a\u043e\u043c \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f &#171;<a href=\"https:\/\/habr.com\/ru\/articles\/713800\/\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u043d\u044f\u0442\u044c TypeScript c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/a>&#187; (\u0433\u043b\u0430\u0432\u0430 &#171;\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432&#187;), \u0432 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u043c stackoverflow \u0435\u0441\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u0442\u0435\u043c\u0435 &#171;\u043f\u043e\u0447\u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0432 TS \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432&#187;. \u0414\u0430 \u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u043e\u043f\u044b\u0442\u043d\u044b\u0445 \u043a\u043e\u043b\u043b\u0435\u0433 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u0432\u0432\u0451\u043b \u0432 \u0441\u0442\u0443\u043f\u043e\u0440, \u0442\u0430\u043a \u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441 \u043a \u0442\u0435\u043c\u0435 \u0435\u0441\u0442\u044c.<\/p>\n<p><strong>P.S.<\/strong> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 Union \u0438 Intersection \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0443\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%94%D0%B8%D0%B7%D1%8A%D1%8E%D0%BD%D0%BA%D1%86%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">\u0434\u0438\u0437\u044a\u044e\u043d\u043a\u0446\u0438\u044e<\/a> \u0438 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%9A%D0%BE%D0%BD%D1%8A%D1%8E%D0%BD%D0%BA%D1%86%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u044a\u044e\u043d\u043a\u0446\u0438\u044e<\/a> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f.<\/p>\n<\/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\/778060\/\"> https:\/\/habr.com\/ru\/articles\/778060\/<\/a><br \/><\/br><\/br><\/p>\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-361871","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/361871","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=361871"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/361871\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=361871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=361871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=361871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}