{"id":299639,"date":"2020-03-04T09:00:15","date_gmt":"2020-03-04T09:00:15","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=299639"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=299639","title":{"rendered":"Strict mode in TypeScript: \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u0440\u044b"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/490970\/\">\n<h4>&#8212;strict \u0444\u043b\u0430\u0433 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438:<\/h4>\n<p>  &#8212;strictNullChecks<br \/>  &#8212;alwaysStrict<br \/>  &#8212;noImplicitAny<br \/>  &#8212;noImplicitThis<br \/>  &#8212;strictBindCallApply<br \/>  &#8212;strictFunctionTypes<br \/>  &#8212;strictPropertyInitialization<\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\/\/ I. &#8212;strictNullChecks<\/h4>\n<p>  \u0417\u043d\u0430\u043c\u0435\u043d\u0438\u0442\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 NPE (null pointer exception, billion dollar mistake) \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 TS.<br \/>  \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432 TS \u0432\u0441\u0435 \u0442\u0438\u043f\u044b Nullable \u0438 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u201cundefined\u201d | \u201cnull\u201d \u0433\u0434\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0438\u043f (\u0434\u0430\u0436\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432):<\/p>\n<pre><code class=\"javascript\">const bar1: { foo: number } = undefined; const bar2: { foo: number } = null; const bar3: number = null; const bar4: string = null; <\/code><\/pre>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u044d\u0442\u043e \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u0431\u044b\u0442\u044c<\/p>\n<pre><code class=\"javascript\">declare var smth: { optionalMethod?(): string; }; smth.optionalMethod(); <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0436\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u201cundefined\u201d | \u201cnull\u201d \u0433\u0434\u0435 \u044d\u0442\u043e \u044f\u0432\u043d\u043e \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f<\/p>\n<pre><code class=\"javascript\">function getIt(): { data: number } {   \/\/ Type 'undefined' is not assignable to type '{ data: number; }'   return undefined; } getIt().data;  <\/code><\/pre>\n<p>  \u041f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u201cundefined\u201d \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043e\u0448\u0438\u0431\u043a\u0443<\/p>\n<pre><code class=\"javascript\">function getIt(): { data: number } | undefined {   return undefined; } \/\/ \u201cObject is possibly 'undefined'\u201d getIt().data;  <\/code><\/pre>\n<p>  \u0418 \u043a\u0430\u043a \u0431\u043e\u043d\u0443\u0441 \u2014 \u0431\u043e\u043b\u0435\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0433\u0434\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0431\u044b\u0442\u044c, \u0441 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0444\u043b\u0430\u0433\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u201cfind\u201d \u0447\u0442\u043e-\u0442\u043e \u043d\u0430\u0448\u0435\u043b:<\/p>\n<pre><code class=\"javascript\">\/\/ Object is possibly 'undefined' [{ name: 'John', age: 4 }]  .find(el =&gt; el.age === 42)  .name;  <\/code><\/pre>\n<p>  <\/p>\n<h4>\/\/ II. &#8212;alwaysStrict<\/h4>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Strict_mode\">&#8216;use strict&#8217; \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e<\/a> \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b, \u0434\u0435\u043b\u0430\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 JS \u0431\u043e\u043b\u0435\u0435 \u044f\u0432\u043d\u044b\u043c<\/p>\n<h4>\/\/ III. &#8212;noImplicitAny<\/h4>\n<p>  \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u043d\u0435 \u044f\u0432\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u2018any\u2019 \u0432 TS, \u0442.\u0435. \u043a\u043e\u0434 \u0431\u0435\u0437 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432<\/p>\n<pre><code class=\"javascript\"> \/\/ Parameter 'a' implicitly has an 'any' type  function id(arg) {    return arg;  } <\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441 \u043d\u0435\u0442\u0438\u043f\u0438\u0437\u043e\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0430\u043c\u0438 \u0438\u0437 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c type definitions<\/p>\n<pre><code class=\"javascript\"> \/* Could not find a declaration file for module '3rd-party-lib'. '\/node_modules\/3rd-party-lib\/index.js' implicitly has an 'any' type.  Try `npm install @types\/3rd-party-lib` if it exists or add a new declaration (.d.ts) file containing `declare module '3rd-party-lib';`*\/  import * as session from '3rd-party-lib';  <\/code><\/pre>\n<p>  <\/p>\n<h4>\/\/ IV. &#8212;strictBindCallApply<\/h4>\n<p>  \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u201c\u0431\u043e\u043b\u0435\u0435 \u0441\u0442\u0440\u043e\u0433\u0443\u044e\u201d \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0442\u0438\u043f\u043e\u0432 \u0434\u043b\u044f \u201cbind\u201d\/\u201dcall\u201d\/\u201dapply\u201d, \u0431\u0435\u0437 \u0444\u043b\u0430\u0433\u0430 \u2014 \u044d\u0442\u043e \u0432\u0441\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 TS. <\/p>\n<pre><code class=\"javascript\"> function getFullName(name: string, surname: string): string {    return name + surname;  }    getFullName.call(null, 'John', 42);  getFullName.apply(null, ['John', 42]);  getFullName.bind(null)('John');  getFullName.bind(null, 'John')();  getFullName.bind(null, 'John')(42);  <\/code><\/pre>\n<p>  <\/p>\n<h4>\/\/ V. &#8212;strictPropertyInitialization + &#8212;strictNullChecks<\/h4>\n<p>  \u041f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435, \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c &#8212;strictNullChecks, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c Nullable types.<\/p>\n<pre><code class=\"javascript\"> class User { \/\/ Property 'name' has no initializer and is not definitely assigned in the constructor    name: string;  } <\/code><\/pre>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435 \u0432 \u0441\u0430\u043c\u043e\u043c \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435, \u0443\u0431\u0435\u0434\u0438\u0442\u044c TS, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u043a \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f<\/p>\n<pre><code class=\"javascript\"> class User2 {   \/\/ Property 'name' has no initializer and is not definitely assigned in the constructor    name: string;          constructor(name: string) {      this.initializeName();    }      initializeName() {      this.name = 'John'    }  } <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c TS, \u0447\u0442\u043e \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438 \u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u2014 \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u201c\u041c\u0430\u043c\u043e\u0439 \u043a\u043b\u044f\u043d\u0443\u0441\u044c, \u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e!\u201d \u0438\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0430\u0442\u043a\u043e \u201c!\u201d<\/p>\n<pre><code class=\"javascript\">class User3 {    \/\/ definite assignment assertion    name!: string;  }  <\/code><\/pre>\n<p>  \/\/ VI. &#8212;strictFunctionTypes<br \/>  \u0423\u0431\u0438\u0440\u0430\u0435\u0442 \u0431\u0438\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0434\u043b\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/p>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0442\u043a\u043e \u2014 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <b>Supertype<\/b>\/<b>Subtype<\/b> \u0442\u0443\u0434\u0430, \u0433\u0434\u0430 <b>Type<\/b> \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u0442\u044c \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f <b>Shape -&gt; Circle -&gt; Rectangle<\/b> \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0438\u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <b>Shape\/Rectangle<\/b>, \u0435\u0441\u043b\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f <b>Circle<\/b>? <\/p>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/218753\/\">habr<\/a>, <a href=\"https:\/\/stackoverflow.com\/a\/48858344\/5801495\">SO<\/a><\/p>\n<pre><code class=\"javascript\">interface Shape { name: string }; interface Circle extends Shape { width: number }; interface Rectangle extends Circle { height: number };   declare var logSC: (figure: Shape) =&gt; Circle; declare var logRC: (figure: Rectangle) =&gt; Circle;   declare var logCC: (figure: Circle) =&gt; Circle;   declare var logCS: (figure: Circle) =&gt; Shape; declare var logCR: (figure: Circle) =&gt; Rectangle;   declare var wlogBB: (fn: (figure: Circle) =&gt; Circle) =&gt; void;   wlogBB(logCC); wlogBB(logSC); wlogBB(logCR);   \/\/ always Error wlogBB(logCS); \/\/ Error with --strictFunctionTypes wlogBB(logRC); <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043c\u0443\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 (\u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044f \u0432 \u0440\u043e\u043b\u0438 type producer), \u0432 TS \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0435\u0442\u0443, \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u2014 \u0435\u0441\u0442\u044c<\/p>\n<pre><code class=\"javascript\">const squares: Square[] = [{ name: 'Square', width: 5 }];   \/\/ function looks like a consumer of argument function addSmth(arg: Shape[]) {  \/\/ work with argument as a producer  arg.push({ name: 'Square' }); } addSmth(squares);  <\/code><\/pre>\n<p>  <\/p>\n<h4>\/\/ VII. &#8212;noImplicitThis<\/h4>\n<p>  \u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432\u043d\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\/\u043a\u043b\u0430\u0441\u0441\u0430, \u0442\u043e TS \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u0442 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0430 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0441\u044b\u043b\u0430\u0442\u044c\u0441\u044f \u201cthis\u201d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0441\u0435\u0432\u0434\u043e-\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u201cthis\u201d<\/p>\n<pre><code class=\"javascript\">\/\/ TS force to add annotation for 'this'  function getName(this: { name: string }, surname: string): string {    return this.name;  }    \/\/ The 'this' is not assignable  getName.call({}, 'Smith');  getName.apply({}, ['Smith']);  getName.bind({})('Smith'); <\/code><\/pre>\n<p>  \u0412\u0430\u043b\u0438\u0434\u043d\u044b\u043c\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0437\u043e\u0432\u044b<\/p>\n<pre><code class=\"javascript\">const somePerson = { name: 'John', getName }; const fullName: string = somePerson.getName('Smith')   getName.call({name: 'John'}, 'Smith'); getName.apply({name: 'John'}, ['Smith']); getName.bind({name: 'John'})('Smith');  <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b<\/p>\n<pre><code class=\"javascript\">function Person(this: { name: string }, name: string) {    this.name = name;  }  \/\/ 'new' expression, whose target lacks a construct signature  \/\/ Use class )  const person = new Person('John');  <\/code><\/pre>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0431\u043e\u043d\u0443\u0441\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432.<\/p>\n<pre><code class=\"javascript\">class A {    x = 42;      constructor() {      this.getBound = this.getBound.bind(this);    }      getSimple(): number {      return this.x;    }      \/\/ Has to add type for 'this', TS dont force it    getSimpleAnnotated(this: A): number {      return this.x;    }      getArrow = (): number =&gt; this.x;      getBound(this: A): number {      return this.x;    }  }    const a = new A();    \/\/ False positive: TS - ok, Runtime - error  const getSimple = a.getSimple;  getSimple();    \/\/ Correct: TS - error, Runtime - error  const getSimpleAnnotated = a.getSimpleAnnotated;  getSimpleAnnotated();    \/\/ Correct: TS - ok, Runtime - ok  const getArrow = a.getArrow;  getArrow();    \/\/ False negative: TS - error, Runtime - ok  const getBound = a.getBound;  getBound();  <\/code><\/pre>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/490970\/\"> https:\/\/habr.com\/ru\/post\/490970\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/490970\/\">\n<h4>&#8212;strict \u0444\u043b\u0430\u0433 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u043b\u0430\u0433\u0438:<\/h4>\n<p>  &#8212;strictNullChecks<br \/>  &#8212;alwaysStrict<br \/>  &#8212;noImplicitAny<br \/>  &#8212;noImplicitThis<br \/>  &#8212;strictBindCallApply<br \/>  &#8212;strictFunctionTypes<br \/>  &#8212;strictPropertyInitialization<\/p>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438 \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442.  <\/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-299639","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299639","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=299639"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/299639\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=299639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=299639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=299639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}