1. tsc-files
A tiny tool to run tsc on specific files without ignoring tsconfig.json
tsc-files
Package: tsc-files
Created by: gustavopch
Last modified: Tue, 04 Jul 2023 13:15:33 GMT
Version: 1.1.4
License: MIT
Downloads: 447,302
Repository: https://github.com/gustavopch/tsc-files

Install

npm install tsc-files
yarn add tsc-files

tsc-files

GitHub Workflow Status

A tiny tool to run tsc on specific files without ignoring tsconfig.json.

Installation

 npm i -D tsc-files
 yarn add -D tsc-files

Why

I wanted to type-check only the staged files with lint-staged.

Unfortunately passing specific files like tsc --noEmit file1.ts file2.ts will cause TypeScript to simply ignore your tsconfig.json.

There's already an open issue in the TypeScript repo to support this use case — you may want to give a 👍 there: https://github.com/microsoft/TypeScript/issues/27379

Usage

With lint-staged:

 {
  "lint-staged": {
    "**/*.ts": "tsc-files --noEmit"
  }
}

How it works

For the most part, it just forwards all arguments to tsc with one exception: the specified files will not be forwarded — instead, they will be put at the files property of a temporary config that will be generated next to your original tsconfig.json. Other than that, just read tsc --help.

License

Released under the MIT License.

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code