{"id":344745,"date":"2023-01-31T09:00:30","date_gmt":"2023-01-31T09:00:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=344745"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=344745","title":{"rendered":"<span>\u041f\u043e\u043d\u044f\u0442\u044c TypeScript c \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><sub>\u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434, \u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u043e\u0435\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0441\u043f\u0435\u0448\u0438\u0442\u0435 \u0443\u0431\u0435\u0433\u0430\u0442\u044c \u043d\u0430 \u00ab\u043d\u0435\u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043c\u044b\u0439 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u00bb.<\/sub><\/p>\n<p>\u042f \u043f\u0438\u0448\u0443 \u043d\u0430 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0443\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0430\u0432\u043d\u043e. \u041d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0441\u0431\u0438\u0432\u0430\u044e\u0442 \u043c\u0435\u043d\u044f \u0441 \u0442\u043e\u043b\u043a\u0443:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438 <code>{ name: string }<\/code>, \u0438 <code>{ age: number }<\/code>, \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u0438 \u0442\u0438\u043f\u044b <code>&amp;<\/code> (\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u044c) \u0438\u043b\u0438 <code>|<\/code> (\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c)? \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043b\u043e\u0433\u0438\u043a\u0443, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f \u0445\u043e\u0447\u0443 \u043b\u0435\u0432\u043e\u0435 <em>\u0438<\/em> \u043f\u0440\u0430\u0432\u043e\u0435, \u043d\u043e, \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e <em>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/em> \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438 <code>type S&lt;T> = T extends string ? ...<\/code>, \u0435\u0441\u043b\u0438 <code>T<\/code> \u2014 \u044e\u043d\u0438\u043e\u043d \u0441\u0442\u0440\u043e\u043a, \u0432\u0440\u043e\u0434\u0435 <code>'ru' | 'de'<\/code>?<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0447\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0443 <code>any<\/code> \u0438 <code>unknown<\/code>? \u041b\u0443\u0447\u0448\u0435\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u2014 \u0434\u0443\u0440\u0430\u0446\u043a\u0438\u0435 \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0438 \u0442\u0438\u043f\u0430 \u00abAvoid Any, Use Unknown\u00bb. \u0410 \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 <code>any<\/code>?<\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u0447\u0442\u043e \u0437\u0430 \u0442\u0438\u043f? \u00abnever \u043f\u043e-\u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u0442 \u041d\u0418\u041a\u041e\u0413\u0414\u0410, \u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u041d\u0418\u041a\u041e\u0413\u0414\u0410 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\u00bb \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0434\u0440\u0430\u043c\u0430\u0442\u0438\u0447\u043d\u043e, \u043d\u043e \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 <code>never<\/code> \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u0437\u0440\u044b\u0432, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043c\u043e\u0433\u0443 <code>const x: number = y as never<\/code>? \u0418 \u043f\u043e\u0447\u0435\u043c\u0443 <code>never<\/code> \u0432\u0441\u0435\u0433\u0434\u0430  <code>extends X<\/code>?<\/p>\n<\/li>\n<li>\n<p><code>const x: {} = true;<\/code> \u2014 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435, \u0430? <code>true<\/code> \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043b\u0435\u0433\u043a\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u2014 \u0432\u044b \u043c\u043e\u043b\u043e\u0434\u0435\u0446. \u041f\u0440\u0430\u0432\u0434\u0430. \u0417\u0434\u043e\u0440\u043e\u0432\u043e, \u0447\u0442\u043e \u0432 \u043c\u0438\u0440\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0443\u043c\u043d\u044b\u0435 \u043b\u044e\u0434\u0438. \u042f \u0432\u043e\u0442 \u043d\u0435 \u043c\u043e\u0433, \u0438 \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u041f\u043e\u043a\u0430 \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0441 <code>never<\/code>, \u043c\u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0430\u0441\u044c <a href=\"https:\/\/www.zhenghao.io\/posts\/ts-never\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a> (\u0434\u0430 \u0438 \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u0433 \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u043e\u0441\u043e\u0431\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043c\u044b\u0441\u043b\u044c: <em>\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435<\/em> <code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0441\u0432\u043e\u044e \u0434\u0443\u0448\u0443 \u0438\u0434\u0435\u044e, \u0447\u0442\u043e \u0442\u0438\u043f \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u0441\u0451 \u0432\u0441\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0438 \u043c\u0435\u0441\u0442\u0430. \u042f \u0443\u0448\u0435\u043b \u0432 \u043f\u0435\u0449\u0435\u0440\u0443, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u043b \u0438\u0445 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e \u043f\u043e \u0447\u0435\u0440\u0442\u0435\u0436\u0443 \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043b\u043e\u0433\u0438\u0447\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>\u041e\u0441\u0432\u0435\u0436\u0438\u043c \u043d\u0430\u0448\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u0438\u044f TS \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043d\u0430 \u043d\u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0438\u043d\u043a\u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u044f\u0437\u044b\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0431\u0443\u043b\u0435\u0432\u044b \u0442\u0438\u043f\u044b (\u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u2014 <code>null<\/code> \u0438 <code>undefined<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u043e\u0431\u0449\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u0447\u0438\u0441\u043b\u0430 (\u0438 \u043f\u043e\u0445\u043e\u0434\u0443 \u0432\u044b\u044f\u0441\u043d\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b TS \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c \u2014 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u044f \u0434\u0443\u043c\u0430\u043b!<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043d\u0430 \u0434\u0435\u0441\u0435\u0440\u0442 \u2014 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u043c \u043f\u043e \u043f\u043e\u043b\u043e\u0447\u043a\u0430\u043c <code>any<\/code> \u0438 <code>undefined<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u044f \u043d\u0430\u0445\u043e\u0436\u0443 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0441\u0432\u043e\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e TS \u0432 \u0441\u0442\u0440\u043e\u0439\u043d\u0443\u044e \u0442\u0435\u043e\u0440\u0438\u044e, \u0438 \u0440\u0438\u0441\u0443\u044e \u044d\u0442\u0443 <em>\u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u0443\u044e<\/em> \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/459\/3b6\/922\/4593b6922416e8a49097317e82e88552.png\" width=\"931\" height=\"1325\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/459\/3b6\/922\/4593b6922416e8a49097317e82e88552.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0422\u0435\u043e\u0440\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/strong><\/p>\n<p>\u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0441\u0432\u0435\u0436\u0438\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0442\u0435\u043e\u0440\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438 \u0442\u0430\u043a \u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u043b\u0438\u0441\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u043e \u044f \u043a\u043e\u043d\u0447\u0430\u043b \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u044b \u0434\u0430\u0432\u043d\u043e \u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0440\u0430\u0441\u043f\u0438\u0448\u0443, \u0447\u0442\u043e \u043a \u0447\u0435\u043c\u0443.<\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0430 \u0434\u0435\u0442\u0441\u0430\u0434\u043e\u0432\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435: \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u044f\u0431\u043b\u043e\u043a\u0430 \u2014 \u044d\u0442\u043e \u043d\u0430\u0448\u0438 <em>\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/em> \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0438\u0445 \u044f\u0431\u043b\u043e\u043a\u043e \u0432\u0430\u0441\u044f \u0438 \u044f\u0431\u043b\u043e\u043a\u043e \u043f\u0435\u0442\u044f. \u0415\u0449\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u0438\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0431\u043b\u043e\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043a\u043b\u0430\u0441\u0442\u044c \u2014 \u044d\u0442\u043e <em>\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.<\/em> \u0412\u0441\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043d\u0430\u0431\u0440\u0430\u0442\u044c \u044f\u0431\u043b\u043e\u043a \u0432 \u043f\u0430\u043a\u0435\u0442:<\/p>\n<ol>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441 \u044f\u0431\u043b\u043e\u043a\u043e\u043c \u0432\u0430\u0441\u0435\u0439, <code>{ \u0432\u0430\u0441\u044f }<\/code> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0438\u0448\u0443\u0442 \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441 \u044f\u0431\u043b\u043e\u043a\u043e\u043c \u043f\u0435\u0442\u0435\u0439, <code>{ \u043f\u0435\u0442\u044f }<\/code>, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u044f\u0431\u043b\u043e\u043a\u0430\u043c\u0438, <code>{ \u0432\u0430\u0441\u044f, \u043f\u0435\u0442\u044f }<\/code>. \u0412 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043c\u044b \u0438\u0445 \u0442\u0443\u0434\u0430 \u043a\u043b\u0430\u043b\u0438 \u2014 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0432\u0430\u0436\u043d\u043e. \u041d\u0435 \u0445\u043e\u0447\u0443 \u0432\u0430\u0441 \u043f\u0443\u0433\u0430\u0442\u044c, \u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <em>\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u043e\u043c,<\/em> \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0438\u0440\u0430 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043a\u0440\u043e\u043c\u0435 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f <em>\u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e.<\/em> \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u2205<\/p>\n<\/li>\n<\/ol>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0447\u0430\u0441\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0412\u0435\u043d\u043d\u0430 \u2014 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0438 \u043c\u044b \u043e\u0431\u0432\u043e\u0434\u0438\u043c \u0438\u0445 \u043a\u0440\u0443\u0436\u043e\u0447\u043a\u0430\u043c\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/c8e\/7ec\/d9e\/c8e7ecd9e16df0708f2adb6adc1340b5.png\" width=\"1589\" height=\"695\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c8e\/7ec\/d9e\/c8e7ecd9e16df0708f2adb6adc1340b5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00abR \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a\u00bb \u044d\u0442\u043e R = { \u0432\u0430\u0441\u044f } (\u0435\u0441\u043b\u0438 \u0432\u0430\u0441\u044f \u2014 \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u0430 \u043f\u0435\u0442\u044f \u0435\u0449\u0451 \u0437\u0435\u043b\u0451\u043d\u044b\u0439).<\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e A \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c B, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b A \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 B. \u0412 \u043d\u0430\u0448\u0435\u043c \u044f\u0431\u043b\u043e\u0447\u043d\u043e\u043c \u043c\u0438\u0440\u0435 { \u0432\u0430\u0441\u044f }\u00a0&#8212; \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e { \u0432\u0430\u0441\u044f, \u043f\u0435\u0442\u044f }, \u043d\u043e { \u043f\u0435\u0442\u044f } \u2014 \u043d\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e { \u0432\u0430\u0441\u044f }. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041b\u044e\u0431\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f<\/p>\n<\/li>\n<li>\n<p>\u041b\u044e\u0431\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<li>\n<p>\u041f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 <em>C = A \u222a B<\/em> \u2014 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0445\u043e\u0442\u044f \u0431\u044b \u0432 A \u0438\u043b\u0438 \u0432 B (\u0441\u0432\u0430\u043b\u0438\u043b\u0438 \u0434\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u043e\u0434\u0438\u043d). \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <em>A \u222a \u2205 = A<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 <em>C = A \u2229 B<\/em> \u2014 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 A, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0435\u0449\u0435 \u0438 \u0432 B. \u041b\u043e\u0433\u0438\u0447\u043d\u043e, \u0447\u0442\u043e <em>A \u2229 \u2205 = \u2205<\/em><\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u043d\u043e\u0441\u0442\u044c <em>C = A \\ B<\/em> \u2014 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 A, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 <em>\u043d\u0435\u0442<\/em> \u0432 B. \u0411\u0435\u0437 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439, <em>A \\ \u2205 = A<\/em><\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0451, \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0435. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043a \u0442\u0438\u043f\u0430\u043c.<\/p>\n<p><strong>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u0440\u0438 \u0447\u0435\u043c \u0442\u0443\u0442 \u0442\u0438\u043f\u044b?<\/strong><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442: \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, <em>\u0442\u0438\u043f<\/em> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e JavaScript \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 JS-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f (\u0434\u0430\u0436\u0435 \u043d\u0435 TS-\u0442\u0438\u043f, \u043f\u0440\u043e\u0441\u0442\u043e <em>\u0442\u0438\u043f<\/em>) \u2014 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>TS \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0438\u043f\u044b, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u2014 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u041d\u0435 \u0432\u0435\u0440\u0438\u0442\u0435? \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f \u00ab\u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u043e\u043c\u0435 0\u00bb.<\/p>\n<\/li>\n<li>\n<p><code>A extends B<\/code> \u0438\u0437 <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/conditional-types.html\" rel=\"noopener noreferrer nofollow\">\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/a> \u0438 <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/generics.html#generic-constraints\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u0441\u0442\u0440\u0435\u0439\u043d\u0442\u043e\u0432<\/a> \u043c\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u00abA \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e B\u00bb.<\/p>\n<\/li>\n<li>\n<p>TS-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b <code>|<\/code> \u0438 <code>&amp;<\/code> \u2014 \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043a\u0430\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<\/li>\n<li>\n<p><code>Exclude&lt;A, B><\/code> \u043f\u043e \u0438\u0434\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043d\u043e \u044d\u0442\u043e\u0442 \u0434\u0436\u0438\u043d\u0435\u0440\u0438\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 A \u0438 B (\u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0447\u0438\u0441\u043b\u043e\u043c-\u043a\u0440\u043e\u043c\u0435-0, <code>Exclude&lt;number, 0><\/code> \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442).<\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e: \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e A <code>A &amp; never = never<\/code> b <code>A | never = A<\/code>, \u0430 <code>Exclude&lt;0, 0> = never<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u044d\u0442\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<p><strong>\u0411\u0443\u043b\u0435\u0432\u044b \u0442\u0438\u043f\u044b<\/strong><\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0438\u0434, \u0447\u0442\u043e \u0432 JS \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043b\u0435\u0432\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u044f \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c). \u0422\u0430\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0440\u043e\u0432\u043d\u043e \u0434\u0432\u0430: <code>true<\/code> \u0438 <code>false<\/code>, \u0438\u043b\u0438, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043d\u0430\u0448 \u043f\u0440\u0435\u043f\u043e\u0434, \u0442\u0440\u044e\u044d \u0438 \u0444\u0430\u043b\u0437\u0451. \u042d\u0442\u043e \u0442\u0435 \u0436\u0435 \u044f\u0431\u043b\u043e\u0447\u043a\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c. \u041d\u0430 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c 4 \u0442\u0438\u043f\u0430:<\/p>\n<ul>\n<li>\n<p>\u0422\u0438\u043f\u044b-\u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b <code>true<\/code> \u0438 <code>false<\/code>, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u2014 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p><code>boolean<\/code>, \u0442\u0438\u043f \u0438\u0437 \u043e\u0431\u043e\u0438\u0445 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0418 <code>never<\/code> \u0432 \u0440\u043e\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0442\u0430 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0434\u043b\u044f \u044f\u0431\u043b\u043e\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1f1\/ca7\/743\/1f1ca7743a52638ffc7c6c46667e40b8.png\" width=\"782\" height=\"235\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1f1\/ca7\/743\/1f1ca7743a52638ffc7c6c46667e40b8.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0443\u043f\u0440\u0430\u0436\u043d\u044f\u0435\u043c\u0441\u044f \u0432 \u0442\u0435\u043b\u0435\u043f\u043e\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 \u043c\u0438\u0440\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0432 \u043c\u0438\u0440 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>boolean<\/code> \u2014 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e <code>true | false<\/code> (\u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 TS)<\/p>\n<\/li>\n<li>\n<p><code>true<\/code> \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e (\u0438\u043b\u0438 \u043f\u043e\u0434\u0442\u0438\u043f) <code>boolean<\/code><\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, <code>never<\/code> \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0438\u043f\u043e\u0432 <code>true<\/code>, <code>false<\/code> \u0438 <code>boolean<\/code><\/p>\n<\/li>\n<li>\n<p><code>&amp;<\/code> \u2014 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435, \u0437\u043d\u0430\u0447\u0438\u0442, <code>false &amp; true = never<\/code>, <code>boolean &amp; true = { true, false } | { true } = true<\/code> (\u0442\u043e \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 <code>boolean<\/code> \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435), <code>true &amp;amp; never = never<\/code> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p><code>|<\/code> \u2014 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u0437\u043d\u0430\u0447\u0438\u0442, <code>true | never = true<\/code>, \u0430 <code>boolean | true = boolean<\/code> (\u0442\u043e \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 <code>boolean<\/code> \u00ab\u043f\u0440\u043e\u0433\u043b\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u00bb \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438).<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0434\u0430\u0436\u0435 <code>Exclude<\/code> \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432: <code>Exclude&lt;boolean, true> = false<\/code> (\u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a).<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 extends-\u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445:<\/p>\n<pre><code class=\"typescript\">type A = boolean extends never ? 1 : 0; type B = true extends boolean ? 1 : 0; type C = never extends false ? 1 : 0; type D = never extends never ? 1 : 0;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e <code>extends<\/code> \u043c\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u00ab\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c\u00bb, \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u2014 A0,B1,C1,D1. \u0425\u043e\u0442\u044f \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a <code>never<\/code> \u043c\u043e\u0436\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u044d\u043a\u0441\u0442\u0435\u043d\u0434\u0438\u0442\u044c. \u042d\u0442\u043e \u0443\u0441\u043f\u0435\u0445.<\/p>\n<p>\u0422\u0438\u043f\u044b <code>null<\/code> \u0438 <code>undefined<\/code> \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 <code>boolean<\/code>, \u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445 \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e (\u0438\u043b\u0438 \u043f\u043e \u0434\u0432\u0430 TS-\u0442\u0438\u043f\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c <code>never<\/code>). <code>null &amp; boolean = null &amp; undefined = boolean &amp; undefined = never<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0443\u0445 JS-\u0442\u0438\u043f\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 JS-\u0442\u0438\u043f\u044b \u2014 \u043d\u0435\u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430). \u041d\u0430\u043d\u0435\u0441\u0435\u043c \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0430 \u043d\u0430\u0448\u0443 \u043a\u0430\u0440\u0442\u0443:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/532\/ee3\/bf7\/532ee3bf7c89f787e1e94f5d4a27408f.png\" width=\"774\" height=\"379\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/532\/ee3\/bf7\/532ee3bf7c89f787e1e94f5d4a27408f.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b<\/strong><\/p>\n<p>\u041e\u043a\u0435\u0439, \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0442\u0440\u043e\u043a\u0430\u043c. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0443\u0442 \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: <code>string<\/code> \u2014 \u0442\u0438\u043f \u0432\u0441\u0435\u0445 JS-\u0441\u0442\u0440\u043e\u043a, \u0430 \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b-\u0442\u0438\u043f: <code>const str: 'hi' = 'hi'<\/code>. \u041d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043d\u044e\u0430\u043d\u0441 \u2014 \u0441\u0442\u0440\u043e\u043a, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. (\u0412 \u043f\u0430\u043c\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0432\u043b\u0435\u0437\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a? \u041d\u0435 \u0434\u0443\u0448\u043d\u0438\u0442\u0435, \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435\u0433\u043e\u0436\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0433\u0440\u044f\u0437\u043d\u044b\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0438\u0440\u043e\u043c).<\/p>\n<p>\u041a\u0430\u043a \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u043e\u0431\u0449\u0435, \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 TS \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 <code>|<\/code> \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e (\u0442\u0438\u043f) \u0441\u0442\u0440\u043e\u043a \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>type Country = 'de' | 'us'<\/code>. \u0410 \u0432\u043e\u0442 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u0434\u0432\u0443\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432) \u2014 \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>(\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e) \u0441\u0432\u0435\u0436\u0430\u044f \u0444\u0438\u0447\u0430 TS \u2014 <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/template-literal-types.html\" rel=\"noopener noreferrer nofollow\">\u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b<\/a> \u2014 \u0443\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c <em>\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435<\/em> \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>type V = `v${string}`<\/code> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 <code>v<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b. TS \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u0440\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u043c\u0435\u0440\u0436\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432: <code>'a' | 'b' &amp; `a${string}` = 'a'<\/code>. \u0415\u0449\u0451 TS \u0441\u0442\u0430\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043c\u0435\u0440\u0436\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430: <code>`a${string}` &amp; `b${string}`<\/code> \u2014 \u043e\u0447\u0435\u043d\u044c \u0438\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c <code>never<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0438 \u0441 <code>a<\/code>, \u0438 \u0441 <code>b<\/code>.<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u0431\u044b \u043c\u044b \u043d\u0438 \u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 TS \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442. \u0418\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u2014 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0442\u0438\u043f \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0440\u043e\u043c\u0435 <code>'a'<\/code>. \u041d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <code>Exclude&lt;string, 'a'><\/code>, \u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u043e TS \u043d\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u0442\u0438\u043f <code>string<\/code> \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432, \u044d\u0442\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043d\u043e\u0432\u0430 <code>string<\/code>. \u0428\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u043e\u0436\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0442\u0438\u043f.<\/p>\n<p>\u0422\u0438\u043f\u044b \u0447\u0438\u0441\u0435\u043b, \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0431\u0438\u0433\u0438\u043d\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u0430\u043a \u0436\u0435, \u043d\u043e \u0442\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438. \u0410 \u043c\u043d\u0435 \u0431\u044b \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0442\u0438\u043f\u044b \u00ab\u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00bb, \u00ab\u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 1\u00bb \u0438\u043b\u0438 \u00ab\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00bb. \u041d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e, \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/40d\/534\/841\/40d5348413466fa9e32931c52ccc1a1b.png\" width=\"786\" height=\"936\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/40d\/534\/841\/40d5348413466fa9e32931c52ccc1a1b.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0444, \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u0441 \u044f\u0437\u044b\u043a\u0430 \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 \u044f\u0437\u044b\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0417\u0430\u043e\u0434\u043d\u043e \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 TS. \u0422\u0435\u043f\u0435\u0440\u044c \u2014 \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435.<\/p>\n<p><strong>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e <code>const x: {} = 9<\/code> \u2014 \u0431\u0430\u0433 TS, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0430, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e TS-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 (\u043e\u043d\u0438 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043e\u043d\u0438 \u0436\u0435 Record) \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0430\u0445.<\/p>\n<p>\u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e <code>type Sum9 = { sum: 9 }<\/code> \u2014 \u0442\u0438\u043f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430-\u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043b\u0435\u0437\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442 <code>{ sum: 9 }<\/code>. \u0422\u0430\u043a \u0432\u043e\u0442, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0422\u0438\u043f <code>Sum9<\/code> \u0441\u0442\u043e\u0438\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u00ab\u0448\u0442\u0443\u0447\u043a\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 <code>sum<\/code> \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e <code>9<\/code>\u00bb. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u043b\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u2014 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u043e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u00ab\u0448\u0442\u0443\u043a\u00bb. \u0418 \u043e\u0431\u044b\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u2014 \u0432\u0435\u0434\u044c \u0432\u0441\u0435 \u043b\u044e\u0431\u044f\u0442 \u043f\u0438\u0445\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>(data: Sum9) => number<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435 <code>obj = { sum: 9, date: '2022-09-13' }<\/code> \u0431\u0435\u0437 \u0440\u0443\u0433\u0430\u043d\u0438 \u043e\u0442 TS.<\/p>\n<p>\u0417\u043d\u0430\u0447\u0438\u0442, \u0438 <code>type O = {}<\/code> \u2014 \u043d\u0435 \u0442\u0438\u043f \u00ab\u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u00bb \u0434\u043b\u044f \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430 <code>{}<\/code>, \u0430 \u00ab\u0448\u0442\u0443\u0447\u043a\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c, \u043d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043d\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u00bb. \u0421\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u0435\u0435, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430\u0448 \u00ab\u0431\u0430\u0433\u00bb: \u0435\u0441\u043b\u0438 <code>x = 9<\/code>, \u0442\u043e \u0448\u0442\u0443\u0447\u043a\u0430 <code>x<\/code> \u0443\u0434\u043e\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 <code>{}<\/code>. \u0421\u043f\u0430\u0441\u0438\u0431\u043e <a href=\"https:\/\/javascript.plainenglish.io\/javascript-boxing-wrappers-5b5ff9e5f6ab\" rel=\"noopener noreferrer nofollow\">\u0430\u0432\u0442\u043e\u0431\u043e\u043a\u0441\u0438\u043d\u0433\u0443,<\/a> \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u0436\u0435 \u0431\u043e\u043b\u0435\u0435 \u0441\u043c\u0435\u043b\u044b\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0432\u0440\u043e\u0434\u0435 <code>const x: { toString(): string } = 9<\/code> \u2014 \u043c\u044b \u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>x.toString()<\/code> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443? \u041c\u043e\u0436\u0435\u043c. \u0412\u0441\u0435 \u0447\u0435\u0441\u0442\u043d\u043e. \u0410 \u0432\u043e\u0442 <code>null<\/code> \u0438 <code>undefined<\/code> \u0432 \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0435 \u0432\u043b\u0435\u0437\u0443\u0442, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043d\u0438\u0445 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e. \u041d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0443\u043f\u0435\u0440-\u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u044f \u043f\u0443\u0442\u0430\u044e <code>|<\/code> \u0438 <code>&amp;<\/code>. \u0422\u0430\u043a \u0432\u043e\u0442, \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u043d\u0430 \u0442\u0438\u043f\u044b \u043a\u0430\u043a \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0430 \u043d\u0435 \u043d\u0430 \u00ab\u0444\u043e\u0440\u043c\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432\u00bb \u0438\u043b\u0438 \u00ab\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u00bb. \u0415\u0441\u043b\u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u0438 <code>name<\/code>, \u0438 <code>age<\/code>, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u2014 <code>{ name: string } &amp; { age: number }<\/code>.<\/p>\n<p>\u0410 \u0447\u0442\u043e \u043d\u0430\u0441\u0447\u0435\u0442 \u0442\u0438\u043f\u0430 <code>object<\/code>? \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u043e\u0442\u0440\u0435\u0437\u0430\u0435\u0442 \u043a\u0430\u043a\u0443\u044e-\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0447\u0442\u0438-\u0432\u0441\u0435\u0445-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442 \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b. \u0418 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 TS \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u00abJS-\u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u043d\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u00bb. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c \u0441 \u0442\u0438\u043f\u043e\u043c <code>object<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u00abJS-\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u043d\u043e \u043d\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b\u00bb \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>object &amp;amp; { toString(): string }<\/code> \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0447\u0438\u0441\u043b\u043e <code>9<\/code>.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u044d\u0442\u0438 \u0442\u0438\u043f\u044b \u043d\u0430 \u043d\u0430\u0448\u0443 \u0441\u0445\u0435\u043c\u0443 (\u043f\u043e\u0447\u0442\u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438):<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/016\/cf6\/b3d\/016cf6b3d32e208f3f29e23cec8df413.png\" width=\"831\" height=\"1055\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/016\/cf6\/b3d\/016cf6b3d32e208f3f29e23cec8df413.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>\u041f\u0430\u0440\u0430 \u0441\u043b\u043e\u0432 \u043f\u0440\u043e extends<\/strong><\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0440\u044b\u0432\u043a\u0430 \u043d\u0443\u0436\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u043d\u044c\u043a\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 <code>extends<\/code>. \u042d\u0442\u043e \u0441\u043b\u043e\u0432\u043e \u0438\u0437 \u041e\u041e\u041f, \u0433\u0434\u0435 \u0442\u0438\u043f <em>\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442<\/em> \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0432 \u0441\u043c\u044b\u0441\u043b\u0435 <em>\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/em>, \u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u043e\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u043f\u0443\u0442\u0430\u0435\u0442 \u043d\u0430\u0441 \u2014 \u0432\u0435\u0434\u044c <em>\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u043e\u0435<\/em> \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e.<\/p>\n<p>\u042f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043d\u0435 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e\u043c \u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0442\u0443\u0442 \u043d\u0435\u0442. \u041f\u0440\u043e\u0441\u0442\u043e \u0447\u0438\u0442\u0430\u0439\u0442\u0435 <code>A extends B<\/code> \u043a\u0430\u043a \u00abA \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c B\u00bb. \u041d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445:<\/p>\n<ul>\n<li>\n<p><code>0 | 1 extends 0<\/code> \u2014 \u043b\u043e\u0436\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <code>{0, 1}<\/code> \u2014 \u043d\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <code>{0}<\/code> (\u0434\u0430\u0436\u0435 \u0445\u043e\u0442\u044f <code>{0,1}<\/code> <em>\u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u0442<\/em> <code>{1}<\/code> \u0432 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435).<\/p>\n<\/li>\n<li>\n<p><code>never extends T<\/code> \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0430\u0432\u0434\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e <code>never<\/code> \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430. \u041a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0437\u0434\u0440\u0430\u0432\u043e\u0433\u043e \u0441\u043c\u044b\u0441\u043b\u0430 \u0442\u0443\u0442 \u043d\u0435\u0442, \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p><code>T extends never<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <code>T = never<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0443 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043d\u0435\u0442 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u043a\u0440\u043e\u043c\u0435 \u0441\u0435\u0431\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0412 <code>T extends string<\/code> \u0431\u0435\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432\u043b\u0435\u0437\u0443\u0442 \u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b, \u0438 \u0448\u0430\u0431\u043b\u043e\u043d, \u0438 \u043b\u044e\u0431\u043e\u0435 \u0438\u0445 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u0438 \u0441\u0430\u043c <code>string<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 <code>string<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u0410 \u0432\u043e\u0442 <code>T extends string ? string extends T ?<\/code> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e T <em>\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442<\/em> \u0441 \u0442\u0438\u043f\u043e\u043c <code>string<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e <code>string<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c, \u0438 \u043d\u0430\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c <code>string<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>unknown \u0438 any<\/strong><\/p>\n<p>\u0412 TS \u043d\u0435 \u043e\u0434\u0438\u043d, \u0430 \u0446\u0435\u043b\u044b\u0445 \u0434\u0432\u0430 \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u044e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435: <code>unknown<\/code> and <code>any<\/code>. \u0412 \u0447\u0451\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430? <code>unknown<\/code> \u0445\u043e\u0440\u043e\u0448\u043e \u043b\u043e\u0436\u0438\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438. \u042d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0445 \u043e\u0431\u0435\u0449\u0430\u043d\u0438\u0439. \u0422\u0443\u0442 \u0435\u0441\u0442\u044c \u0438 <code>null<\/code>, \u0438 <code>undefined<\/code>, \u0438 \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0438 \u0447\u0438\u0441\u043b\u043e:<\/p>\n<pre><code class=\"typescript\">\/\/ \u0422\u0443\u0442 \u0431\u0443\u0434\u0435\u0442 1 type Y = string | number | boolean | object | bigint | symbol | null | undefined extends unknown ? 1 : 0; \/\/ \u041f\u043e\u043a\u043e\u0440\u043e\u0447\u0435, \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u0435\u0439 {} type Y2 = {} | null | undefined extends unknown ? 1 : 0; \/\/ \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0442\u0443\u0442 \u0431\u0443\u0434\u0435\u0442 0: type N = unknown extends string ? 1 : 0;<\/code><\/pre>\n<p>\u0425\u043e\u0442\u044f \u0435\u0441\u0442\u044c \u0438 \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u044c.  <code>unknown<\/code> <em>\u043d\u0435<\/em> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>Exclude&lt;unknown, string><\/code> \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442.  <code>unknown extends string | number | boolean | object | bigint | symbol | null | undefined<\/code> \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0438\u0437 \u0447\u0435\u0433\u043e \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0447\u0442\u043e \u0432 JS \u0431\u044b\u0432\u0430\u044e\u0442 \u0435\u0449\u0451 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a). \u041d\u0443, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0434\u0435\u0442\u0430\u043b\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0410 \u0432\u043e\u0442 <code>any<\/code> \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432-\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u0441\u0442\u0440\u0430\u043d\u043d\u043e: <code>any extends string ? 1 : 0<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>0 | 1<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u00ab\u043d\u0435 \u0437\u043d\u0430\u044e\u00bb. \u0418 \u0434\u0430\u0436\u0435 <code>any extends never ? 1 : 0<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>0 | 1<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c <code>any<\/code> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u043f\u0443\u0441\u0442\u044b\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c.<\/p>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c, \u0447\u0442\u043e <code>any<\/code> \u2014 \u00ab\u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u043d\u043e \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u043e\u0435\u00bb \u2014 \u0432\u0440\u043e\u0434\u0435 <code>NaN<\/code> \u0432 \u043c\u0438\u0440\u0435 \u0442\u0438\u043f\u043e\u0432. \u041d\u043e \u044d\u0442\u0430 \u0433\u0438\u043f\u043e\u0442\u0435\u0437\u0430 \u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f \u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441\u044b <code>string extends any<\/code>, <code>unknown extends any<\/code> \u0438 \u0434\u0430\u0436\u0435 <code>any extends any<\/code> TS \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u00ab\u0434\u0430\u00bb \u0432\u043c\u0435\u0441\u0442\u043e \u00ab\u043d\u0435 \u0437\u043d\u0430\u044e\u00bb. \u0422\u0430\u043a \u0447\u0442\u043e <code>any<\/code> \u2014 \u043f\u0430\u0440\u0430\u0434\u043e\u043a\u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0441 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e.\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u2014 <code>any extends unknown<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 <code>any<\/code> \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0447\u0443\u0434\u043e-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0438 <code>unknown<\/code> \u2014 \u0432\u0441\u0435 \u0435\u0449\u0435 \u0432\u0441\u0435 JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0417\u0430\u043a\u043e\u043d\u0447\u0438\u043c \u043d\u0430\u0448\u0443 \u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0443 \u0442\u0438\u043f\u043e\u0432, \u0437\u0430\u0432\u0435\u0440\u043d\u0443\u0432 \u0435\u0451 \u0432 <code>unknown<\/code>, \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c <code>any<\/code> \u0432 \u0440\u043e\u043b\u0438 \u043f\u0435\u0440\u0441\u0442\u0430 \u0411\u043e\u0436\u044c\u0435\u0433\u043e:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/60e\/dfe\/358\/60edfe358cafd8414f6e3f8c211fd6eb.png\" width=\"931\" height=\"1325\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/60e\/dfe\/358\/60edfe358cafd8414f6e3f8c211fd6eb.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0443\u0437\u043d\u0430\u043b\u0438, \u0447\u0442\u043e \u0442\u0438\u043f\u044b TS\u00a0\u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e-\u0442\u0438\u043f\u043e\u0432\u043e\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043d\u0438\u043a:<\/p>\n<ul>\n<li>\n<p><code>unknown<\/code> \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e (\u0432\u0441\u0435 JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f)<\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e<\/p>\n<\/li>\n<li>\n<p><code>A extends B<\/code> \u2014 \u0410 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c B<\/p>\n<\/li>\n<li>\n<p><code>|<\/code> \u2014 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, <code>&amp;<\/code> \u2014 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p><code>Exclude<\/code> \u2014 \u043d\u0435\u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u043e\u043b\u044c\u043a\u043b\u043e\u0440, \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421 \u044d\u0442\u0438\u043c\u0438 \u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043c\u043e\u0438\u043c \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c:<\/p>\n<ul>\n<li>\n<p><code>&amp;<\/code> \u0438 <code>|<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 <em>\u0442\u043e\u043b\u044c\u043a\u043e<\/em> \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0430 \u043d\u0435 \u043d\u0430 \u00ab\u0444\u043e\u0440\u043c\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432\u00bb. \u0415\u0441\u043b\u0438 \u044f \u0445\u043e\u0447\u0443 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0443\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c, \u0438\u0445 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u044c.<\/p>\n<\/li>\n<li>\n<p><code>type &lt;T> = T extends string ? ...<\/code> \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0434\u043b\u044f <code>T = 'string'<\/code>, \u0438 \u0434\u043b\u044f <code>T = 'a' | 'b'<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u0442\u0438\u043f\u044b \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 <code>string<\/code><\/p>\n<\/li>\n<li>\n<p><code>unknown<\/code> \u2014 \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u00ab\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u0441\u0435\u0445 JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439\u00bb. <code>any<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0442\u0438\u043f\u043e\u0432 \u0438 \u0432\u0435\u0434\u0435\u0442 \u0441\u0435\u0431\u044f \u043d\u0435\u043b\u043e\u0433\u0438\u0447\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u043d\u0435 \u041d\u0418\u041a\u041e\u0413\u0414\u0410, \u0430 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u0420\u0430\u0437 <code>extends<\/code> \u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u00ab\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c\u00bb, \u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0438 \u0442\u043e, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043d\u0438\u043c \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0438 \u0447\u0442\u043e <code>never extends<\/code> \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e (\u0432\u0435\u0434\u044c \u0432\u0441\u0435 0 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0432 \u0447\u0451\u043c \u0443\u0433\u043e\u0434\u043d\u043e)<\/p>\n<\/li>\n<li>\n<p><code>{}<\/code> \u2014 \u043d\u0435 \u043e\u0441\u043e\u0431\u044b\u0439 \u0442\u0438\u043f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043b\u0435\u0437\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, \u0430 \u00ab\u0448\u0442\u0443\u043a\u0430 \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043e \u0442\u0438\u043f\u0430\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u00bb, \u0442\u0430\u043a \u0447\u0442\u043e \u0447\u0438\u0441\u043b\u043e 9 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442. <\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0432\u0441\u0451! \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 <a href=\"https:\/\/t.me\/thoughtspile\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b \u0432 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c\u0435<\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/713800\/\"> https:\/\/habr.com\/ru\/post\/713800\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><sub>\u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434, \u043d\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043c\u043e\u0435\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0435 \u0441\u043f\u0435\u0448\u0438\u0442\u0435 \u0443\u0431\u0435\u0433\u0430\u0442\u044c \u043d\u0430 \u00ab\u043d\u0435\u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043c\u044b\u0439 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u00bb.<\/sub><\/p>\n<p>\u042f \u043f\u0438\u0448\u0443 \u043d\u0430 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u0443\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u0430\u0432\u043d\u043e. \u041d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u0441\u0431\u0438\u0432\u0430\u044e\u0442 \u043c\u0435\u043d\u044f \u0441 \u0442\u043e\u043b\u043a\u0443:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438 <code>{ name: string }<\/code>, \u0438 <code>{ age: number }<\/code>, \u043d\u0443\u0436\u043d\u043e \u044d\u0442\u0438 \u0442\u0438\u043f\u044b <code>&amp;<\/code> (\u043f\u0435\u0440\u0435\u0441\u0435\u0447\u044c) \u0438\u043b\u0438 <code>|<\/code> (\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c)? \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043b\u043e\u0433\u0438\u043a\u0443, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f \u0445\u043e\u0447\u0443 \u043b\u0435\u0432\u043e\u0435 <em>\u0438<\/em> \u043f\u0440\u0430\u0432\u043e\u0435, \u043d\u043e, \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e <em>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435<\/em> \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0421\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043b\u0438 <code>type S&lt;T> = T extends string ? ...<\/code>, \u0435\u0441\u043b\u0438 <code>T<\/code> \u2014 \u044e\u043d\u0438\u043e\u043d \u0441\u0442\u0440\u043e\u043a, \u0432\u0440\u043e\u0434\u0435 <code>'ru' | 'de'<\/code>?<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0447\u0435\u043c \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0443 <code>any<\/code> \u0438 <code>unknown<\/code>? \u041b\u0443\u0447\u0448\u0435\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430 \u2014 \u0434\u0443\u0440\u0430\u0446\u043a\u0438\u0435 \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0438 \u0442\u0438\u043f\u0430 \u00abAvoid Any, Use Unknown\u00bb. \u0410 \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 <code>any<\/code>?<\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u0447\u0442\u043e \u0437\u0430 \u0442\u0438\u043f? \u00abnever \u043f\u043e-\u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438 \u0437\u043d\u0430\u0447\u0438\u0442 \u041d\u0418\u041a\u041e\u0413\u0414\u0410, \u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u041d\u0418\u041a\u041e\u0413\u0414\u0410 \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435\u00bb \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0434\u0440\u0430\u043c\u0430\u0442\u0438\u0447\u043d\u043e, \u043d\u043e \u043d\u0435 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 <code>never<\/code> \u044d\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0432\u0437\u0440\u044b\u0432, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043c\u043e\u0433\u0443 <code>const x: number = y as never<\/code>? \u0418 \u043f\u043e\u0447\u0435\u043c\u0443 <code>never<\/code> \u0432\u0441\u0435\u0433\u0434\u0430  <code>extends X<\/code>?<\/p>\n<\/li>\n<li>\n<p><code>const x: {} = true;<\/code> \u2014 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u0443 \u043a\u0430\u043a \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435, \u0430? <code>true<\/code> \u0442\u043e\u0447\u043d\u043e \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043b\u0435\u0433\u043a\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0432\u0441\u0435 \u044d\u0442\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u2014 \u0432\u044b \u043c\u043e\u043b\u043e\u0434\u0435\u0446. \u041f\u0440\u0430\u0432\u0434\u0430. \u0417\u0434\u043e\u0440\u043e\u0432\u043e, \u0447\u0442\u043e \u0432 \u043c\u0438\u0440\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0443\u043c\u043d\u044b\u0435 \u043b\u044e\u0434\u0438. \u042f \u0432\u043e\u0442 \u043d\u0435 \u043c\u043e\u0433, \u0438 \u0440\u0435\u0448\u0438\u043b \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c. \u041f\u043e\u043a\u0430 \u044f \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u043b\u0441\u044f \u0441 <code>never<\/code>, \u043c\u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0430\u0441\u044c <a href=\"https:\/\/www.zhenghao.io\/posts\/ts-never\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a> (\u0434\u0430 \u0438 \u0432\u0435\u0441\u044c \u044d\u0442\u043e\u0442 \u0431\u043b\u043e\u0433 \u043e\u0447\u0435\u043d\u044c \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043e\u0434\u043d\u0430 \u043e\u0441\u043e\u0431\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430\u044f \u043c\u044b\u0441\u043b\u044c: <em>\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435<\/em> <code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0441\u0432\u043e\u044e \u0434\u0443\u0448\u0443 \u0438\u0434\u0435\u044e, \u0447\u0442\u043e \u0442\u0438\u043f \u2014 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u0441\u0451 \u0432\u0441\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0432\u043e\u0438 \u043c\u0435\u0441\u0442\u0430. \u042f \u0443\u0448\u0435\u043b \u0432 \u043f\u0435\u0449\u0435\u0440\u0443, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b \u0432\u0441\u0435 \u0441\u0432\u043e\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0435, \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0431\u0440\u0430\u043b \u0438\u0445 \u043d\u0430 \u043c\u0435\u0441\u0442\u043e \u043f\u043e \u0447\u0435\u0440\u0442\u0435\u0436\u0443 \u0438\u0437 \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043b\u043e\u0433\u0438\u0447\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<ul>\n<li>\n<p>\u041e\u0441\u0432\u0435\u0436\u0438\u043c \u043d\u0430\u0448\u0438 \u0437\u043d\u0430\u043d\u0438\u044f \u043e \u0442\u0435\u043e\u0440\u0438\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u043e\u043d\u044f\u0442\u0438\u044f TS \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438 \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u043d\u0430 \u043d\u0438\u0445.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0438\u043d\u043a\u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u043d\u0430 \u044f\u0437\u044b\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0431\u0443\u043b\u0435\u0432\u044b \u0442\u0438\u043f\u044b (\u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u2014 <code>null<\/code> \u0438 <code>undefined<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u043e\u0431\u0449\u0438\u043c \u044d\u0442\u043e \u043d\u0430 \u0447\u0438\u0441\u043b\u0430 (\u0438 \u043f\u043e\u0445\u043e\u0434\u0443 \u0432\u044b\u044f\u0441\u043d\u0438\u043c, \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b TS \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c \u2014 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u044f \u0434\u0443\u043c\u0430\u043b!<\/p>\n<\/li>\n<li>\n<p>\u0418 \u043d\u0430 \u0434\u0435\u0441\u0435\u0440\u0442 \u2014 \u0440\u0430\u0437\u043b\u043e\u0436\u0438\u043c \u043f\u043e \u043f\u043e\u043b\u043e\u0447\u043a\u0430\u043c <code>any<\/code> \u0438 <code>undefined<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u044f \u043d\u0430\u0445\u043e\u0436\u0443 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0441\u0435 \u0441\u0432\u043e\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u044b, \u0432\u044b\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e TS \u0432 \u0441\u0442\u0440\u043e\u0439\u043d\u0443\u044e \u0442\u0435\u043e\u0440\u0438\u044e, \u0438 \u0440\u0438\u0441\u0443\u044e \u044d\u0442\u0443 <em>\u0432\u0435\u043b\u0438\u043a\u043e\u043b\u0435\u043f\u043d\u0443\u044e<\/em> \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0422\u0435\u043e\u0440\u0438\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432<\/strong><\/p>\n<p>\u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0441\u0432\u0435\u0436\u0438\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0442\u0435\u043e\u0440\u0438\u044e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438 \u0442\u0430\u043a \u0432\u0441\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u043b\u0438\u0441\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435, \u043d\u043e \u044f \u043a\u043e\u043d\u0447\u0430\u043b \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u044b \u0434\u0430\u0432\u043d\u043e \u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0440\u0430\u0441\u043f\u0438\u0448\u0443, \u0447\u0442\u043e \u043a \u0447\u0435\u043c\u0443.<\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0430 \u0434\u0435\u0442\u0441\u0430\u0434\u043e\u0432\u0441\u043a\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435: \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u044f\u0431\u043b\u043e\u043a\u0430 \u2014 \u044d\u0442\u043e \u043d\u0430\u0448\u0438 <em>\u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.<\/em> \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0438\u0445 \u044f\u0431\u043b\u043e\u043a\u043e \u0432\u0430\u0441\u044f \u0438 \u044f\u0431\u043b\u043e\u043a\u043e \u043f\u0435\u0442\u044f. \u0415\u0449\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u0438\u043a\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0431\u043b\u043e\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043a\u043b\u0430\u0441\u0442\u044c \u2014 \u044d\u0442\u043e <em>\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.<\/em> \u0412\u0441\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043d\u0430\u0431\u0440\u0430\u0442\u044c \u044f\u0431\u043b\u043e\u043a \u0432 \u043f\u0430\u043a\u0435\u0442:<\/p>\n<ol>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441 \u044f\u0431\u043b\u043e\u043a\u043e\u043c \u0432\u0430\u0441\u0435\u0439, <code>{ \u0432\u0430\u0441\u044f }<\/code> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043f\u0438\u0448\u0443\u0442 \u043a\u0430\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441 \u044f\u0431\u043b\u043e\u043a\u043e\u043c \u043f\u0435\u0442\u0435\u0439, <code>{ \u043f\u0435\u0442\u044f }<\/code>, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u043a\u0435\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u044f\u0431\u043b\u043e\u043a\u0430\u043c\u0438, <code>{ \u0432\u0430\u0441\u044f, \u043f\u0435\u0442\u044f }<\/code>. \u0412 \u043a\u0430\u043a\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u043c\u044b \u0438\u0445 \u0442\u0443\u0434\u0430 \u043a\u043b\u0430\u043b\u0438 \u2014 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0432\u0430\u0436\u043d\u043e. \u041d\u0435 \u0445\u043e\u0447\u0443 \u0432\u0430\u0441 \u043f\u0443\u0433\u0430\u0442\u044c, \u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 <em>\u0443\u043d\u0438\u0432\u0435\u0440\u0441\u043e\u043c,<\/em> \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u043d\u0430\u0448\u0435\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u043c\u0438\u0440\u0430 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043a\u0440\u043e\u043c\u0435 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u044f\u0431\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0415\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u044c \u0432 \u043f\u0430\u043a\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f <em>\u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e.<\/em> \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043e\u0441\u043e\u0431\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u2205<\/p>\n<\/li>\n<\/ol>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0447\u0430\u0441\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u043d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0412\u0435\u043d\u043d\u0430 \u2014 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u043b\u043e\u0436\u0435\u043d\u044b \u043d\u0430 \u043f\u043b\u043e\u0441\u043a\u043e\u0441\u0442\u0438, \u0438 \u043c\u044b \u043e\u0431\u0432\u043e\u0434\u0438\u043c \u0438\u0445 \u043a\u0440\u0443\u0436\u043e\u0447\u043a\u0430\u043c\u0438:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00abR \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043a\u0440\u0430\u0441\u043d\u044b\u0445 \u044f\u0431\u043b\u043e\u043a\u00bb \u044d\u0442\u043e R = { \u0432\u0430\u0441\u044f } (\u0435\u0441\u043b\u0438 \u0432\u0430\u0441\u044f \u2014 \u043a\u0440\u0430\u0441\u043d\u044b\u0439, \u0430 \u043f\u0435\u0442\u044f \u0435\u0449\u0451 \u0437\u0435\u043b\u0451\u043d\u044b\u0439).<\/p>\n<p>\u041c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e A \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c B, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b A \u0432\u0445\u043e\u0434\u044f\u0442 \u0432 B. \u0412 \u043d\u0430\u0448\u0435\u043c \u044f\u0431\u043b\u043e\u0447\u043d\u043e\u043c \u043c\u0438\u0440\u0435 { \u0432\u0430\u0441\u044f }\u00a0&#8212; \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e { \u0432\u0430\u0441\u044f, \u043f\u0435\u0442\u044f }, \u043d\u043e { \u043f\u0435\u0442\u044f } \u2014 \u043d\u0435 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e { \u0432\u0430\u0441\u044f }. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041b\u044e\u0431\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0431\u044f<\/p>\n<\/li>\n<li>\n<p>\u041b\u044e\u0431\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<li>\n<p>\u041f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 <em>C = A \u222a B<\/em> \u2014 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0445\u043e\u0442\u044f \u0431\u044b \u0432 A \u0438\u043b\u0438 \u0432 B (\u0441\u0432\u0430\u043b\u0438\u043b\u0438 \u0434\u0432\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 \u0432 \u043e\u0434\u0438\u043d). \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, <em>A \u222a \u2205 = A<\/em><\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 <em>C = A \u2229 B<\/em> \u2014 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 A, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0445\u043e\u0434\u044f\u0442 \u0435\u0449\u0435 \u0438 \u0432 B. \u041b\u043e\u0433\u0438\u0447\u043d\u043e, \u0447\u0442\u043e <em>A \u2229 \u2205 = \u2205<\/em><\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u043d\u043e\u0441\u0442\u044c <em>C = A \\ B<\/em> \u2014 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 A, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 <em>\u043d\u0435\u0442<\/em> \u0432 B. \u0411\u0435\u0437 \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u0439, <em>A \\ \u2205 = A<\/em><\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0441\u0451, \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u0430\u0439\u043f\u0441\u043a\u0440\u0438\u043f\u0442\u0435. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043a \u0442\u0438\u043f\u0430\u043c.<\/p>\n<p><strong>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043f\u0440\u0438 \u0447\u0435\u043c \u0442\u0443\u0442 \u0442\u0438\u043f\u044b?<\/strong><\/p>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0435\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0439 \u043f\u043e\u0432\u043e\u0440\u043e\u0442: \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, <em>\u0442\u0438\u043f<\/em> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e JavaScript \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u2014 \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0432 JS-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0438\u043f (\u0434\u0430\u0436\u0435 \u043d\u0435 TS-\u0442\u0438\u043f, \u043f\u0440\u043e\u0441\u0442\u043e <em>\u0442\u0438\u043f<\/em>) \u2014 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e JS-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>TS \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0438\u043f\u044b, \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u2014 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442. \u041d\u0435 \u0432\u0435\u0440\u0438\u0442\u0435? \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f \u00ab\u0432\u0441\u0435 \u0447\u0438\u0441\u043b\u0430, \u043a\u0440\u043e\u043c\u0435 0\u00bb.<\/p>\n<\/li>\n<li>\n<p><code>A extends B<\/code> \u0438\u0437 <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/conditional-types.html\" rel=\"noopener noreferrer nofollow\">\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/a> \u0438 <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/generics.html#generic-constraints\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u043d\u0441\u0442\u0440\u0435\u0439\u043d\u0442\u043e\u0432<\/a> \u043c\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u00abA \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e B\u00bb.<\/p>\n<\/li>\n<li>\n<p>TS-\u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b <code>|<\/code> \u0438 <code>&amp;<\/code> \u2014 \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u043a\u0430\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432.<\/p>\n<\/li>\n<li>\n<p><code>Exclude&lt;A, B><\/code> \u043f\u043e \u0438\u0434\u0435\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432, \u043d\u043e \u044d\u0442\u043e\u0442 \u0434\u0436\u0438\u043d\u0435\u0440\u0438\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0435 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 A \u0438 B (\u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0447\u0438\u0441\u043b\u043e\u043c-\u043a\u0440\u043e\u043c\u0435-0, <code>Exclude&lt;number, 0><\/code> \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442).<\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e. \u0414\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u043e: \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e A <code>A &amp; never = never<\/code> b <code>A | never = A<\/code>, \u0430 <code>Exclude&lt;0, 0> = never<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u044d\u0442\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u044c, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435.<\/p>\n<p><strong>\u0411\u0443\u043b\u0435\u0432\u044b \u0442\u0438\u043f\u044b<\/strong><\/p>\n<p>\u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0438\u0434, \u0447\u0442\u043e \u0432 JS \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043b\u0435\u0432\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f (\u044f \u043d\u0435 \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u043c). \u0422\u0430\u043a\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0440\u043e\u0432\u043d\u043e \u0434\u0432\u0430: <code>true<\/code> \u0438 <code>false<\/code>, \u0438\u043b\u0438, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043d\u0430\u0448 \u043f\u0440\u0435\u043f\u043e\u0434, \u0442\u0440\u044e\u044d \u0438 \u0444\u0430\u043b\u0437\u0451. \u042d\u0442\u043e \u0442\u0435 \u0436\u0435 \u044f\u0431\u043b\u043e\u0447\u043a\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c. \u041d\u0430 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u0445 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c 4 \u0442\u0438\u043f\u0430:<\/p>\n<ul>\n<li>\n<p>\u0422\u0438\u043f\u044b-\u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b <code>true<\/code> \u0438 <code>false<\/code>, \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u2014 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p><code>boolean<\/code>, \u0442\u0438\u043f \u0438\u0437 \u043e\u0431\u043e\u0438\u0445 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0418 <code>never<\/code> \u0432 \u0440\u043e\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0442\u0430 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0434\u043b\u044f \u044f\u0431\u043b\u043e\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0443\u043f\u0440\u0430\u0436\u043d\u044f\u0435\u043c\u0441\u044f \u0432 \u0442\u0435\u043b\u0435\u043f\u043e\u0440\u0442\u0430\u0446\u0438\u0438 \u0438\u0437 \u043c\u0438\u0440\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0432 \u043c\u0438\u0440 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<ul>\n<li>\n<p><code>boolean<\/code> \u2014 \u0442\u043e \u0436\u0435, \u0447\u0442\u043e <code>true | false<\/code> (\u043d\u0430 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u0435, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u044d\u0442\u043e\u0442 \u0442\u0438\u043f \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 TS)<\/p>\n<\/li>\n<li>\n<p><code>true<\/code> \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e (\u0438\u043b\u0438 \u043f\u043e\u0434\u0442\u0438\u043f) <code>boolean<\/code><\/p>\n<\/li>\n<li>\n<p><code>never<\/code> \u2014 \u043f\u0443\u0441\u0442\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0437\u043d\u0430\u0447\u0438\u0442, <code>never<\/code> \u2014 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0442\u0438\u043f\u043e\u0432 <code>true<\/code>, <code>false<\/code> \u0438 <code>boolean<\/code><\/p>\n<\/li>\n<li>\n<p><code>&amp;<\/code> \u2014 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435, \u0437\u043d\u0430\u0447\u0438\u0442, <code>false &amp; true = never<\/code>, <code>boolean &amp; true = { true, false } | { true } = true<\/code> (\u0442\u043e \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 <code>boolean<\/code> \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435), <code>true &amp;amp; never = never<\/code> \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.<\/p>\n<\/li>\n<li>\n<p><code>|<\/code> \u2014 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435, \u0437\u043d\u0430\u0447\u0438\u0442, <code>true | never = true<\/code>, \u0430 <code>boolean | true = boolean<\/code> (\u0442\u043e \u0435\u0441\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 <code>boolean<\/code> \u00ab\u043f\u0440\u043e\u0433\u043b\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u00bb \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0438 \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0435\u0433\u043e \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438).<\/p>\n<\/li>\n<li>\n<p>\u0418 \u0434\u0430\u0436\u0435 <code>Exclude<\/code> \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043d\u043e\u0441\u0442\u044c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432: <code>Exclude&lt;boolean, true> = false<\/code> (\u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a).<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0442\u0440\u0435\u043d\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 extends-\u0443\u0441\u043b\u043e\u0432\u0438\u044f\u0445:<\/p>\n<pre><code class=\"typescript\">type A = boolean extends never ? 1 : 0; type B = true extends boolean ? 1 : 0; type C = never extends false ? 1 : 0; type D = never extends never ? 1 : 0;<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e <code>extends<\/code> \u043c\u043e\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u00ab\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c\u00bb, \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u2014 A0,B1,C1,D1. \u0425\u043e\u0442\u044f \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a <code>never<\/code> \u043c\u043e\u0436\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u044d\u043a\u0441\u0442\u0435\u043d\u0434\u0438\u0442\u044c. \u042d\u0442\u043e \u0443\u0441\u043f\u0435\u0445.<\/p>\n<p>\u0422\u0438\u043f\u044b <code>null<\/code> \u0438 <code>undefined<\/code> \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 <code>boolean<\/code>, \u043d\u043e \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u043d\u0438\u0445 \u0432\u0441\u0435\u0433\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e (\u0438\u043b\u0438 \u043f\u043e \u0434\u0432\u0430 TS-\u0442\u0438\u043f\u0430 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c <code>never<\/code>). <code>null &amp; boolean = null &amp; undefined = boolean &amp; undefined = never<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u0434\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0443\u0445 JS-\u0442\u0438\u043f\u043e\u0432 (\u0442\u043e \u0435\u0441\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 JS-\u0442\u0438\u043f\u044b \u2014 \u043d\u0435\u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0449\u0438\u0435\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430). \u041d\u0430\u043d\u0435\u0441\u0435\u043c \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0430 \u043d\u0430\u0448\u0443 \u043a\u0430\u0440\u0442\u0443:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b<\/strong><\/p>\n<p>\u041e\u043a\u0435\u0439, \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0441\u0442\u0440\u043e\u043a\u0430\u043c. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0443\u0442 \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435: <code>string<\/code> \u2014 \u0442\u0438\u043f \u0432\u0441\u0435\u0445 JS-\u0441\u0442\u0440\u043e\u043a, \u0430 \u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b-\u0442\u0438\u043f: <code>const str: 'hi' = 'hi'<\/code>. \u041d\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u0438\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043d\u044e\u0430\u043d\u0441 \u2014 \u0441\u0442\u0440\u043e\u043a, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e. (\u0412 \u043f\u0430\u043c\u044f\u0442\u044c \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0432\u043b\u0435\u0437\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a? \u041d\u0435 \u0434\u0443\u0448\u043d\u0438\u0442\u0435, \u0438\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435, \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0442\u0438\u043f\u043e\u0432 \u043d\u0435\u0433\u043e\u0436\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u0433\u0440\u044f\u0437\u043d\u044b\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c \u043c\u0438\u0440\u043e\u043c).<\/p>\n<p>\u041a\u0430\u043a \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u043e\u0431\u0449\u0435, \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u0432 TS \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 <code>|<\/code> \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e (\u0442\u0438\u043f) \u0441\u0442\u0440\u043e\u043a \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>type Country = 'de' | 'us'<\/code>. \u0410 \u0432\u043e\u0442 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u0434\u0432\u0443\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432) \u2014 \u043d\u0435\u043b\u044c\u0437\u044f, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e.<\/p>\n<\/li>\n<li>\n<p>(\u041e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e) \u0441\u0432\u0435\u0436\u0430\u044f \u0444\u0438\u0447\u0430 TS \u2014 <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/template-literal-types.html\" rel=\"noopener noreferrer nofollow\">\u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b<\/a> \u2014 \u0443\u043c\u0435\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c <em>\u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435<\/em> \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u2014 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>type V = `v${string}`<\/code> \u2014 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0441 <code>v<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043d\u0430\u043a\u043e\u0432\u044b\u0440\u044f\u0442\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044b. TS \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043a\u0440\u0443\u0442, \u0447\u0442\u043e\u0431\u044b \u0441\u043c\u0435\u0440\u0436\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432: <code>'a' | 'b' &amp; `a${string}` = 'a'<\/code>. \u0415\u0449\u0451 TS \u0441\u0442\u0430\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043c\u0435\u0440\u0436\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430: <code>`a${string}` &amp; `b${string}`<\/code> \u2014 \u043e\u0447\u0435\u043d\u044c \u0438\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c <code>never<\/code>, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0438 \u0441 <code>a<\/code>, \u0438 \u0441 <code>b<\/code>.<\/p>\n<p>\u041d\u043e \u043a\u0430\u043a \u0431\u044b \u043c\u044b \u043d\u0438 \u0441\u0442\u0430\u0440\u0430\u043b\u0438\u0441\u044c, \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 TS \u043d\u0435 \u0432\u044b\u0439\u0434\u0435\u0442. \u0418\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u2014 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0442\u0438\u043f \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u0440\u043e\u043c\u0435 <code>'a'<\/code>. \u041d\u0430 \u0443\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 <code>Exclude&lt;string, 'a'><\/code>, \u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u043e TS \u043d\u0435 \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u0443\u0435\u0442 \u0442\u0438\u043f <code>string<\/code> \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432, \u044d\u0442\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043d\u043e\u0432\u0430 <code>string<\/code>. \u0428\u0430\u0431\u043b\u043e\u043d\u044b \u0442\u043e\u0436\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0442\u0438\u043f.<\/p>\n<p>\u0422\u0438\u043f\u044b \u0447\u0438\u0441\u0435\u043b, \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u0431\u0438\u0433\u0438\u043d\u0442\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u0430\u043a \u0436\u0435, \u043d\u043e \u0442\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u043c\u044b \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u043c\u0438. \u0410 \u043c\u043d\u0435 \u0431\u044b \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u0442\u0438\u043f\u044b \u00ab\u0446\u0435\u043b\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00bb, \u00ab\u0447\u0438\u0441\u043b\u043e \u043e\u0442 0 \u0434\u043e 1\u00bb \u0438\u043b\u0438 \u00ab\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e\u00bb. \u041d\u0443 \u0434\u0430 \u043b\u0430\u0434\u043d\u043e, \u0432\u0441\u0451 \u0432\u043c\u0435\u0441\u0442\u0435:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0444, \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u043e\u0431\u0441\u0443\u0434\u0438\u043b\u0438! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u043c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u0441 \u044f\u0437\u044b\u043a\u0430 \u0442\u0438\u043f\u043e\u0432 \u043d\u0430 \u044f\u0437\u044b\u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u0417\u0430\u043e\u0434\u043d\u043e \u043c\u044b \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0442\u0438\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 TS. \u0422\u0435\u043f\u0435\u0440\u044c \u2014 \u0441\u0430\u043c\u043e\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0435.<\/p>\n<p><strong>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0438 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e <code>const x: {} = 9<\/code> \u2014 \u0431\u0430\u0433 TS, \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0432\u043c\u0435\u0441\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0430, \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e TS-\u043e\u0431\u044a\u0435\u043a\u0442\u0430\u0445 (\u043e\u043d\u0438 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b, \u043e\u043d\u0438 \u0436\u0435 Record) \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043d\u0430 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u0441\u044b\u043b\u043a\u0430\u0445.<\/p>\n<p>\u0412\u043e \u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e <code>type Sum9 = { sum: 9 }<\/code> \u2014 \u0442\u0438\u043f \u0434\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430-\u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043b\u0435\u0437\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442 <code>{ sum: 9 }<\/code>. \u0422\u0430\u043a \u0432\u043e\u0442, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. \u0422\u0438\u043f <code>Sum9<\/code> \u0441\u0442\u043e\u0438\u0442 \u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043a \u00ab\u0448\u0442\u0443\u0447\u043a\u0430, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 <code>sum<\/code> \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e <code>9<\/code>\u00bb. \u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0438\u043f \u043f\u043e\u043b\u044f \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u2014 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u0442\u0441\u0435\u043a\u0430\u0435\u0442 \u0447\u0442\u043e-\u0442\u043e \u043e\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u00ab\u0448\u0442\u0443\u043a\u00bb. \u0418 \u043e\u0431\u044b\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u2014 \u0432\u0435\u0434\u044c \u0432\u0441\u0435 \u043b\u044e\u0431\u044f\u0442 \u043f\u0438\u0445\u0430\u0442\u044c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>(data: Sum9) => number<\/code> \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0432\u0440\u043e\u0434\u0435 <code>obj = {<\/code><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-344745","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344745","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=344745"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/344745\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=344745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=344745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=344745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}