### What? Implement the [typescript-strict-plugin](https://github.com/allegro/typescript-strict-plugin) plugin in the payload (core) package. ### Why? 1. One strategy for incremental migration is to enable strictness rules in tsconfig, fix some errors, and push them without committing the changes to tsconfig.json. However, this is not feasible for a package as large as Payload that has over 1000 typescript errors. Until the work is done, new contributions would undo the work being done. 2. Even if no migration work is done after this PR, this change already improves the strictness of the package. 89 of the 311 files within the package already satisfy strict mode. This PR only adds a comment `@ts-strict-ignore` to files that had at least one compilation error. This way, the propagation of errors in those files is stopped. 3. New files created in the package are strict by default (this was the main improvement in version 2 of `typescript-strict-plugin`). I recommend starting the migration with this package because it is the one that almost all the others depend on. Once we finish this package, we can repeat the same strategy on another one, or use the strategy I mentioned in point 1 if the package is small. ### Note If you don't see errors in the IDE when you uncomment `// @ts-strict-ignore`, try restarting the typescript server or VSCode ### How to contribute to the migration ❤️ 1. Remove `// @ts-strict-ignore` comments from 1 or more files 2. Fix the pending errors (they should appear in your IDE's intellisense or when running `cd packages/payload` + `pnpm build:types` 3. Submit your PR! Important: You don't need to fix everything at once! Furthermore, I recommend breaking this down into very small PRs to trace potential issues later if there are any. So if you have 5 minutes, tackle a small file—every bit counts! 🤗
18 lines
353 B
JSON
18 lines
353 B
JSON
{
|
|
"extends": "../../tsconfig.base.json",
|
|
"compilerOptions": {
|
|
/* TODO: remove the following lines */
|
|
"strict": false,
|
|
"noUncheckedIndexedAccess": false,
|
|
"plugins": [
|
|
{
|
|
"name": "typescript-strict-plugin"
|
|
},
|
|
{
|
|
"name": "tsc-strict"
|
|
}
|
|
],
|
|
},
|
|
"references": [{ "path": "../translations" }]
|
|
}
|