{"id":363180,"date":"2024-05-21T01:50:32","date_gmt":"2024-05-21T01:50:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=363180"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=363180","title":{"rendered":"<span>\u0424\u0443\u043d\u043a\u0446\u0438\u044f TypeScript 5.3, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u043c \u043d\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438<\/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>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438\u00a0&#171;<a href=\"https:\/\/www.totaltypescript.com\/the-typescript-5-3-feature-they-didn-t-tell-you-about\" rel=\"noopener noreferrer nofollow\">The TypeScript 5.3 Feature They Didn&#8217;t Tell You About<\/a>&#171;.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0432\u0435\u0434\u0443 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b \u201c<a href=\"https:\/\/t.me\/frontend_pasta\" rel=\"noopener noreferrer nofollow\"><u>Frontend \u043f\u043e-\u0444\u043b\u043e\u0442\u0441\u043a\u0438<\/u><\/a>\u201d, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043f\u0440\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0438\u0437 \u043c\u0438\u0440\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>20 \u043d\u043e\u044f\u0431\u0440\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 TypeScript \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0430 TS 5.3.<\/p>\n<p>\u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u044f \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u0430\u043d\u043e\u043d\u0441\u0435, \u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b \u043a\u043e\u0435-\u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 TypeScript 5.3 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u0445 \u043a \u0440\u0435\u043b\u0438\u0437\u0443.<\/p>\n<h2>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430<\/h2>\n<pre><code class=\"typescript\">\/\/ \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 5.2, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 5.3! const array = [\"a\", \"b\", \"c\"] as const satisfies string[];   const returnWhatIPassIn = &lt;const T extends any[]>(t: T) => {   return t; };   \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 - any[] \u0432 TS 5.2, \u043d\u043e ['a', 'b', 'c'] \u0432 5.3 const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<h3>\u041f\u043e\u043b\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0432 TS \u043c\u043e\u0436\u0435\u0442 \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u043e\u0443\u0442\u043e\u0432 \u043a\u0430\u043a const.<\/p>\n<p>\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u0443\u0442\u044b, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0438\u043f\u0430.<\/p>\n<pre><code class=\"typescript\">const arrayOfRoutes = [   { path: \"\/home\", component: Home },   { path: \"\/about\", component: About }, ] as const;  \/\/ type Route = \"\/home\" | \"\/about\" type Route = (typeof arrayOfRoutes)[number][\"path\"];<\/code><\/pre>\n<p>\u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 <code>arrayOfRoutes<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443?<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c satisfies.<\/p>\n<pre><code class=\"typescript\">const arrayOfRoutes = [   { path: \"\/home\", component: Home },   { path: \"\/about\", component: About }, ] as const satisfies {   path: string;   component: React.FC; }[];  \/\/ \u0422\u0438\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \"readonly\" \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \/\/ \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u043c\u0443 \u0442\u0438\u043f\u0443<\/code><\/pre>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 TypeScript 5.2 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0435! \u041d\u043e&#8230; \u041f\u043e\u0447\u0435\u043c\u0443?<\/p>\n<h2>\u041c\u0430\u0441\u0441\u0438\u0432\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b<\/h2>\n<p>\u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e <code>arrayOfRoutes<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0430 \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u043c, \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <code>readonly<\/code>:<\/p>\n<pre><code class=\"typescript\">const arrayOfRoutes = [   { path: \"\/home\", component: Home },   { path: \"\/about\", component: About }, ] as const satisfies readonly {   path: string;   component: React.FC; }[];   \/\/ \u041e\u0448\u0438\u0431\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442!<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, TypeScript \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432.<\/p>\n<h2>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 Const<\/h2>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0442\u0438\u043f\u0430 <code>const<\/code>, \u043d\u043e \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u043f\u0430\u0433\u0443\u0431\u043d\u043e.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>const<\/code> \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432\u0435\u0449\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u0443\u044e \u0432 <code>T<\/code>, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 <code>const<\/code>.<\/p>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u044d\u0442\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<pre><code class=\"typescript\">const returnWhatIPassIn = &lt;const T extends any[]>(t: T) => {   return t; };   \/\/ \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: any[] \u0432 TS 5.2! const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u0414\u043e \u0432\u0435\u0440\u0441\u0438\u0438 TS 5.3 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 <code>readonly<\/code> \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 <code>type<\/code>:<\/p>\n<pre><code class=\"typescript\">const returnWhatIPassIn = &lt;const T extends readonly any[]>(   t: T ) => {   return t; };   \/\/ \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: ['a', 'b', 'c']! const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0442\u0440\u0443\u0434\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 <code>const<\/code>.<\/p>\n<h2>\u041a\u0430\u043a TypeScript 5.3 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e<\/h2>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 5.3, TypeScript \u0441\u043c\u044f\u0433\u0447\u0438\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 TypeScript \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>satisfies<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441 <code>readonly<\/code>:<\/p>\n<pre><code class=\"typescript\">\/\/ \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 5.2, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 5.3! \/\/ const array: [\"a\", \"b\", \"c\"] const array = [\"a\", \"b\", \"c\"] as const satisfies string[];<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 <code>Const<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"typescript\">const returnWhatIPassIn = &lt;const T extends any[]>(t: T) => {   return t; };   \/\/ \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: any[] \u0432 TS 5.2, \u043d\u043e ['a', 'b', 'c'] \u0432 5.3 \/\/ const result: [\"a\", \"b\", \"c\"] const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443! \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 readonly <code>string[]<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>string[<\/code>], \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u044b \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432 readonly.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>readonly<\/code>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"typescript\">\/\/ \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 5.2, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 5.3! \/\/ const array: readonly [\"a\", \"b\", \"c\"] const array = [   \"a\",   \"b\",   \"c\", ] as const satisfies readonly string[];  const returnWhatIPassIn = &lt;const T extends readonly any[]>(   t: T ) => {   return t; };   \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 - any[] \u0432 TS 5.2, \u043d\u043e ['a', 'b', 'c'] \u0432 5.3 \/\/ const result: readonly [\"a\", \"b\", \"c\"] const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435, \u0434\u0435\u043b\u0430\u044e\u0449\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u0430\u043a \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 <code>const<\/code>, \u0442\u0430\u043a \u0438 \u0441 <code>satisfies<\/code> \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>TypeScript &#8212; \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u0440\u0438\u0447\u0430\u0442\u044c \u043e \u0442\u0430\u043a\u0438\u0445 \u0432\u0435\u0449\u0430\u0445! \u041e\u0447\u0435\u043d\u044c \u0441\u043a\u043e\u0440\u043e \u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044e \u0441\u0432\u043e\u0439 \u043a\u0443\u0440\u0441, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043d\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/781230\/\"> https:\/\/habr.com\/ru\/articles\/781230\/<\/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>\u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438\u00a0&#171;<a href=\"https:\/\/www.totaltypescript.com\/the-typescript-5-3-feature-they-didn-t-tell-you-about\" rel=\"noopener noreferrer nofollow\">The TypeScript 5.3 Feature They Didn&#8217;t Tell You About<\/a>&#171;.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0432\u0435\u0434\u0443 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043a\u0430\u043d\u0430\u043b \u201c<a href=\"https:\/\/t.me\/frontend_pasta\" rel=\"noopener noreferrer nofollow\"><u>Frontend \u043f\u043e-\u0444\u043b\u043e\u0442\u0441\u043a\u0438<\/u><\/a>\u201d, \u0433\u0434\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043f\u0440\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0438\u0437 \u043c\u0438\u0440\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432.<\/p>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>20 \u043d\u043e\u044f\u0431\u0440\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 TypeScript \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0430 TS 5.3.<\/p>\n<p>\u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u044f \u043f\u0440\u043e\u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u0430\u043d\u043e\u043d\u0441\u0435, \u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043b \u043a\u043e\u0435-\u0447\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u0432\u0430\u0436\u043d\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u0432 TypeScript 5.3 \u043d\u0435 \u0431\u044b\u043b\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u0445 \u043a \u0440\u0435\u043b\u0438\u0437\u0443.<\/p>\n<h2>\u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430<\/h2>\n<pre><code class=\"typescript\">\/\/ \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 5.2, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 5.3! const array = [\"a\", \"b\", \"c\"] as const satisfies string[];   const returnWhatIPassIn = &lt;const T extends any[]>(t: T) => {   return t; };   \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 - any[] \u0432 TS 5.2, \u043d\u043e ['a', 'b', 'c'] \u0432 5.3 const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<h3>\u041f\u043e\u043b\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435<\/h3>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0432 TS \u043c\u043e\u0436\u0435\u0442 \u0438\u043d\u043e\u0433\u0434\u0430 \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430.<\/p>\n<p>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u043e\u0443\u0442\u043e\u0432 \u043a\u0430\u043a const.<\/p>\n<p>\u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u0430\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u0443\u0442\u044b, \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0438\u043f\u0430.<\/p>\n<pre><code class=\"typescript\">const arrayOfRoutes = [   { path: \"\/home\", component: Home },   { path: \"\/about\", component: About }, ] as const;  \/\/ type Route = \"\/home\" | \"\/about\" type Route = (typeof arrayOfRoutes)[number][\"path\"];<\/code><\/pre>\n<p>\u041d\u043e \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 <code>arrayOfRoutes<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0442\u0438\u043f\u0443?<\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c satisfies.<\/p>\n<pre><code class=\"typescript\">const arrayOfRoutes = [   { path: \"\/home\", component: Home },   { path: \"\/about\", component: About }, ] as const satisfies {   path: string;   component: React.FC; }[];  \/\/ \u0422\u0438\u043f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \"readonly\" \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \/\/ \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u043c\u0443 \u0442\u0438\u043f\u0443<\/code><\/pre>\n<p>\u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432 TypeScript 5.2 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0435! \u041d\u043e&#8230; \u041f\u043e\u0447\u0435\u043c\u0443?<\/p>\n<h2>\u041c\u0430\u0441\u0441\u0438\u0432\u044b, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u044b<\/h2>\n<p>\u042d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e <code>arrayOfRoutes<\/code> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, \u0430 \u0432\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u043c, \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c <code>readonly<\/code>:<\/p>\n<pre><code class=\"typescript\">const arrayOfRoutes = [   { path: \"\/home\", component: Home },   { path: \"\/about\", component: About }, ] as const satisfies readonly {   path: string;   component: React.FC; }[];   \/\/ \u041e\u0448\u0438\u0431\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435\u0442!<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f, TypeScript \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432.<\/p>\n<h2>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 Const<\/h2>\n<p>\u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0442\u0438\u043f\u0430 <code>const<\/code>, \u043d\u043e \u0435\u0449\u0435 \u0431\u043e\u043b\u0435\u0435 \u043f\u0430\u0433\u0443\u0431\u043d\u043e.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>const<\/code> \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0432\u0435\u0449\u044c, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u0443\u044e \u0432 <code>T<\/code>, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 <code>const<\/code>.<\/p>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u044d\u0442\u043e \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442!<\/p>\n<pre><code class=\"typescript\">const returnWhatIPassIn = &lt;const T extends any[]>(t: T) => {   return t; };   \/\/ \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: any[] \u0432 TS 5.2! const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u0414\u043e \u0432\u0435\u0440\u0441\u0438\u0438 TS 5.3 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 <code>readonly<\/code> \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 <code>type<\/code>:<\/p>\n<pre><code class=\"typescript\">const returnWhatIPassIn = &lt;const T extends readonly any[]>(   t: T ) => {   return t; };   \/\/ \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: ['a', 'b', 'c']! const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0442\u0440\u0443\u0434\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0445 \u0437\u043d\u0430\u043d\u0438\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 <code>const<\/code>.<\/p>\n<h2>\u041a\u0430\u043a TypeScript 5.3 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e<\/h2>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 5.3, TypeScript \u0441\u043c\u044f\u0433\u0447\u0438\u043b \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 TypeScript \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e.<\/p>\n<p>\u041a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>satisfies<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441 <code>readonly<\/code>:<\/p>\n<pre><code class=\"typescript\">\/\/ \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 5.2, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 5.3! \/\/ const array: [\"a\", \"b\", \"c\"] const array = [\"a\", \"b\", \"c\"] as const satisfies string[];<\/code><\/pre>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u0430 <code>Const<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"typescript\">const returnWhatIPassIn = &lt;const T extends any[]>(t: T) => {   return t; };   \/\/ \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: any[] \u0432 TS 5.2, \u043d\u043e ['a', 'b', 'c'] \u0432 5.3 \/\/ const result: [\"a\", \"b\", \"c\"] const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0440\u0430\u0437\u043d\u0438\u0446\u0443! \u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u044b \u0443\u043a\u0430\u0437\u0430\u043b\u0438 readonly <code>string[]<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>string[<\/code>], \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0431\u044b \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432 readonly.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>readonly<\/code>, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"typescript\">\/\/ \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0432 5.2, \u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0432 5.3! \/\/ const array: readonly [\"a\", \"b\", \"c\"] const array = [   \"a\",   \"b\",   \"c\", ] as const satisfies readonly string[];  const returnWhatIPassIn = &lt;const T extends readonly any[]>(   t: T ) => {   return t; };   \/\/ \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 - any[] \u0432 TS 5.2, \u043d\u043e ['a', 'b', 'c'] \u0432 5.3 \/\/ const result: readonly [\"a\", \"b\", \"c\"] const result = returnWhatIPassIn([\"a\", \"b\", \"c\"]);<\/code><\/pre>\n<p>\u041d\u043e \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435, \u0434\u0435\u043b\u0430\u044e\u0449\u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u043a\u0430\u043a \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 <code>const<\/code>, \u0442\u0430\u043a \u0438 \u0441 <code>satisfies<\/code> \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>TypeScript &#8212; \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043a\u0440\u0438\u0447\u0430\u0442\u044c \u043e \u0442\u0430\u043a\u0438\u0445 \u0432\u0435\u0449\u0430\u0445! \u041e\u0447\u0435\u043d\u044c \u0441\u043a\u043e\u0440\u043e \u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044e \u0441\u0432\u043e\u0439 \u043a\u0443\u0440\u0441, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043d\u0435\u0433\u043e \u044d\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/781230\/\"> https:\/\/habr.com\/ru\/articles\/781230\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-363180","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/363180","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=363180"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/363180\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=363180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=363180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=363180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}