allegro / typescript-strict-plugin

Typescript plugin that allows turning on strict mode in specific files or directories.
MIT License
332 stars 29 forks source link

Object possibly undefined is passing? #65

Closed sheam closed 8 months ago

sheam commented 8 months ago

I have the following in my ts config file:

    "strict": false,
    "plugins": [
      {
        "name": "typescript-strict-plugin"
      }
    ],

I have a TS file with the following:

   const age = myCollection.find(x => x.name === targetName).age;

the file does not have a // @ts-strict-ignore comment in it.

My IDE correctly flags the issue as Object possibly undefined. when I build, it does not create an error, and the linter passes as well.

I want to prevent a file like this from being commited using a git commit hook. Currerenty our hook runs eslint via lint-staged but I wonder if it could run tsc-strict just on the staged files?

sheam commented 8 months ago

Closing to rephrase.