{"id":338255,"date":"2022-09-12T15:00:21","date_gmt":"2022-09-12T15:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=338255"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=338255","title":{"rendered":"<span>TypeScript \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445. \u0427\u0430\u0441\u0442\u044c 2<\/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-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/um\/fe\/t_\/umfet_kngorlggfmgokzowwtsuu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/um\/fe\/t_\/umfet_kngorlggfmgokzowwtsuu.png\"\/>  <\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0434\u0440\u0443\u0437\u044c\u044f!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 <a href=\"https:\/\/medium.com\/@bytefer\/list\/mastering-typescript-series-688ee7c12807\">Mastering TypeScript<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e <a href=\"https:\/\/www.typescriptlang.org\/\">TypeScript<\/a>.<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/685954\/\">TypeScript \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445. \u0427\u0430\u0441\u0442\u044c 1<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/682748\/\">\u0417\u0430\u043c\u0435\u0442\u043a\u0430 \u043e Mapped Types \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e TypeScript<\/a><\/li>\n<li><a href=\"https:\/\/my-js.org\/docs\/guide\/ts\">\u041a\u0430\u0440\u043c\u0430\u043d\u043d\u0430\u044f \u043a\u043d\u0438\u0433\u0430 \u043f\u043e TypeScript<\/a><\/li>\n<li><a href=\"https:\/\/my-js.org\/docs\/cheatsheet\/ts\">\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u043f\u043e TypeScript<\/a><\/li>\n<\/ul>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"peresecheniya--intersection-types\">\u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \/ Intersection types<\/h2>\n<p>  <\/p>\n<p>\u0422\u0438\u043f \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e \u0438\u043b\u0438 \u043d\u0430\u0431\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0438\u043f <code>number<\/code> \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c (set) \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b. 1.0, 68 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0442 \u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443, \u0430 &#171;bytefer&#187; \u043d\u0435\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0438\u043f\u043e\u043c &#171;bytefer&#187; \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>string<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0422\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0438 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0438\u043f <code>Point<\/code> \u0432 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043d\u0438\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 <code>x<\/code> \u0438 <code>y<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430, \u0430 \u0442\u0438\u043f <code>Named<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <code>name<\/code>, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">interface Point {   x: number;   y: number; } interface Named {   name: string; }<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5d\/cg\/xu\/5dcgxuhbzfbk2hko1cxoeli8xc8.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/5d\/cg\/xu\/5dcgxuhbzfbk2hko1cxoeli8xc8.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 (set theory) \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043a\u0430\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 <code>A<\/code>, \u0442\u0430\u043a \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 <code>B<\/code>, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c (intersection) \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 <code>A<\/code> \u0438 <code>B<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/pd\/ly\/g6\/pdlyg6i2lc79x_otoyzgq8fcijc.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/pd\/ly\/g6\/pdlyg6i2lc79x_otoyzgq8fcijc.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 <code>Point<\/code> \u0438 <code>Named<\/code> \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f. \u041e\u0431\u044a\u0435\u043a\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043a\u0430\u043a <code>Point<\/code>, \u0442\u0430\u043a \u0438 <code>Named<\/code>.<\/p>\n<p>  <\/p>\n<p><code>TS<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>&amp;<\/code> \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c (intersection type).<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>&amp;<\/code>:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u044c (identity): \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <code>A &amp; A<\/code> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <code>A<\/code>;<\/li>\n<li>\u043a\u043e\u043c\u043c\u0443\u0442\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c (commutativity): <code>A &amp; B<\/code> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <code>B &amp; A<\/code> (\u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440 \u0432\u044b\u0437\u043e\u0432\u0430 \u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0441\u043c. \u043d\u0438\u0436\u0435);<\/li>\n<li>\u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u044c (associativity): <code>(A &amp; B) &amp; C<\/code> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <code>A &amp; (B &amp; C)<\/code>;<\/li>\n<li>\u043a\u043e\u043b\u043b\u0430\u043f\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u043f\u0435\u0440\u0442\u0438\u043f\u0430 (supertype collapsing): <code>A &amp; B<\/code> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e <code>A<\/code>, \u0435\u0441\u043b\u0438 <code>B<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0443\u043f\u0435\u0440\u0442\u0438\u043f\u043e\u043c <code>A<\/code>.<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/vb\/vw\/s7\/vbvws75kiorqidsrl1_87dingag.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/vb\/vw\/s7\/vbvws75kiorqidsrl1_87dingag.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0422\u0438\u043f\u044b <code>any<\/code> \u0438 <code>never<\/code> \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u044b\u043c\u0438. \u041d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0442\u0438\u043f\u0430 <code>never<\/code>, \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u043b\u044e\u0431\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0441 <code>any<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>any<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 <code>Point<\/code> \u0438 <code>Named<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ss\/82\/hf\/ss82hf1z90ejajabyxakwkcjnk0.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/ss\/82\/hf\/ss82hf1z90ejajabyxakwkcjnk0.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f <code>NamedPoint<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>x<\/code>, <code>y<\/code> \u0438 <code>name<\/code>. \u041d\u043e \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432?<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">interface X {   c: string;   d: string; }  interface Y {   c: number;   e: string }  type XY = X &amp; Y; type YX = Y &amp; X;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b <code>X<\/code> \u0438 <code>Y<\/code> \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>c<\/code>, \u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0438\u043c\u0435\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0442\u0438\u043f\u044b. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>c<\/code> \u0432 \u0442\u0438\u043f\u0430\u0445 <code>XY<\/code> \u0438 <code>YX<\/code> \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0438\u043b\u0438 \u0447\u0438\u0441\u043b\u043e\u043c?<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/32\/dl\/ud\/32dludrkllkmoc-4p75qugtglym.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/32\/dl\/ud\/32dludrkllkmoc-4p75qugtglym.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0438\u043f\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>c<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>never<\/code>? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>c<\/code> \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u0438 \u0447\u0438\u0441\u043b\u043e\u043c (<code>string &amp; number<\/code>). \u041d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0438\u043f\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <code>c<\/code> \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f <code>never<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043d\u0435\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438? \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/yp\/f5\/iq\/ypf5iqmk3rqokqyisr0ffetcblk.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/yp\/f5\/iq\/ypf5iqmk3rqokqyisr0ffetcblk.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0435\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u044b\u0448\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/me\/li\/2w\/meli2wxiabdapw2okk5fyvb3tog.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/me\/li\/2w\/meli2wxiabdapw2okk5fyvb3tog.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>f(1, \"bytefer\")<\/code> \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">No overload matches this call.   Overload 1 of 2, '(a: string, b: string): void', gave the following error.     Argument of type 'number' is not assignable to parameter of type 'string'.   Overload 2 of 2, '(a: number, b: number): void', gave the following error.     Argument of type 'string' is not assignable to parameter of type 'number'.<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 <code>TS<\/code> \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (function overloading) \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>F3<\/code> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u043e\u0439:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/zt\/qf\/dl\/ztqfdlx8jetn2qeefz93vwyvk_m.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/zt\/qf\/dl\/ztqfdlx8jetn2qeefz93vwyvk_m.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0438\u043f\u0430 (utility types). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>PartialByKeys<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0438\u043f\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/7d\/fs\/gq\/7dfsgq6q2ecnqj2ygdayx7pndeu.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/7d\/fs\/gq\/7dfsgq6q2ecnqj2ygdayx7pndeu.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>RequiredByKeys<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"infer\">infer<\/h2>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b, \u043a\u0430\u043a \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0442\u0438\u043f\u0430 <code>T0<\/code> \u0438\u043b\u0438 \u0442\u0438\u043f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0442\u0438\u043f\u0430 <code>T1<\/code>?<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type T0 = string[]; type T1 = () => string;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0445\u043d\u0438\u043a\u0443 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 (pattern matching), \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u0443\u044e <code>TS<\/code> \u2014 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 (conditional types) \u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>infer<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0442\u0438\u043f\u0430\u043c\u0438, \u0441 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432. <code>infer<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430, \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e (captured) \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0442\u0438\u043f\u0430 <code>T0<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type UnpackedArray&lt;T> = T extends (infer U)[] ? U : T; type U0 = UnpackedArray&lt;T0>; \/\/ string<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/re\/16\/jc\/re16jcb71gruytibivux3uiqjei.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/re\/16\/jc\/re16jcb71gruytibivux3uiqjei.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 <code>T extends (infer U)[] ? U : T<\/code> \u2014 \u044d\u0442\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0430 <code>infer U<\/code> \u2014 \u044d\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f (extends clause), \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f \u043d\u043e\u0432\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 <code>U<\/code> \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0433\u043e \u0438\u043b\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u043e\u0433\u043e (inferred) \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (execution flow) \u0443\u0442\u0438\u043b\u0438\u0442\u044b <code>UnpackedArray<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ge\/1_\/oj\/ge1_ojsimvnor7-v6w3csxyu52o.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/ge\/1_\/oj\/ge1_ojsimvnor7-v6w3csxyu52o.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/em>: <code>infer<\/code> \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c <code>infer<\/code>, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0435 (true branch) \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Wrong1&lt;T extends (infer U)[]> = T[0];      \/\/ Error type Wrong2&lt;T> = (infer U)[] extends T ? U : T; \/\/ Error type Wrong3&lt;T> = T extends (infer U)[] ? T : U; \/\/ Error<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/sp\/he\/tx\/sphetxei9qurira_kkxsdb-f38s.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/sp\/he\/tx\/sphetxei9qurira_kkxsdb-f38s.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0438\u043f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>T1<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type UnpackedFn&lt;T> = T extends (...args: any[]) => infer U ? U : T; type U1 = UnpackedFn&lt;T1>;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041b\u0435\u0433\u043a\u043e, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438?<\/p>\n<p>  <\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/em>: \u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, <code>TS<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u0432\u044b\u0437\u043e\u0432\u0430 (call signature) \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0438\u043f\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/c3\/8d\/kr\/c38dkrr76jqj7klfaxgckngi4kq.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/c3\/8d\/kr\/c38dkrr76jqj7klfaxgckngi4kq.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043c\u043e\u0449\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Unpacked&lt;T> =     T extends (infer U)[] ? U :     T extends (...args: any[]) => infer U ? U :     T extends Promise&lt;infer U> ? U :     T;  type T0 = Unpacked&lt;string>;                       \/\/ string type T1 = Unpacked&lt;string[]>;                     \/\/ string type T2 = Unpacked&lt;() => string>;                 \/\/ string type T3 = Unpacked&lt;Promise&lt;string>>;              \/\/ string type T4 = Unpacked&lt;Promise&lt;string>[]>;            \/\/ Promise&lt;string> type T5 = Unpacked&lt;Unpacked&lt;Promise&lt;string>[]>>;  \/\/ string<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/gl\/mv\/46\/glmv46oyygtivkfbjdjaef_kqcu.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/gl\/mv\/46\/glmv46oyygtivkfbjdjaef_kqcu.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <code>Unpacked<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0442\u0438\u043f\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0438 \u043f\u0440\u043e\u043c\u0438\u0441\u0430\u043c\u0438, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c \u0442\u0438\u043f\u0430\u043c \u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c \u0446\u0435\u043f\u043e\u0447\u043a\u0430\u043c.<\/p>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u043f \u043a\u043b\u044e\u0447\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<p>  <\/p>\n<pre><code class=\"javascript\">type User = {   id: number;   name: string; }  type PropertyType&lt;T> =  T extends { id: infer U, name: infer R } ? [U, R] : T; type U3 = PropertyType&lt;User>; \/\/ [number, string]<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fc\/fi\/m4\/fcfim4xdv6kobqkoamlscnjsbpi.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/fc\/fi\/m4\/fcfim4xdv6kobqkoamlscnjsbpi.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0432\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u0430: <code>U<\/code> \u0438 <code>R<\/code>, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>id<\/code> \u0438 <code>name<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041f\u0440\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u0440\u0442\u0435\u0436 (tuple).<\/p>\n<p>  <\/p>\n<p>\u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0442\u0438\u043f\u0430 <code>U<\/code>? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type PropertyType&lt;T> =  T extends { id: infer U, name: infer U } ? U : T;  type U4 = PropertyType&lt;User>; \/\/ string | number<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/sa\/ji\/7n\/saji7nlkhljmo8abiqn3mrty2y4.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/sa\/ji\/7n\/saji7nlkhljmo8abiqn3mrty2y4.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0442\u0438\u043f <code>U4<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 (union) \u0442\u0438\u043f\u043e\u0432 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0447\u0438\u0441\u043b\u0430. \u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u0430\u043d\u0434\u0438\u0434\u0430\u0442\u043e\u0432 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430 \u0432 \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 (covariant position), \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0432 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043d\u043e \u0432 \u043a\u043e\u043d\u0442\u0440\u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u043e\u0437\u0438\u0446\u0438\u0438 (contravariant position), \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c (intersection):<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Bar&lt;T> = T extends { a: (x: infer U) => void, b: (x: infer U) => void } ? U : never;  type U5 = Bar&lt;{ a: (x: string) => void, b: (x: number) => void }>;  \/\/ string &amp; number<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qv\/pv\/cc\/qvpvccnegh2ndhdy5k4hombrnli.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/qv\/pv\/cc\/qvpvccnegh2ndhdy5k4hombrnli.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0442\u0438\u043f <code>U5<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u0447\u0438\u0441\u043b\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u0442\u0438\u043f\u043e\u043c \u0431\u0443\u0434\u0435\u0442 <code>never<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u043c \u043d\u043e\u0432\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0443\u044e\u0441\u044f \u0432 <code>TS 4.7<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0438\u043f\u043e\u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u043c. \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type FirstIfString&lt;T> = T extends [infer S, ...unknown[]]   ? S extends string     ? S     : never   : never;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0442\u0438\u043f\u0430 <code>FirstIsString<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u0438 <code>infer<\/code>. \u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f <code>T<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0443\u0441\u0442\u044b\u043c \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u043c. \u0422\u0430\u043c \u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0438\u043f\u0430 <code>S<\/code> \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u043a\u043e\u0440\u0442\u0435\u0436\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <code>S<\/code> \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c (subtype) \u0441\u0442\u0440\u043e\u043a\u0438. \u0415\u0441\u043b\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <code>string<\/code>, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f <code>never<\/code>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/5n\/qt\/se\/5nqtsecrin27uhahelqt8zvenkq.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/5n\/qt\/se\/5nqtsecrin27uhahelqt8zvenkq.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <code>FirstIsString<\/code> \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439. \u041d\u043e \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430? <code>TS 4.7<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u044f\u0432\u043d\u044b\u0445 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 (explicit constraints) \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0442\u0438\u043f\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type FirstIfString&lt;T> =     T extends [infer S extends string, ...unknown[]]         ? S         : never;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0434\u043b\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type UnionToIntersection&lt;U> = (   U extends any ? (arg: U) => void : never ) extends (arg: infer R) => void   ? R   : never;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/yg\/2a\/ww\/yg2awwdxf2euiarvk3kywteanci.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/yg\/2a\/ww\/yg2awwdxf2euiarvk3kywteanci.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<h2 id=\"shablonnye-literalnye-tipy--template-literal-types\">\u0428\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \/ Template literal types<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043c\u044b \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b <code>Tooltip<\/code> \u0438\u043b\u0438 <code>Popover<\/code> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439. \u0414\u043b\u044f \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u044d\u0442\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>top<\/code>, <code>bottom<\/code>, <code>left<\/code>, <code>right<\/code> \u0438 \u0442.\u0434.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/-j\/56\/yd\/-j56ydbdmhnps6-bcfpk5-6akwk.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/-j\/56\/yd\/-j56ydbdmhnps6-bcfpk5-6akwk.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0442\u0438\u043f \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 (string literals) \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Side = 'top' | 'right' | 'bottom' | 'left';  const side: Side = \"rigth\"; \/\/ Error \/\/ Type '\"rigth\"' is not assignable to type 'Side'. \/\/ Did you mean '\"right\"'?<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u044d\u0442\u043e\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439? \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u043f\u0440\u0430\u0432\u043e\u043c \u0443\u0433\u043b\u0443?<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fk\/cr\/9n\/fkcr9njypynywne15tcbwvlirrw.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fk\/cr\/9n\/fkcr9njypynywne15tcbwvlirrw.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0442\u0438\u043f <code>Placement<\/code> \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <code>Side<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Placement = Side   | \"left-start\" | \"left-end\"   | \"right-start\" | \"right-end\"   | \"top-start\" | \"top-end\"   | \"bottom-start\" | \"bottom-end\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b, \u043d\u0435\u0442\u0440\u0443\u0434\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043e\u0434, \u0442\u0430\u043a\u043e\u0439 \u043a\u0430\u043a <code>-start<\/code> \u0438 <code>-end<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \u043b\u0435\u0433\u043a\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043e\u0447\u0435\u043f\u044f\u0442\u043a\u0443.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u043b\u0443\u0447\u0448\u0438\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438? \u0412 <code>TS 4.1<\/code> \u0431\u044b\u043b\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b (template literal types), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Alignment = 'start' | 'end'; type Side = 'top' | 'right' | 'bottom' | 'left'; type AlignedPlacement = `${Side}-${Alignment}`; type Placement = Side | AlignedPlacement;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 (template strings\/literals) \u0432 <code>JS<\/code>, \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0435 \u043a\u0430\u0432\u044b\u0447\u043a\u0438 (&#171;) \u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u0438 (placeholders) \u0432 \u0444\u043e\u0440\u043c\u0435 <code>${T}<\/code>. \u041f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c <code>string<\/code>, <code>number<\/code>, <code>boolean<\/code> \u0438\u043b\u0438 <code>bigint<\/code>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/is\/kb\/8w\/iskb8wmgwxxhn3gnkun6p8ikoio.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/is\/kb\/8w\/iskb8wmgwxxhn3gnkun6p8ikoio.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0428\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c (concatenate) \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b \u043d\u0435\u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b. \u0412\u043e\u0442 \u043f\u0430\u0440\u043e\u0447\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/nu\/m2\/ow\/num2owu1godigxkbpzs1kd6bv7i.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/nu\/m2\/ow\/num2owu1godigxkbpzs1kd6bv7i.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type EventName&lt;T extends string> = `${T}Changed`; type Concat&lt;S1 extends string, S2 extends string> = `${S1}-${S2}`; type ToString&lt;T extends string | number | boolean | bigint> = `${T}`;  type T0 = EventName&lt;\"foo\">; \/\/ 'fooChanged' type T1 = Concat&lt;\"Hello\", \"World\">; \/\/ 'Hello-World' type T2 = ToString&lt;\"bytefer\" | 666 | true | -1234n>; \/\/ \"bytefer\" | \"true\" | \"666\" | \"-1234\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441: \u043a\u0430\u043a\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0435\u0441\u043b\u0438 \u0442\u0438\u043f, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>EventName<\/code> \u0438\u043b\u0438 <code>Concat<\/code> \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/tq\/vs\/ni\/tqvsnisbvuaqiaacin05mcoyzfm.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/tq\/vs\/ni\/tqvsnisbvuaqiaacin05mcoyzfm.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type T3 = EventName&lt;\"foo\" | \"bar\" | \"baz\">; \/\/ \"fooChanged\" | \"barChanged\" | \"bazChanged\"  type T4 = Concat&lt;\"top\" | \"bottom\", \"left\" | \"right\">; \/\/ \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0442\u0438\u043f? \u042d\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0432 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044f\u0445 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">`[${A|B|C}]` => `[${A}]` | `[${B}]` | `[${C}]`<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/26\/uk\/ct\/26ukctljh58stmayxfbgbvel92g.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/26\/uk\/ct\/26ukctljh58stmayxfbgbvel92g.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0410 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044f\u043c\u0438, \u043a\u0430\u043a \u0432 \u0443\u0442\u0438\u043b\u0438\u0442\u0435 <code>Concat<\/code>, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044e\u0442\u0441\u044f \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 (cross product):<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">`${A|B}-${C|D}` => `${A}-${C}` | `${A}-${D}` | `${B}-${C}` | `${B}-${D}`<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/az\/jt\/t6\/azjtt6rosx4hag20jgajkzgppke.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/az\/jt\/t6\/azjtt6rosx4hag20jgajkzgppke.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438, \u043c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>Uppercase<\/code>, <code>Lowercase<\/code>, <code>Capitalize<\/code> \u0438 <code>Uncapitalize<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type GetterName&lt;T extends string> = `get${Capitalize&lt;T>}`; type Cases&lt;T extends string> = `${Uppercase&lt;T>} ${Lowercase&lt;T>} ${Capitalize&lt;T>} ${Uncapitalize&lt;T>}`;  type T5 = GetterName&lt;'name'>;   \/\/ \"getName\" type T6 = Cases&lt;'ts'>;          \/\/ \"TS ts Ts ts\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043c\u043e\u0449\u043d\u044b\u043c\u0438. \u0412 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u0441\u043b\u043e\u0432\u043e\u043c <code>infer<\/code> \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0438\u043f\u0430 (type inference):<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type InferSide&lt;T> = T extends `${infer R}-${Alignment}` ? R : T;  type T7 = InferSide&lt;\"left-start\">;  \/\/ \"left\" type T8 = InferSide&lt;\"right-end\">;   \/\/ \"right\"<\/code><\/pre>\n<p>  <\/p>\n<p><code>TS 4.1<\/code> \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0433\u043e\u0432\u043e\u0440\u043a\u0443 <code>as<\/code> \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u043f\u0440\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/pp\/_d\/18\/pp_d18lcplzxc37ftfkr4ipxizi.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/pp\/_d\/18\/pp_d18lcplzxc37ftfkr4ipxizi.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0422\u0438\u043f <code>NewKeyType<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f <code>string | number | symbol<\/code>. \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 <code>Getters<\/code> \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432 \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u0434\u043b\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mr\/ih\/nf\/mrihnfrfgwy_dswu0un7pfs97ds.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/mr\/ih\/nf\/mrihnfrfgwy_dswu0un7pfs97ds.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0438\u043f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 <code>keyof T<\/code>, \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u0438\u043f <code>symbol<\/code>, \u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <code>Capitilize<\/code> \u0442\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u0431\u044b\u043b \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>&amp;<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/r6\/qa\/ko\/r6qakoknj1cagfplqnfxhge__pi.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/r6\/qa\/ko\/r6qakoknj1cagfplqnfxhge__pi.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type PropType&lt;T, Path extends string> = string extends Path   ? unknown   : Path extends keyof T     ? T[Path]     : Path extends `${infer K}.${infer R}`       ? K extends keyof T         ? PropType&lt;T[K], R>         : unknown       : unknown;  \/\/ \u0441\u043c. \u043d\u0438\u0436\u0435 declare function getPropValue&lt;T, P extends string>(   obj: T,   path: P ): PropType&lt;T, P>;<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"declare\">declare<\/h2>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 <code>*.d.ts<\/code> \u0438 \u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>declare<\/code>. \u0417\u043d\u0430\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b, \u0434\u043b\u044f \u0447\u0435\u0433\u043e \u043e\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f?<\/p>\n<p>  <\/p>\n<p>\u0412 <code>TS-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445<\/code> \u043c\u044b \u0447\u0430\u0441\u0442\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 <code>JS-SDK<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u0433\u0430 <code>script<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f <code>Google Maps<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"html\">&lt;script src=\"https:\/\/maps.googleapis.com\/maps\/api\/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&amp;callback=initMap&amp;v=weekly\" defer>&lt;\/script><\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u044d\u0442\u043e\u043c\u0443 <code>API<\/code> \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/nq\/yu\/3a\/nqyu3az1urk_cwixeki7ieu0dqe.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/nq\/yu\/3a\/nqyu3az1urk_cwixeki7ieu0dqe.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0432\u0441\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439, <code>TS<\/code> \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 <code>TS<\/code> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>google<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u0437\u0430\u0434\u0430\u0447\u0443? \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>declare<\/code> \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>google<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">declare var google: any;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/r1\/_z\/ql\/r1_zql7q1geyiarew26ixzank0g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/r1\/_z\/ql\/r1_zql7q1geyiarew26ixzank0g.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u0430\u043a <code>JSON<\/code>, <code>Math<\/code> \u0438\u043b\u0438 <code>Object<\/code>? \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0443\u0436\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>declare<\/code> \u0432 \u0444\u0430\u0439\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 <code>lib.es5.d.ts<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ typescript\/lib\/lib.es5.d.ts declare var JSON: JSON; declare var Math: Math; declare var Object: ObjectConstructor;<\/code><\/pre>\n<p>  <\/p>\n<p><code>declare<\/code> \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 (enums). \u0422\u0430\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u0430\u043a <code>eval<\/code>, <code>isNaN<\/code>, <code>encodeURI<\/code> \u0438 <code>parseInt<\/code> \u0442\u0430\u043a\u0436\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0432 <code>lib.es5.d.ts<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">declare function eval(x: string): any; declare function isNaN(number: number): boolean; declare function encodeURI(uri: string): string; declare function parseInt(string: string, radix?: number): number;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u044b \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0443 \u043d\u0430\u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438, \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <a href=\"https:\/\/www.typescriptlang.org\/dt\/search?search=google+map\">\u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0438\u043a\u0443 TypeScript<\/a> \u0438\u043b\u0438 \u043a <a href=\"https:\/\/github.com\/DefinitelyTyped\/DefinitelyTyped\">\u043f\u0440\u043e\u0435\u043a\u0442\u0443 DefinitelyTypes<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/zw\/dw\/ae\/zwdwaeamy_omlipji5_f76xxk_g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/zw\/dw\/ae\/zwdwaeamy_omlipji5_f76xxk_g.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0442\u0438\u043f\u044b \u0434\u043b\u044f <code>Google Maps<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">yarn add -D @types\/google.maps<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f <code>npm-\u043f\u0430\u043a\u0435\u0442\u0430<\/code> <code>foo<\/code> \u043f\u0430\u043a\u0435\u0442 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f <code>@types\/foo<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code>jquery<\/code> \u043f\u0430\u043a\u0435\u0442 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>@types\/jquery<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>declare<\/code> \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d <code>Vue-TS-\u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/vitejs.dev\/\">Vite<\/a>:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">yarn create vite test-project --template vue-ts<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>client.d.ts<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/00\/gr\/-n\/00gr-nfgvakva059im5vxtxgb60.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/00\/gr\/-n\/00gr-nfgvakva059im5vxtxgb60.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412\u0438\u0434\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 <code>css<\/code>, <code>jpg<\/code> \u0438 <code>ttf<\/code>. \u0417\u0430\u0447\u0435\u043c \u043d\u0430\u043c \u044d\u0442\u0438 \u043c\u043e\u0434\u0443\u043b\u0438? \u0411\u0435\u0437 \u0438\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 <code>TS<\/code> \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0445 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ry\/ed\/un\/ryedunzxv_idyytprebhuujj_we.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/ry\/ed\/un\/ryedunzxv_idyytprebhuujj_we.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 <code>*<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 \u043f\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/p7\/wt\/gc\/p7wtgcxxfmqa-p7wqzuoitcrr1e.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/p7\/wt\/gc\/p7wtgcxxfmqa-p7wqzuoitcrr1e.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p><code>TS<\/code> \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0442\u0438\u043f\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0435, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>declare<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>$axios<\/code> \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0435 <code>Vue-\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { AxiosInstance } from \"axios\";  declare module \"@vue\/runtime-core\" {   interface ComponentCustomProperties {     $axios: AxiosInstance;   } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <code>$axios<\/code> \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <code>globalProperties<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { createApp } from \"vue\"; import axios from \"axios\"; import App from \".\/App.vue\";  const app = createApp(App);  app.config.globalProperties.$axios = axios;  app.mount(\"#app\");<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0435\u0433\u043e \u0432 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">import { getCurrentInstance , ComponentInternalInstance} from \"vue\"  const { proxy } = getCurrentInstance() as ComponentInternalInstance  proxy!.$axios   .get(\"https:\/\/jsonplaceholder.typicode.com\/todos\/1\")   .then((res) => res.json())   .then(console.log);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432\u044b, \u043a\u0430\u043a \u0438 \u044f, \u043d\u0430\u0448\u043b\u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438 happy coding!<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<p><a href=\"https:\/\/cloud.timeweb.com\/vds-vps?utm_source=habr&amp;utm_medium=banner&amp;utm_campaign=vds-promo-6-rub\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/p-\/u9\/l2\/p-u9l27ynelxi92bcmdxhu76ma8.png\" data-src=\"https:\/\/habrastorage.org\/webt\/p-\/u9\/l2\/p-u9l27ynelxi92bcmdxhu76ma8.png\"\/><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/company\/timeweb\/blog\/687806\/\"> https:\/\/habr.com\/ru\/company\/timeweb\/blog\/687806\/<\/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-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/um\/fe\/t_\/umfet_kngorlggfmgokzowwtsuu.png\" data-src=\"https:\/\/habrastorage.org\/webt\/um\/fe\/t_\/umfet_kngorlggfmgokzowwtsuu.png\"\/>  <\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0434\u0440\u0443\u0437\u044c\u044f!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u0438\u0437 \u0441\u0435\u0440\u0438\u0438 <a href=\"https:\/\/medium.com\/@bytefer\/list\/mastering-typescript-series-688ee7c12807\">Mastering TypeScript<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u044b\u0445 \u0443\u0433\u043b\u0443\u0431\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044e <a href=\"https:\/\/www.typescriptlang.org\/\">TypeScript<\/a>.<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/685954\/\">TypeScript \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445. \u0427\u0430\u0441\u0442\u044c 1<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/682748\/\">\u0417\u0430\u043c\u0435\u0442\u043a\u0430 \u043e Mapped Types \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e TypeScript<\/a><\/li>\n<li><a href=\"https:\/\/my-js.org\/docs\/guide\/ts\">\u041a\u0430\u0440\u043c\u0430\u043d\u043d\u0430\u044f \u043a\u043d\u0438\u0433\u0430 \u043f\u043e TypeScript<\/a><\/li>\n<li><a href=\"https:\/\/my-js.org\/docs\/cheatsheet\/ts\">\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430 \u043f\u043e TypeScript<\/a><\/li>\n<\/ul>\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-338255","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338255","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=338255"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/338255\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=338255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=338255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=338255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}