Can I use TSlint to detect when the Typescript code type check fails?

problem description

  • case 1: if the attribute does not exist, IDE will remind you of the error, but TSlint/ESlint will not throw an error
    clipboard.png
  • 2:TSlint rules no-empty-interfacerules,
    clipboard.png

related codes

  • TSlint.json file

    {
      "defaultSeverity": "warning",
      "extends": [
        "tslint:recommended"
      ],
      "linterOptions": {
        "exclude": [
          "node_modules/**"
        ]
      },
      "rules": {
        "quotemark": [true, "single"],
        "indent": [true, "spaces", 2],
        "interface-name": false,
        "ordered-imports": false,
        "object-literal-sort-keys": false,
        "no-consecutive-blank-lines": false
      }
    }
    
  • tsconfig.json

    {
      "compilerOptions": {
        "target": "esnext",
        "module": "esnext",
        "strict": true,
        "jsx": "preserve",
        "importHelpers": true,
        "moduleResolution": "node",
        "experimentalDecorators": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "sourceMap": true,
        "baseUrl": ".",
        "types": [
          "node"
        ],
        "paths": {
          "@/*": [
            "src/*"
          ]
        },
        "lib": [
          "esnext",
          "dom",
          "dom.iterable",
          "scripthost"
        ]
      },
      "include": [
        "src/**/*.ts",
        "src/**/*.tsx",
        "src/**/*.vue",
        "tests/**/*.ts",
        "tests/**/*.tsx"
      ],
      "exclude": [
        "node_modules"
      ]
    }
    

what result do you expect?

can TSlint detect and throw errors in TSlint code type checking (case 1)?
if so, how to set it?
if not, is there any way to intercept (case 1) errors in gitHooks.pre-commit and prevent code submission from unresolved errors?


I haven't studied TSlint, but from a software development perspective, TSlint shouldn't throw type checking errors.

  • lint class tools are designed to check code format (aesthetics), not logical
  • if TSlint does its own code review, recreate the wheel of tsc
  • if TSlint calls tsc, you might as well let the user call
  • .

if you want to add type checking, you first need to install typescript

TSC="$(git rev-parse --show-toplevel)/node_modules/.bin/tsc"
"$TSC" --noEmit
if [[ "$?" != 0 ]]; then
  printf "\033[41mERR: type check failed\033[0m"
  exit 1
fi
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37100-2c05d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37100-2c05d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?