首页 > 代码库 > [TypeScript] Catch unsafe use of "this" in TypeScript functions

[TypeScript] Catch unsafe use of "this" in TypeScript functions

this is probably the most tricky thing to use in JavaScript and therefore TypeScript. Fortunately there is a TypeScript compiler flag noImplicit this that can help catch unsafe usages so beginners don‘t get caught off guard.

 

// tsconfig.json{  "compilerOptions": {    "noImplicitThis": true,...}

 

[TypeScript] Catch unsafe use of "this" in TypeScript functions