Socket
Book a DemoInstallSign in
Socket

@evertbouw/ts-strictify

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evertbouw/ts-strictify

Enable gradual TypeScript strict

1.1.3
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

ts-strictify

Runs TypeScript in strict mode on your changed files.

Demo

Background

TBD

How it works

When you start working on a new feature or fixing a bug, you will modify the code base in one way or another. ts-strictify will take a look at these changes - and only these changes (!) and will complain, if the files you have touched are not strict compliant.

That is different than TypeScript works. You could check a single file against the compiler, but the compiler would also look up the imports and the imports of the imports. Not exactly what you want, when you are looking for incrementally update path.

Head over to https://cschroeter.net/moving-to-strict-typescript/ for more insights.

Install

With yarn:

yarn add --dev ts-strictify

With npm:

npm install --save-dev ts-strictify

Usage

With yarn:

yarn ts-strictify

You can also disable a compiler flag, for example you want to disable strictNullChecks

yarn ts-strictify --strictNullChecks false

You can find a list of all available options here.

With npx:

npx ts-strictify

With npm:

  • Add "ts-strictify": "ts-strictify" to the scripts section of package.json.
  • npm run ts-strictify

Pre-Commit Hook

You can run ts-strictify as a pre-commit hook using husky.

yarn add --dev husky

In package.json, add:

"husky": {
  "hooks": {
    "pre-commit": "ts-strictify"
  }
}

Options

Options:
  --help                          Show help                            [boolean]
  --version                       Show version number                  [boolean]
  --noImplicitAny                                      [boolean] [default: true]
  --noImplicitThis                                     [boolean] [default: true]
  --alwaysStrict                                       [boolean] [default: true]
  --strictBindCallApply                                [boolean] [default: true]
  --strictNullChecks                                   [boolean] [default: true]
  --strictFunctionTypes                                [boolean] [default: true]
  --strictPropertyInitialization                       [boolean] [default: true]
  --noEmit                                             [boolean] [default: true]
  --targetBranch                                    [string] [default: "master"]
  --stagedOnly                 (ignores targetBranch) [boolean] [default: false]

Supported SCM

  • Git

Keywords

typescript

FAQs

Package last updated on 08 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.