{"id":337816,"date":"2022-09-02T09:00:18","date_gmt":"2022-09-02T09:00:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=337816"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=337816","title":{"rendered":"<span>TypeScript \u0432 \u0434\u0435\u0442\u0430\u043b\u044f\u0445. \u0427\u0430\u0441\u0442\u044c 1<\/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 \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><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"t-k-i-v-v-dzhenerikah\"><code>T<\/code>, <code>K<\/code> \u0438 <code>V<\/code> \u0432 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u0445<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/6j\/yg\/17\/6jyg17pkl43smu0jxhwlim0njnu.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/6j\/yg\/17\/6jyg17pkl43smu0jxhwlim0njnu.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p><code>T<\/code> \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u043e\u0431\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 (generic type parameter). \u042d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c (placeholder) \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0433\u043e (actual) \u0442\u0438\u043f\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0421\u0443\u0442\u044c \u0442\u0430\u043a\u0430\u044f: \u0431\u0435\u0440\u0435\u043c \u0442\u0438\u043f, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c (chain) \u0435\u0433\u043e \u043a \u0442\u0438\u043f\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0442\u0438\u043f\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/-z\/ul\/qw\/-zulqwj_xrctzytk2_reaxwekos.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/-z\/ul\/qw\/-zulqwj_xrctzytk2_reaxwekos.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a \u0447\u0442\u043e \u0432\u0441\u0435-\u0442\u0430\u043a\u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 <code>T<\/code>? <code>T<\/code> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0442\u0438\u043f (type). \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432\u043c\u0435\u0441\u0442\u043e <code>T<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435. \u0427\u0430\u0441\u0442\u043e \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 <code>T<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u0435 \u043e\u0431\u0449\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u043a\u0430\u043a <code>K<\/code>, <code>V<\/code>, <code>E<\/code> \u0438 \u0434\u0440.<\/p>\n<p>  <\/p>\n<ul>\n<li><code>K<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u043a\u043b\u044e\u0447\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/li>\n<li><code>V<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430;<\/li>\n<li><code>E<\/code> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.<\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/uk\/_r\/dy\/uk_rdymaxcj_-qfxjphhlaxstme.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/uk\/_r\/dy\/uk_rdymaxcj_-qfxjphhlaxstme.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043c\u044b \u043d\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043e\u0434\u043d\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0442\u0438\u043f\u0430 \u2014 \u0438\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0433\u043e\u0434\u043d\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x0\/0l\/eh\/x00lehgykaurlzzu3x1hbwtfn7s.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/x0\/0l\/eh\/x00lehgykaurlzzu3x1hbwtfn7s.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>identity<\/code> \u043c\u043e\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0442\u0438\u043f\u0430. \u0418\u043b\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c <code>TypeScript<\/code> \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0435\u0433\u043e:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/m3\/vy\/5x\/m3vy5xrj8_xd1alf6gqle02krco.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/m3\/vy\/5x\/m3vy5xrj8_xd1alf6gqle02krco.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<h2 id=\"uslovnye-tipy\">\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u0432\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0438\u043f\u043e\u0432 <code>Exclude<\/code>, <code>Extract<\/code>, <code>NonNullable<\/code>, <code>Parameters<\/code> \u0438 <code>ReturnType<\/code>?<\/p>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u0430\u0445 (conditional types):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/re\/9c\/-l\/re9c-l5l3ss1ictmvm8pkob3ma0.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/re\/9c\/-l\/re9c-l5l3ss1ictmvm8pkob3ma0.gif\"\/>  <\/p>\n<p><em>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430<\/em><\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0430\u0442\u043a\u0430\u044f \u0441\u043f\u0440\u0430\u0432\u043a\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ht\/5m\/mc\/ht5mmcg-ax6n8t9nbollhsxztjo.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/ht\/5m\/mc\/ht5mmcg-ax6n8t9nbollhsxztjo.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0446\u0435\u043b\u0435\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>Exclude<\/code> \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0438\u0437 <code>UnionType<\/code> \u0432\u0441\u0435\u0445 \u0447\u043b\u0435\u043d\u043e\u0432 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 <code>ExcludedMembers<\/code>;<\/li>\n<li><code>Extract<\/code> \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u0437 <code>Type<\/code> \u0432\u0441\u0435\u0445 \u0447\u043b\u0435\u043d\u043e\u0432 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 <code>Union<\/code>;<\/li>\n<li><code>NonNullable<\/code> \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <code>null<\/code> \u0438 <code>undefined<\/code> \u0438\u0437 <code>Type<\/code>;<\/li>\n<li><code>Parameters<\/code> \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u0440\u0442\u0435\u0436 (tuple) \u0438\u0437 \u0442\u0438\u043f\u043e\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>Type<\/code>;<\/li>\n<li><code>ReturnType<\/code> \u2014 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u0442\u0438\u043f, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <code>Type<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u0438\u0445 \u0443\u0442\u0438\u043b\u0438\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/tq\/8c\/g_\/tq8cg_0a-c2jojq3_vabbix76pg.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/tq\/8c\/g_\/tq8cg_0a-c2jojq3_vabbix76pg.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">T extends U ? X : Y<\/code><\/pre>\n<p>  <\/p>\n<p><code>T<\/code>, <code>U<\/code>, <code>X<\/code> \u0438 <code>Y<\/code> \u2014 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u0438 \u0442\u0438\u043f\u043e\u0432 (\u0441\u043c. \u0432\u044b\u0448\u0435). \u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: \u0435\u0441\u043b\u0438 <code>T<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d <code>U<\/code>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f <code>X<\/code>, \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0442\u0438\u043f <code>Y<\/code>. \u042d\u0442\u043e \u0447\u0435\u043c-\u0442\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0432 <code>JavaScript<\/code>.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ht\/jv\/p3\/htjvp3me0o8scjw2l2y59vtvpji.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/ht\/jv\/p3\/htjvp3me0o8scjw2l2y59vtvpji.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f? \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 IsString&lt;T> = T extends string ? true : false; \u200b type I0 = IsString&lt;number>;  \/\/ false type I1 = IsString&lt;\"abc\">;  \/\/ true type I2 = IsString&lt;any>;  \/\/ boolean type I3 = IsString&lt;never>;  \/\/ never<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/po\/6u\/wv\/po6uwvfvnydqjrvyvtdmy19hxbs.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/po\/6u\/wv\/po6uwvfvnydqjrvyvtdmy19hxbs.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <code>IsString<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0442\u0438\u043f\u0430, \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c \u0442\u0438\u043f\u043e\u043c. \u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u044d\u0442\u043e\u043c\u0443, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0446\u0435\u043f\u043e\u0447\u0435\u043a (conditional chain) \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/9d\/ve\/pp\/9dveppff0vo-nd4ymjyqguv7bio.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/9d\/ve\/pp\/9dveppff0vo-nd4ymjyqguv7bio.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u043b\u043e\u0432\u043d\u0430\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 <code>JS<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/9k\/kn\/jj\/9kknjjzqz07t5ybf-bg4vgdjb-g.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/9k\/kn\/jj\/9kknjjzqz07t5ybf-bg4vgdjb-g.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441: \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c <code>TypeName<\/code> \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 (union)?<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \"string\" | \"function\" type T10 = TypeName&lt;string | (() => void)>; \/\/ \"string\" | \"object\" | \"undefined\" type T11 = TypeName&lt;string | string[] | undefined>;<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/fs\/9i\/zu\/fs9izufmtm4_b48d3mqzeg9syqg.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/fs\/9i\/zu\/fs9izufmtm4_b48d3mqzeg9syqg.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0438\u043f\u044b <code>T10<\/code> \u0438 <code>T11<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f? \u042d\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e <code>TypeName<\/code> \u2014 \u044d\u0442\u043e \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 (distributed) \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0442\u0438\u043f. \u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0442\u0438\u043f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f &#171;\u0433\u043e\u043b\u044b\u043c&#187; (naked), \u0442. \u0435. \u043d\u0435 \u043e\u0431\u0435\u0440\u043d\u0443\u0442 \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0440\u0442\u0435\u0436, \u043f\u0440\u043e\u043c\u0438\u0441 \u0438 \u0442. \u0434.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/1i\/2b\/gi\/1i2bgiobeeop-l2ntqacurmdqkw.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/1i\/2b\/gi\/1i2bgiobeeop-l2ntqacurmdqkw.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u044b\u0439 \u0442\u0438\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c, \u043e\u043d\u043e \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0442\u043e\u043a \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">T extends U ? X : Y T => A | B | C A | B | C extends U ? X : Y  => (A extends U ? X : Y) | (B extends U ? X : Y) | (C extends U ? X : Y)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9j\/ms\/rs\/9jmsrsx8c0nyi9gb45wemg7f9iu.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/9j\/ms\/rs\/9jmsrsx8c0nyi9gb45wemg7f9iu.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\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\/hh\/2i\/vc\/hh2ivccguqxfbgu9fgfgoelvpoi.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/hh\/2i\/vc\/hh2ivccguqxfbgu9fgfgoelvpoi.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 \u043e\u0431\u0435\u0440\u043d\u0443\u0442 \u0432 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0442\u0438\u043f, \u043e\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0435 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0442\u043a\u0438.<\/p>\n<p>  <\/p>\n<p>\u0420\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) \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b <code>Exclude<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Exclude&lt;T, U> = T extends U ? never : T; type T4 = Exclude&lt;\"a\" | \"b\" | \"c\", \"a\" | \"b\"> \u200b (\"a\" extends \"a\" | \"b\" ? never : \"a\") \/\/ => never | (\"b\" extends \"a\" | \"b\" ? never : \"b\") \/\/ => never | (\"c\" extends \"a\" | \"b\" ? never : \"c\") \/\/ => \"c\" \u200b never | never | \"c\" \/\/ => \"c\"<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/hs\/qu\/bp\/hsqubpyvwbij-zz46cs1l_28ifu.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/hs\/qu\/bp\/hsqubpyvwbij-zz46cs1l_28ifu.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 (mapped, \u0441\u043c. <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>) \u0442\u0438\u043f\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/dw\/oy\/7g\/dwoy7gpqlg-qvs9a_dxnrxrzwac.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/dw\/oy\/7g\/dwoy7gpqlg-qvs9a_dxnrxrzwac.jpeg\" data-blurred=\"true\"\/><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fv\/xw\/cs\/fvxwcsrphguvdit9xlcuaredcec.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fv\/xw\/cs\/fvxwcsrphguvdit9xlcuaredcec.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type FunctionPropertyNames&lt;T> = {     [K in keyof T]: T[K] extends Function ? K : never; }[keyof T]; type FunctionProperties&lt;T> = Pick&lt;T, FunctionPropertyNames&lt;T>>; \u200b type NonFunctionPropertyNames&lt;T> = {     [K in keyof T]: T[K] extends Function ? never : K; }[keyof T]; type NonFunctionProperties&lt;T> = Pick&lt;T, NonFunctionPropertyNames&lt;T>>; \u200b interface User {   id: number;   name: string;   age: number;   updateName(newName: string): void; } \u200b type T5 = FunctionPropertyNames&lt;User>; \/\/ \"updateName\" type T6 = FunctionProperties&lt;User>; \/\/ { updateName: (newName: string) => void; } type T7 = NonFunctionPropertyNames&lt;User>; \/\/ \"id\" | \"name\" | \"age\" type T8 = NonFunctionProperties&lt;User>; \/\/ { id: number; name: string; age: number; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043b\u0435\u0433\u043a\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0438 \u043d\u0435\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u043d\u0438\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u0437 \u0442\u0438\u043f\u0430 <code>User<\/code>.<\/p>\n<p>  <\/p>\n<h2 id=\"operator-keyof\">\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>keyof<\/code><\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043b\u0438 \u0432\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0438\u043f\u043e\u0432 <code>Partial<\/code>, <code>Required<\/code>, <code>Pick<\/code> \u0438 <code>Record<\/code>?<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ze\/_e\/0y\/ze_e0yjqw_uvhfkdedsdbiwnuk4.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/ze\/_e\/0y\/ze_e0yjqw_uvhfkdedsdbiwnuk4.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0443\u0442\u0438\u043b\u0438\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>keyof<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0412 <code>JS<\/code> \u043a\u043b\u044e\u0447\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>Object.keys<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">const user = {   id: 666,   name: \"bytefer\", } const keys = Object.keys(user); \/\/ [\"id\", \"name\"]<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 <code>TS<\/code> \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>keyof<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type User = {   id: number;   name: string; } type UserKeys = keyof User; \/\/ \"id\" | \"name\"<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0442\u0438\u043f\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0434\u0430\u043d\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type U1 = User[\"id\"] \/\/ number type U2 = User[\"id\" | \"name\"] \/\/ string | number type U3 = User[keyof User] \/\/ string | number<\/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\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0438\u043f \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (indexed access type) \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0442\u0438\u043f\u0430 <code>User<\/code>.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a <code>keyof<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435? \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">function getProperty(obj, key) {   return obj[key]; } const user = {   id: 666,   name: \"bytefer\", } const userName = getProperty(user, \"name\");<\/code><\/pre>\n<p>  <\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f <code>getProperty<\/code> \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 2 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: \u043e\u0431\u044a\u0435\u043a\u0442 (<code>obj<\/code>) \u0438 \u043a\u043b\u044e\u0447 (<code>key<\/code>), \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e \u043a\u043b\u044e\u0447\u0443.<\/p>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 <code>TS<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/yc\/_j\/dq\/yc_jdqjn-qsjh3trxavtlxa7fzo.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/yc\/_j\/dq\/yc_jdqjn-qsjh3trxavtlxa7fzo.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0412 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <code>obj<\/code> \u0438 <code>key<\/code> \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u044f\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b <code>any<\/code>. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/-9\/dq\/el\/-9dqelqjxqn_gv0ordoqjnlalci.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/-9\/dq\/el\/-9dqelqjxqn_gv0ordoqjnlalci.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0440\u0443\u0433\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443. \u0414\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u0431\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 (generic) \u0438 <code>keyof<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">function getProperty&lt;T extends object, K extends keyof T>(   obj: T, key: K ) {   return obj[key]; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c 2 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0442\u0438\u043f\u0430: <code>T<\/code> \u0438 <code>K<\/code>. <code>extends<\/code> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0432\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (constraint) \u0442\u0438\u043f\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e <code>T<\/code>, \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0433\u043e <code>K<\/code>, \u043f\u043e\u0434\u0442\u0438\u043f\u043e\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043a\u043b\u044e\u0447\u0430 <code>TS<\/code> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/y3\/z7\/td\/y3z7tdkm8n62ytbvoh26irtrkqw.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/y3\/z7\/td\/y3z7tdkm8n62ytbvoh26irtrkqw.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>keyof<\/code> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c, \u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043a \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430\u043c, \u0442\u0438\u043f\u0443 <code>any<\/code>, \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/0p\/l1\/ah\/0pl1ahdtw8vube9crs45mfsnxgy.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/0p\/l1\/ah\/0pl1ahdtw8vube9crs45mfsnxgy.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u0420\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>Partial<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/on\/uj\/vi\/onujvikybbefyno8n8y6eolvcce.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/on\/uj\/vi\/onujvikybbefyno8n8y6eolvcce.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/**  * \u0414\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 T \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438.  * typescript\/lib\/lib.es5.d.ts  *\/ type Partial&lt;T> = {     [P in keyof T]?: T[P]; };<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/1x\/2g\/mi\/1x2gmisencmrmup8w_uwgwqvaui.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/1x\/2g\/mi\/1x2gmisencmrmup8w_uwgwqvaui.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<h2 id=\"operator-typeof\">\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>typeof<\/code><\/h2>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>typeof<\/code>.<\/p>\n<p>  <\/p>\n<p><strong>1. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430<\/strong><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/cr\/n8\/yr\/crn8yrrts2i7ywm0y2p8n3qkfmi.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/cr\/n8\/yr\/crn8yrrts2i7ywm0y2p8n3qkfmi.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 <code>man<\/code> \u2014 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 <code>JS<\/code>. \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 <code>TS<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>type<\/code> \u0438\u043b\u0438 <code>interface<\/code>. \u0422\u0438\u043f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \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, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <code>Partial<\/code>, <code>Required<\/code>, <code>Pick<\/code> \u0438\u043b\u0438 <code>Readonly<\/code>, \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0440\u0443\u0447\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043d\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0440\u0443\u0434\u0430, \u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c. \u0412\u043c\u0435\u0441\u0442\u043e \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0431\u0435\u0433\u043d\u0443\u0442\u044c \u043a \u043f\u043e\u043c\u043e\u0449\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <code>typeof<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Person = typeof man;  type Address = Person[\"address\"];<\/code><\/pre>\n<p>  <\/p>\n<p><code>Person[\"address\"]<\/code> \u2014 \u044d\u0442\u043e \u0442\u0438\u043f \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (indexed access type), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0442\u0438\u043f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 (<code>address<\/code>) \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (<code>Person<\/code>).<\/p>\n<p>  <\/p>\n<p><strong>2. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0435\u0433\u043e \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a<\/strong><\/p>\n<p>  <\/p>\n<p>\u0412 <code>TS<\/code> \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 (enum) \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u0438\u043f, \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u0432 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <code>JS-\u043e\u0431\u044a\u0435\u043a\u0442<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/tn\/3x\/m5\/tn3xm5st8_j6jqbghbyx-qxvkee.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/tn\/3x\/m5\/tn3xm5st8_j6jqbghbyx-qxvkee.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>typeof<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c\u0438, <code>typeof<\/code> \u043e\u0431\u044b\u0447\u043d\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <code>keyof<\/code>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/p5\/48\/js\/p548jsod1phiqkonhza8b2vmil4.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/p5\/48\/js\/p548jsod1phiqkonhza8b2vmil4.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p><strong>3. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong><\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>typeof<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432 <code>JS<\/code> \u2014 \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442). \u041f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u043e\u0432 <code>ReturnType<\/code> \u0438 <code>Parameters<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438 \u0442\u0438\u043f\u0430 \u0435\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/si\/8s\/mh\/si8smh05eho5glzluncyiskd0qe.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/si\/8s\/mh\/si8smh05eho5glzluncyiskd0qe.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p><strong>4. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u043a\u043b\u0430\u0441\u0441\u0430<\/strong><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/fy\/a7\/qa\/fya7qambyrsntleqxcnjcnx7gme.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/fy\/a7\/qa\/fya7qambyrsntleqxcnjcnx7gme.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>createPoint<\/code> \u2014 \u044d\u0442\u043e \u0444\u0430\u0431\u0440\u0438\u0447\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0430\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <code>Point<\/code>. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>typeof<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0443 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Point<\/code> \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430. \u041f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 <code>typeof<\/code> \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0442\u0438\u043f\u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/9o\/rj\/-x\/9orj-xdyf1oj0luk3leuie3fohm.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/9o\/rj\/-x\/9orj-xdyf1oj0luk3leuie3fohm.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<p><strong>6. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430<\/strong><\/p>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>typeof<\/code> \u0432 \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438 \u0441 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c <code>const<\/code> (const assertion), \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u0432 <code>TS 3.4<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 (precise) \u0442\u0438\u043f\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/nv\/ai\/w8\/nvaiw8j0-dr_ap-yo-ao2pus9us.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/nv\/ai\/w8\/nvaiw8j0-dr_ap-yo-ao2pus9us.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  <\/p>\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\/685954\/\"> https:\/\/habr.com\/ru\/company\/timeweb\/blog\/685954\/<\/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 \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","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-337816","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337816","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=337816"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/337816\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}