This section provides TypeScript-specific tips & tricks for you to make the best out of the ecosystem.
--strict compiler flag was introduced in TypeScript 2.3 which activates TypeScript's "strict mode". The strict mode sets all strict typechecking options to
true by default.
As of TypeScript 2.7, the affected options are:
Starting from version 2.0 of the starter kit, we've enabled the
--strict flag in
tsconfig.json. If this gives you compile time errors, you can try setting
false, or by overriding one or more of the options listed above.
TSLint checks your TypeScript code for readability, maintainability, and functionality errors, and can also enforce coding style standards.
This project provides TSLint rules through a
tslint.json file, which extends the recommended rules from TSLint defined here.
We've made some changes to these rules, which we considered necessary and/or relevant to a proper Screeps project:
set the forin rule to
false, it was forcing
for ( ... in ...) loops to check if object members were not coming from the class prototype.
set the interface-name rule to
false, in order to allow interfaces that are not prefixed with
set the no-console rule to
false, in order to allow using
in the variable-name rule, added
If you believe that some rules should not apply to a part of your code (e.g. for one-off cases like having to use
require() to include a module), you can use flags to let TSLint know about it: https://palantir.github.io/tslint/usage/rule-flags/
More info about TSLint: https://palantir.github.io/tslint/