{"id":383236,"date":"2024-06-29T04:47:26","date_gmt":"2024-06-29T04:47:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=383236"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=383236","title":{"rendered":"<span>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 JavaScript \u0438 TypeScript \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u043b\u0435\u0442. \u0427\u0430\u0441\u0442\u044c 2<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ma\/po\/lv\/mapolvqq4uunxfqoaviv3g9km9y.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/ma\/po\/lv\/mapolvqq4uunxfqoaviv3g9km9y.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  Hello, world!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <a href=\"https:\/\/betterprogramming.pub\/all-javascript-and-typescript-features-of-the-last-3-years-629c57e73e42\">\u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c JS \u0438 TS \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0442\u0440\u0435\u0445 \u043b\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 JS, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 TS.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/722450\/\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/em>: \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 TypeScript.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/my-js.org\/\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438, \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u043e JavaScript, TypeScript, React, Next.js, Node.js, Express, Prisma, GraphQL, Docker \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0411\u043b\u043e\u0433 \u043f\u043e \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/a><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"typescript\">TypeScript<\/h2>\n<p>  <\/p>\n<h3 id=\"osnovy-kontekst-dlya-dalneyshego-izlozheniya\">\u041e\u0441\u043d\u043e\u0432\u044b (\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0433\u043e \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f)<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/generics.html\">\u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \/ Generics<\/a>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c (\u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c) \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u043e\u0432 (type parameters). \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u0438\u043f\u0430\u043c \u0431\u044b\u0442\u044c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043e\u0431\u0449\u0438\u043c\u0438 \u0438 \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 (typesafe). \u0414\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e <code>any<\/code> \u0438\u043b\u0438 <code>unknown<\/code> \u0432\u0435\u0437\u0434\u0435, \u0433\u0434\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0411\u0435\u0437 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u043e\u0432: function getFirstUnsafe(list: any[]): any {   return list[0]; }  const firstUnsafe = getFirstUnsafe(['test']); \/\/ any  \/\/ \u0421 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0430\u043c\u0438: function getFirst&lt;Type>(list: Type[]): Type {   return list[0]; }  const first = getFirst&lt;string>(['test']); \/\/ string  \/\/ \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0443\u0449\u0435\u043d, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0442\u0438\u043f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f (inferred) \u0438\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 const firstInferred = getFirst(['test']); \/\/ string  \/\/ \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0442\u0438\u043f\u0430 \u043c\u043e\u0436\u0435\u0442 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 `extends` class List&lt;T extends string | number> {   private list: T[] = [];    get(key: number): T {     return this.list[key];   }    push(value: T): void {     this.list.push(value);   } }  const list = new List&lt;string>(); list.push(9); \/\/ TypeError: Argument of type 'number' is not assignable to parameter of type 'string'. const booleanList = new List&lt;boolean>(); \/\/ TypeError: Type 'boolean' does not satisfy the constraint 'string | number'.<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"do-ts4-vozmozhnosti-o-kotoryh-mnogie-ne-znayut\">\u0414\u043e TS4 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u043d\u043e\u0433\u0438\u0435 \u043d\u0435 \u0437\u043d\u0430\u044e\u0442)<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/utility-types.html#handbook-content\">\u0423\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0438\u043f\u043e\u0432 \/ Utility types<\/a>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043b\u0435\u0433\u043a\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">interface Test {   name: string;   age: number; }  \/\/ `Partial` \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c\u0438 type TestPartial = Partial&lt;Test>; \/\/ { name?: string | undefined; age?: number | undefined; }  \/\/ `Required` \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 type TestRequired = Required&lt;TestPartial>; \/\/ { name: string; age: number; }  \/\/ `Readonly` \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f type TestReadonly = Readonly&lt;Test>; \/\/ { readonly name: string; readonly age: string }  \/\/ `Record` \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c, \u0447\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 (index signatures) const config: Record&lt;string, boolean> = { option: false, anotherOption: true };  \/\/ `Pick` \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 type TestLess = Pick&lt;Test, 'name'>; \/\/ { name: string; } type TestBoth = Pick&lt;Test, 'name' | 'age'>; \/\/ { name: string; age: string; }  \/\/ `Omit` \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 type TestFewer = Omit&lt;Test, 'name'>; \/\/ { age: string; } type TestNone = Omit&lt;Test, 'name' | 'age'>; \/\/ {}  \/\/ `Parameters` \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 function doSmth(value: string, anotherValue: number): string {   return 'test'; } type Params = Parameters&lt;typeof doSmth>; \/\/ [value: string, anotherValue: number]  \/\/ `ReturnType` \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 type Return = ReturnType&lt;typeof doSmth>; \/\/ string  \/\/ \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0442\u0438\u043b\u0438\u0442<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/conditional-types.html#handbook-content\">\u0423\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \/ Conditional types<\/a>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u0438\u043f\u044b \u0443\u0441\u043b\u043e\u0432\u043d\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f\/\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432. \u0427\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u0442\u0435\u0440\u043d\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0432 JS.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0438\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f type Flatten&lt;T> = T extends any[] ? T[number] : T;  \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 type Str = Flatten&lt;string[]>; \/\/string  \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u0430\u043c \u0442\u0438\u043f type Num = Flatten&lt;number>; \/\/ number<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432<\/strong>: \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>extends<\/code>. \u041e\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 (temporary) \u0442\u0438\u043f\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 type FlattenOld&lt;T> = T extends any[] ? T[number] : T;  \/\/ \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0442\u0438\u043f `Item` type Flatten&lt;T> = T extends (infer Item)[] ? Item : T;  \/\/ \u0427\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0438\u043f, \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e\u0449\u0438\u0439 \u0442\u0438\u043f, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439, \u0438\u043b\u0438 `undefined`? type GetReturnType&lt;Type> = Type extends (...args: any[]) => infer Return ? Return : undefined;  type Num = GetReturnType&lt;() => number>; \/\/ number  type Str = GetReturnType&lt;(x: string) => string>; \/\/ string  type Bools = GetReturnType&lt;(a: boolean, b: boolean) => void>; \/\/ undefined<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 (rest) \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0440\u0442\u0435\u0436\u0430<\/strong>: \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>?<\/code>, \u043f\u0440\u043e\u0447\u0438\u0435 \u2014 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>...<\/code>:.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442 1 \u0434\u043e 3 const list: [number, number?, boolean?] = []; list[0] \/\/ number list[1] \/\/ number | undefined list[2] \/\/ boolean | undefined list[3] \/\/ TypeError: Tuple type '[number, (number | undefined)?, (boolean | undefined)?]' of length '3' has no element at index '3'.  \/\/ \u041a\u043e\u0440\u0442\u0435\u0436\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \/\/ \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 `rest` \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 function padStart&lt;T extends any[]>(arr: T, pad: string): [string, ...T] {   return [pad, ...arr]; }  const padded = padStart([1, 2], 'test'); \/\/ [string, number, number]<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/classes.html#abstract-classes-and-members\">\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \/ Abstract classes<\/a>: \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>abstract<\/code>. \u0422\u0430\u043a\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b (\u043c\u0435\u0442\u043e\u0434\u044b) \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">abstract class Animal {   abstract makeSound(): void;    move(): void {     console.log('\u0413\u0443\u043b\u044f\u0435\u0442...');   } }  \/\/ \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043f\u0440\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0441\u0441\u0430 class Cat extends Animal {} \/\/ CompileError: Non-abstract class 'Cat' does not implement inherited abstract member 'makeSound' from class 'Animal'  class Dog extends Animal {   makeSound() {     console.log('\u0413\u0430\u0432!');   } }  \/\/ \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f (\u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b), \u0430 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e new Animal(); \/\/ CompileError: Cannot create an instance of an abstract class  const dog = new Dog().makeSound(); \/\/ \u0413\u0430\u0432!<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/functions.html#construct-signatures\">\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \/ Construct signatures<\/a>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0442\u0438\u043f\u044b \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">interface MyInterface {   name: string; }  interface ConstructsMyInterface {   new(name: string): MyInterface; }  class Test implements MyInterface {   name: string;   constructor(name: string) {     this.name = name;   } }  class AnotherTest {   age: number; }  function makeObj(n: ConstructsMyInterface) {     return new n('hello!'); }  const obj = makeObj(Test); \/\/ Test const anotherObj = makeObj(AnotherTest); \/\/ TypeError: Argument of type 'typeof AnotherTest' is not assignable to parameter of type 'ConstructsMyInterface'.<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/utility-types.html#constructorparameterstype\"><code>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0442\u0438\u043f\u0430 ConstructorParameters<\/code><\/a>: \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f\u044b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 (\u043d\u043e \u043d\u0435 \u0442\u0438\u043f \u0441\u0430\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430).<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">interface MyInterface {   name: string; }  interface ConstructsMyInterface {   new(name: string): MyInterface; }  class Test implements MyInterface {   name: string;   constructor(name: string) {     this.name = name;   } }  function makeObj(test: ConstructsMyInterface, ...args: ConstructorParameters&lt;ConstructsMyInterface>) {   return new test(...args); }  makeObj(Test); \/\/ TypeError: Expected 2 arguments, but got 1. const obj = makeObj(Test, 'test'); \/\/ Test<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ts40\">TS4.0<\/h3>\n<p>  <\/p>\n<p><strong>\u0422\u0438\u043f\u044b \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \/ Variadic tuple types<\/strong>: \u043f\u0440\u043e\u0447\u0438\u0435 (rest) \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u0439 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u0449\u0438\u043c\u0438 (generic). \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0447\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0427\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u044e\u0449\u0430\u044f 2 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b? \/\/ \u041a\u0430\u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0442\u0438\u043f?  \/\/ \u0420\u0430\u043d\u044c\u0448\u0435: \/\/ \u041f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438 (overloads) declare function concat(arr1: [], arr2: []): []; declare function concat&lt;A>(arr1: [A], arr2: []): [A]; declare function concat&lt;A, B>(arr1: [A], arr2: [B]): [A, B]; declare function concat&lt;A, B, C>(arr1: [A], arr2: [B, C]): [A, B, C]; declare function concat&lt;A, B, C, D>(arr1: [A], arr2: [B, C, D]): [A, B, C, D]; declare function concat&lt;A, B>(arr1: [A, B], arr2: []): [A, B]; declare function concat&lt;A, B, C>(arr1: [A, B], arr2: [C]): [A, B, C]; declare function concat&lt;A, B, C, D>(arr1: [A, B], arr2: [C, D]): [A, B, C, D]; declare function concat&lt;A, B, C, D, E>(arr1: [A, B], arr2: [C, D, E]): [A, B, C, D, E]; declare function concat&lt;A, B, C>(arr1: [A, B, C], arr2: []): [A, B, C]; declare function concat&lt;A, B, C, D>(arr1: [A, B, C], arr2: [D]): [A, B, C, D]; declare function concat&lt;A, B, C, D, E>(arr1: [A, B, C], arr2: [D, E]): [A, B, C, D, E]; declare function concat&lt;A, B, C, D, E, F>(arr1: [A, B, C], arr2: [D, E, F]): [A, B, C, D, E, F]; \/\/ \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e  \/\/ \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b declare function concatBetter&lt;T, U>(arr1: T[], arr2: U[]): (T | U)[]; \/\/ \u041d\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u0442\u0438\u043f\u0443 (T | U)[]  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: \/\/ \u0422\u0438\u043f \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043b\u0435\u0433\u043a\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0434\u043b\u0438\u043d\u0435 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 declare function concatNew&lt;T extends Arr, U extends Arr>(arr1: T, arr2: U): [...T, ...U];  const tuple = concatNew([23, 'hey', false] as [number, string, boolean], [5, 99, 20] as [number, number, number]); console.log(tuple[0]); \/\/ 23 const element: number = tuple[1]; \/\/ TypeError: Type 'string' is not assignable to type 'number'. console.log(tuple[6]); \/\/ TypeError: Tuple type '[23, \"hey\", false, 5, 99, 20]' of length '6' has no element at index '6'.<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \/ Labeled tuple elements<\/strong>: \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>[start: number, end: number]<\/code>. \u0415\u0441\u043b\u0438 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0442\u043e \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Foo = [first: number, second?: string, ...rest: any[]];  declare function someFunc(...args: Foo);<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0412\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u0437 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430<\/strong>: \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0442\u0438\u043f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class Animal {   \/\/ \u0420\u0430\u043d\u044c\u0448\u0435 \u0442\u0438\u043f \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e   name;    constructor(name: string) {     this.name = name;     console.log(this.name); \/\/ string   } }<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0435\u0433\u0430 <a href=\"https:\/\/habr.com\/ru\/users\/deprecated\/\" class=\"user_link\">deprecated<\/a> JSDoc<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/** @deprecated message *\/ type Test = string;  const test: Test = 'dfadsf'; \/\/ TypeError: 'Test' is deprecated.<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ts41\">TS4.1<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/template-literal-types.html#handbook-content\">\u0422\u0438\u043f\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432 \/ Template literal types<\/a>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0435 \u0442\u0438\u043f\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0443\u0442\u0435\u043c \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0445 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type VerticalDirection = 'top' | 'bottom'; type HorizontalDirection = 'left' | 'right'; type Direction = `${VerticalDirection} ${HorizontalDirection}`;  const dir1: Direction = 'top left'; const dir2: Direction = 'left'; \/\/ TypeError: Type '\"left\"' is not assignable to type '\"top left\" | \"top right\" | \"bottom left\" | \"bottom right\"'. const dir3: Direction = 'left top'; \/\/ TypeError: Type '\"left top\"' is not assignable to type '\"top left\" | \"top right\" | \"bottom left\" | \"bottom right\"'.  \/\/ \u041a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u0438 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0442\u0438\u043f\u043e\u0432 declare function makeId&lt;T extends string, U extends string>(first: T, second: U): `${Capitalize&lt;T>}-${Lowercase&lt;U>}`;<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u043a\u043b\u044e\u0447\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438\u0441\u044c \u0441 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f const obj = { value1: 0, value2: 1, value3: 3 }; const newObj: { [Property in keyof typeof obj as `_${Property}`]: number }; \/\/ { _value1: number; _value2: number; _value3: number; }<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0420\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b<\/strong>: \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u0438\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u044b \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type Awaited&lt;T> = T extends PromiseLike&lt;infer U> ? Awaited&lt;U> : T;  type P1 = Awaited&lt;string>; \/\/ string type P2 = Awaited&lt;Promise&lt;string>>; \/\/ string type P3 = Awaited&lt;Promise&lt;Promise&lt;string>>>; \/\/ string<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0435\u0433\u0430 <a href=\"https:\/\/habr.com\/ru\/users\/see\/\" class=\"user_link\">see<\/a> JSDoc<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const originalValue = 1; \/**   * \u041a\u043e\u043f\u0438\u044f \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f   * @see originalValue   *\/ const value = originalValue;<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/tsconfig\/#explainFiles\"><code>explainFiles<\/code><\/a>: \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u043b\u0430\u0433\u0430 CLI <code>--explainFiles<\/code> \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>tsconfig.json<\/code>, TS \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0434\u043b\u044f \u043e\u0442\u043b\u0430\u0434\u043a\u0438. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u0432\u043e\u0434\u0430 (output) \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>tsc --explainFiles | less<\/code>.<\/p>\n<p>  <\/p>\n<p><strong>\u042f\u0432\u043d\u043e\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445<\/strong>: \u043f\u0440\u0438 \u0434\u0435\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const [_first, second] = [3, 5]; console.log(second);  \/\/ \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043a\u043e\u0440\u043e\u0447\u0435 const [_, value] = [3, 5]; console.log(value);<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ts43\">TS4.3<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/2\/classes.html#getters--setters\">\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u043e\u0432 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u043e\u0432<\/a>: \u043f\u0440\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440\u043e\u0432 get\/set \u0442\u0438\u043f \u0437\u0430\u043f\u0438\u0441\u0438\/set \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u0435\u043d \u043e\u0442 \u0442\u0438\u043f\u0430 \u0447\u0442\u0435\u043d\u0438\u044f\/get. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u0435\u0442\u0442\u0435\u0440\u0430\u043c \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class Test {   private _value: number;    get value(): number {     return this._value;   }    set value(value: number | string) {     if (typeof value === 'number') {       this._value = value;       return;     }     this._value = parseInt(value, 10);   } }<\/code><\/pre>\n<p>  <\/p>\n<p><code>override<\/code>: \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430\u0445 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f. \u0412\u043c\u0435\u0441\u0442\u043e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>override<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/jsdoc-supported-types.html#override\">\u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0439 \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440<\/a>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class Parent {   getName(): string {     return 'name';   } }  class NewParent {   getFirstName(): string {     return 'name';   } }  class Test extends Parent {   override getName(): string {     return 'test';   } }  class NewTest extends NewParent {   override getName(): string { \/\/ TypeError: This member cannot have an 'override' modifier because it is not declared in the base class 'NewParent'.     return 'test';   } }<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \/ Static index signatures<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0420\u0430\u043d\u044c\u0448\u0435: class Test {}  Test.test = ''; \/\/ TypeError: Property 'test' does not exist on type 'typeof Test'.  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: class NewTest {   static [key: string]: string; }  NewTest.test = '';<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0435\u0433\u0430 <a href=\"https:\/\/habr.com\/ru\/users\/link\/\" class=\"user_link\">link<\/a> JSDoc<\/strong>:<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">const originalValue = 1; \/**   * \u041a\u043e\u043f\u0438\u044f {@link originalValue}   *\/ const value = originalValue;<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ts44\">TS4.4<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/tsconfig\/#exactOptionalPropertyTypes\"><code>exactOptionalPropertyTypes<\/code><\/a>: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430 CLI <code>--exactOptionalPropertyTypes<\/code> \u0438\u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>tsconfig.json<\/code> \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u0443\u044e \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u043b\u044f \u2014 \u0432\u043c\u0435\u0441\u0442\u043e <code>property?: string<\/code> \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>property: string | undefined<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class Test {   name?: string;   age: number | undefined; }  const test = new Test(); test.name = undefined; \/\/ TypeError: Type 'undefined' is not assignable to type 'string' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the type of the target. test.age = undefined; console.log(test.age); \/\/ undefined<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ts45\">TS4.5<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/utility-types.html#awaitedtype\"><code>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 \u0442\u0438\u043f\u0430 Awaited<\/code><\/a>: \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0442\u0438\u043f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u043c\u0438\u0441\u043e\u0432. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f <code>Promise.all()<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">type P1 = Awaited&lt;string>; \/\/ string type P2 = Awaited&lt;Promise&lt;string>>; \/\/ string type P3 = Awaited&lt;Promise&lt;Promise&lt;string>>>; \/\/ string<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 <code>type<\/code> \u0432 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0435<\/strong>: \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u043e \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0420\u0430\u043d\u044c\u0448\u0435: \/\/ \u0418\u043c\u043f\u043e\u0440\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0432\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0442\u0438\u043f\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 import { something } from '.\/file'; import type { SomeType } from '.\/file';  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: \/\/ \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0442\u0438\u043f\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0434\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 import { something, type SomeType } from '.\/file';<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/typescript-in-5-minutes-func.html#readonly-and-const\"><code>\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f const<\/code> \/ <code>const<\/code> assertions<\/a>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b \u043a\u0430\u043a \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0438\u043f\u044b. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u044b <code>readonly<\/code>, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0445 \u043c\u0443\u0442\u0430\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0420\u0430\u043d\u044c\u0448\u0435: const obj = { name: 'foo', value: 9, toggle: false }; \/\/ { name: string; value: number; toggle: boolean; } \/\/ \u041f\u043e\u043b\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0438\u043f\u0430 obj.name = 'bar';  const tuple = ['name', 4, true]; \/\/ (string | number | boolean)[] \/\/ \u0414\u043b\u0438\u043d\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0438 \u0442\u0438\u043f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b \/\/ \u041c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 tuple[0] = 0; tuple[3] = 0;  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: const objNew = { name: 'foo', value: 9, toggle: false } as const; \/\/ { readonly name: \"foo\"; readonly value: 9; readonly toggle: false; } \/\/ \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f (\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f) objNew.name = 'bar'; \/\/ TypeError: Cannot assign to 'name' because it is a read-only property.  const tupleNew = ['name', 4, true] as const; \/\/ readonly [\"name\", 4, true] \/\/ \u0414\u043b\u0438\u043d\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0430 \u0438 \u0442\u0438\u043f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b tupleNew[0] = 0; \/\/ TypeError: Cannot assign to '0' because it is a read-only property. tupleNew[3] = 0; \/\/ TypeError: Index signature in type 'readonly [\"name\", 4, true]' only permits reading.<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0410\u0432\u0442\u043e\u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043b\u0430\u0441\u0441\u043e\u0432<\/strong>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/q6\/xt\/kv\/q6xtkv6a4sq5atuyv_bjsbg2hkk.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/q6\/xt\/kv\/q6xtkv6a4sq5atuyv_bjsbg2hkk.gif\"\/>  <\/p>\n<p>  <\/p>\n<p>  <\/p>\n<h3 id=\"ts46\">TS4.6<\/h3>\n<p>  <\/p>\n<p><strong>\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443<\/strong>: \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043e\u0434\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">interface AllowedTypes {   'number': number;   'string': string;   'boolean': boolean; }  \/\/  `UnionRecord` \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0438\u043f\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043f\u043e\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e `AllowedTypes` type UnionRecord&lt;AllowedKeys extends keyof AllowedTypes> = { [Key in AllowedKeys]: {   kind: Key;   value: AllowedTypes[Key];   logValue: (value: AllowedTypes[Key]) => void; } }[AllowedKeys];  \/\/ `logValue` \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 `UnionRecord` function processRecord&lt;Key extends keyof AllowedTypes>(record: UnionRecord&lt;Key>) {   record.logValue(record.value); }  processRecord({   kind: 'string',   value: 'hello!',   \/\/ `value` \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0442\u0438\u043f `string | number | boolean`,   \/\/ \u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0438\u043f `string`   logValue: value => {     console.log(value.toUpperCase());   } });<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/docs\/handbook\/compiler-options.html#compiler-options\"><code>\u0424\u043b\u0430\u0433 CLI --generateTrace<\/code><\/a>: \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 TS \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0442\u0438\u043f\u043e\u0432 \u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  <\/p>\n<h3 id=\"ts47\">TS4.7<\/h3>\n<p>  <\/p>\n<p><a href=\"https:\/\/www.typescriptlang.org\/tsconfig#module\">\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 ES \u0432 Node.js<\/a>: \u0434\u043b\u044f \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 ES \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u0435\u0439 CommonJS \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <code>tsconfig.json<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{   \"compilerOptions\": {     \"module\": \"es2020\"   } }<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u043e\u043b\u0435 <code>type<\/code> \u0444\u0430\u0439\u043b\u0430 <code>package.json<\/code><\/strong>: \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0432\u044b\u0448\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <code>package.json<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">\"type\": \"module\"<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \/ Instantiation expressions<\/strong>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0442\u0438\u043f\u043e\u0432 \u043f\u0440\u0438 \u0441\u0441\u044b\u043b\u043a\u0435 \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c (narrow) \u043e\u0431\u0449\u0438\u0435 \u0442\u0438\u043f\u044b \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0435\u0440\u0442\u043e\u043a.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">class List&lt;T> {   private list: T[] = [];    get(key: number): T {     return this.list[key];   }    push(value: T): void {     this.list.push(value);   } }  function makeList&lt;T>(items: T[]): List&lt;T> {   const list = new List&lt;T>();   items.forEach(item => list.push(item));   return list; }  \/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u0441\u043e\u0437\u0434\u0430\u044e\u0449\u0443\u044e \u0441\u043f\u0438\u0441\u043e\u043a \/\/ \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430  \/\/ \u0420\u0430\u043d\u044c\u0448\u0435: \/\/ \u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0435\u0440\u0442\u043a\u0443 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c \u0442\u0438\u043f\u0430 function makeStringList(text: string[]) {   return makeList(text); }  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: \/\/ \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f const makeNumberList = makeList&lt;number>;<\/code><\/pre>\n<p>  <\/p>\n<p><strong><code>extends<\/code> \u0438 <code>infer<\/code><\/strong>: \u043f\u0440\u0438 \u0432\u044b\u0432\u043e\u0434\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0432 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u0430\u0445, \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f\/\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>extends<\/code>.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0442\u0438\u043f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \/\/ \u0435\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \/\/ \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b  \/\/ \u0420\u0430\u043d\u044c\u0448\u0435: type FirstIfStringOld&lt;T> =   T extends [infer S, ...unknown[]]     ? S extends string ? S : never     : never;  \/\/ \u0412\u043c\u0435\u0441\u0442\u043e 2 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 1 type FirstIfString&lt;T> =   T extends [string, ...unknown[]]     \/\/ \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0442\u0438\u043f \u0438\u0437 \u0442\u0438\u043f\u0430 `T`     ? T[0]     : never; \/\/ \u041d\u043e \u043a\u043e\u0434 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: type FirstIfStringNew&lt;T> =   T extends [infer S extends string, ...unknown[]]     ? S     : never; \/\/ \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435: \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u043d\u044c\u0448\u0435, \u043d\u043e \u043a\u043e\u0434 \u0441\u0442\u0430\u043b \u0447\u0438\u0449\u0435  type A = FirstIfStringNew&lt;[string, number, number]>; \/\/ string type B = FirstIfStringNew&lt;[\"hello\", number, number]>; \/\/ \"hello\" type C = FirstIfStringNew&lt;[\"hello\" | \"world\", boolean]>; \/\/ \"hello\" | \"world\" type D = FirstIfStringNew&lt;[boolean, number, string]>; \/\/ never<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0432\u0430\u0440\u0438\u0430\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0442\u0438\u043f\u043e\u0432<\/strong>: \u0434\u0436\u0435\u043d\u0435\u0440\u0438\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043d\u0430 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 (match), \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0434\u043b\u044f \u0433\u0435\u0442\u0442\u0435\u0440\u043e\u0432 \u0438 \u0441\u0435\u0442\u0442\u0435\u0440\u043e\u0432. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u044f\u0432\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u0434\u043b\u044f \u044f\u0441\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044e\u0449\u0438\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 interface Animal {   animalStuff: any; }  interface Dog extends Animal {   dogStuff: any; }  \/\/ \u0410 \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u0449\u0438\u0439 \"\u0433\u0435\u0442\u0442\u0435\u0440\" \u0438 \"\u0441\u0435\u0442\u0442\u0435\u0440\". type Getter&lt;T> = () => T;  type Setter&lt;T> = (value: T) => void;  \/\/ \u0415\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u043b\u0438 Getter&lt;T1> \u0438 Getter&lt;T2> \u0438\u043b\u0438 Setter&lt;T1> \u0438 Setter&lt;T2>, \/\/ \u043d\u0430\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c (covariance) function useAnimalGetter(getter: Getter&lt;Animal>) {   getter(); }  \/\/ \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c `Getter` \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e useAnimalGetter((() => ({ animalStuff: 0 }) as Animal)); \/\/ \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442  \/\/ \u0427\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c `Getter`, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 `Dog`? useAnimalGetter((() => ({ animalStuff: 0, dogStuff: 0 }) as Dog)); \/\/ \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 `Dog` - \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 `Animal`  function useDogGetter(getter: Getter&lt;Dog>) {   getter(); }  \/\/ \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 `useDogGetter`, \/\/ \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0434\u0440\u0443\u0433\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 useDogGetter((() => ({ animalStuff: 0 }) as Animal)); \/\/ TypeError: Property 'dogStuff' is missing in type 'Animal' but required in type 'Dog'. \/\/ \u042d\u0442\u043e \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f `Dog`, \u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e `Animal`  useDogGetter((() => ({ animalStuff: 0, dogStuff: 0 }) as Dog)); \/\/ \u041e\u0434\u043d\u0430\u043a\u043e, \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442  \/\/ \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u0435\u0442\u0442\u0435\u0440\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0433\u0435\u0442\u0442\u0435\u0440\u044b, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a function setAnimalSetter(setter: Setter&lt;Animal>, value: Animal) {   setter(value); }  \/\/ \u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c `Setter` \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430, \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e setAnimalSetter((value: Animal) => {}, { animalStuff: 0 });  function setDogSetter(setter: Setter&lt;Dog>, value: Dog) {   setter(value); }  \/\/ \u0418 \u0437\u0434\u0435\u0441\u044c setDogSetter((value: Dog) => {}, { animalStuff: 0, dogStuff: 0 });  \/\/ \u041d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c `Dog Setter` \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e `setAnimalSetter`, \/\/ \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u044b\u043c (reversed) `Getter` setAnimalSetter((value: Dog) => {}, { animalStuff: 0, dogStuff: 0 }); \/\/ TypeError: Argument of type '(value: Dog) => void' is not assignable to parameter of type 'Setter&lt;Animal>'.  \/\/ \u041e\u0431\u0445\u043e\u0434\u043d\u043e\u0439 \u043c\u0430\u043d\u0435\u0432\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0430\u0447\u0435 setDogSetter((value: Animal) => {}, { animalStuff: 0, dogStuff: 0 });  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: \/\/ \u041d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c, \u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 type GetterNew&lt;out T> = () => T; type SetterNew&lt;in T> = (value: T) => void;<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439<\/strong>: \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 <code>moduleSuffixes<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u044b \u0444\u0430\u0439\u043b\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>.ios<\/code>) \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f\u0445 \u0434\u043b\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"json\">{   \"compilerOptions\": {     \"moduleSuffixes\": [\".ios\", \".native\", \"\"]   } }<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"javascript\">import * as foo from '.\/foo'; \/\/ \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f .\/foo.ios.ts, \u0437\u0430\u0442\u0435\u043c .\/foo.native.ts \u0438, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, .\/foo.ts<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \/ Go to source definition<\/strong>: \u043d\u043e\u0432\u044b\u0439 \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430. \u041e\u043d \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 &#171;\u041f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e&#187; (Go to definition), \u043d\u043e &#171;\u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u0435\u0442&#187; \u0444\u0430\u0439\u043b\u044b <code>.ts<\/code> \u0438 <code>.js<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u043e\u0432 (<code>.d.ts<\/code>).<\/p>\n<p>  <\/p>\n<h3 id=\"ts49\">TS4.9<\/h3>\n<p>  <\/p>\n<p><strong>\u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <code>satisfies<\/code><\/strong>: \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u0442\u0438\u043f\u043e\u043c \u0431\u0435\u0437 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u044b\u0432\u043e\u0434 \u0442\u0438\u043f\u043e\u0432 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u043c \u043f\u0440\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<pre><code class=\"javascript\">\/\/ \u0420\u0430\u043d\u044c\u0448\u0435: \/\/ \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0440\u0430\u0437\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438 \u0438\u0445 \u0446\u0432\u0435\u0442\u0430 const obj = {   fireTruck: [255, 0, 0],   bush: '#00ff00',   ocean: [0, 0, 255] } \/\/ { fireTruck: number[]; bush: string; ocean: number[]; }  const rgb1 = obj.fireTruck[0]; \/\/ number const hex = obj.bush; \/\/ string  \/\/ \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0442\u0438\u043f\u044b \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \/\/ \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u0443 \u0442\u0438\u043f\u0430 `Record` const oldObj: Record&lt;string, [number, number, number] | string> = {   fireTruck: [255, 0, 0],   bush: '#00ff00',   ocean: [0, 0, 255] } \/\/ Record&lt;string, [number, number, number] | string> \/\/ \u041d\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u043e\u0442\u0435\u0440\u0435 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 const oldRgb1 = oldObj.fireTruck[0]; \/\/ string | number const oldHex = oldObj.bush; \/\/ string | number  \/\/ \u0421\u0435\u0439\u0447\u0430\u0441: \/\/ \u041e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 `satisfies` \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u0442\u0438\u043f\u043e\u043c \u0431\u0435\u0437 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 const newObj = {   fireTruck: [255, 0, 0],   bush: '#00ff00',   ocean: [0, 0, 255] } satisfies Record&lt;string, [number, number, number] | string> \/\/ { fireTruck: [number, number, number]; bush: string; ocean: [number, number, number]; }  \/\/ \u0422\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \/\/ \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043a\u043e\u0440\u0442\u0435\u0436\u0435\u043c const newRgb1 = newObj.fireTruck[0]; \/\/ number const newRgb4 = newObj.fireTruck[3]; \/\/ TypeError: Tuple type '[number, number, number]' of length '3' has no element at index '3'. const newHex = newObj.bush; \/\/ string<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041d\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/strong>: \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u0434\u0430 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b &#171;\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043d\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b&#187; (Remove unused imports) \u0438 &#171;\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442\u044b&#187; (Sort imports), \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0449\u0438\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c TS, \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u0421 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 TS5, \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f <a href=\"https:\/\/devblogs.microsoft.com\/typescript\/announcing-typescript-5-0\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u044b \u0443\u0437\u043d\u0430\u043b\u0438 \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u043d\u0435 \u0437\u0440\u044f \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u0432\u0440\u0435\u043c\u044f.<\/p>\n<p>  <\/p>\n<p>Happy coding!<\/p>\n<p>  <\/p>\n<hr\/>\n<p>  <\/p>\n<blockquote><p><a href=\"https:\/\/t.me\/timewebru\"><b>\u041d\u043e\u0432\u043e\u0441\u0442\u0438, \u043e\u0431\u0437\u043e\u0440\u044b \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0438 \u043a\u043e\u043d\u043a\u0443\u0440\u0441\u044b \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b Timeweb.Cloud \u2014 \u0432 \u043d\u0430\u0448\u0435\u043c Telegram-\u043a\u0430\u043d\u0430\u043b\u0435<\/b><\/a> <b>\u21a9<\/b><\/p><\/blockquote>\n<p><a href=\"https:\/\/timeweb.cloud\/?i=106909\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/r8\/ms\/jc\/r8msjcfet9mgza3ybpor_sdgrt0.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/r8\/ms\/jc\/r8msjcfet9mgza3ybpor_sdgrt0.jpeg\" data-blurred=\"true\"\/><\/a><\/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\/723332\/\"> https:\/\/habr.com\/ru\/articles\/723332\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/ma\/po\/lv\/mapolvqq4uunxfqoaviv3g9km9y.jpeg\" data-src=\"https:\/\/habrastorage.org\/webt\/ma\/po\/lv\/mapolvqq4uunxfqoaviv3g9km9y.jpeg\" data-blurred=\"true\"\/>  <\/p>\n<p>  Hello, world!<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <a href=\"https:\/\/betterprogramming.pub\/all-javascript-and-typescript-features-of-the-last-3-years-629c57e73e42\">\u044d\u0442\u043e\u0439 \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c JS \u0438 TS \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0442\u0440\u0435\u0445 \u043b\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 JS, \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445 TS.<\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 <a href=\"https:\/\/habr.com\/ru\/company\/timeweb\/blog\/722450\/\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435<\/em>: \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u044d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 TypeScript.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/my-js.org\/\">\u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430, \u0448\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0438, \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u043f\u043e JavaScript, TypeScript, React, Next.js, Node.js, Express, Prisma, GraphQL, Docker \u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u043c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0411\u043b\u043e\u0433 \u043f\u043e \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-383236","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/383236","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=383236"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/383236\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=383236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=383236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=383236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}