Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

complete-tsconfig

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complete-tsconfig - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

3

package.json
{
"name": "complete-tsconfig",
"version": "1.0.0",
"version": "1.1.0",
"description": "A sharable TypeScript config for TypeScript projects.",

@@ -28,3 +28,2 @@ "keywords": [

"tsconfig.browser.json",
"tsconfig.mod.json",
"tsconfig.node.json"

@@ -31,0 +30,0 @@ ],

@@ -1,2 +0,2 @@

# complete-tsconfig
# `complete-tsconfig`

@@ -8,1 +8,50 @@ [![npm version](https://img.shields.io/npm/v/complete-tsconfig.svg)](https://www.npmjs.com/package/complete-tsconfig)

Note that if you use these configs with `pnpm`, you must also install `@tsconfig/strictest`, since pnpm does not properly handle transitive dependencies. (You also must also install `@tsconfig/node-lts` if you are using the Node.js config.)
## Configs Offered
- [tsconfig.base.json](tsconfig.base.json) - A config meant to be used by all TypeScript projects.
- [tsconfig.browser.json](tsconfig.browser.json) - A config meant for projects running in Node.js.
- [tsconfig.node.json](tsconfig.node.json) - A config meant for projects running in the browser.
## Install
```sh
npm install complete-tsconfig --save
```
## Usage
First, extend from the base config. Second, extend from either the Node.js config or the browser config. For example:
```jsonc
// The configuration file for TypeScript.
{
"$schema": "https://raw.githubusercontent.com/complete-ts/complete/main/packages/complete-tsconfig/schemas/tsconfig-strict-schema.json",
"extends": [
// https://github.com/complete-ts/complete/blob/main/packages/complete-tsconfig/tsconfig.base.json
"complete-tsconfig/tsconfig.base.json",
// https://github.com/complete-ts/complete/blob/main/packages/complete-tsconfig/tsconfig.node.json
"complete-tsconfig/tsconfig.node.json",
],
}
```
Note that the [base config](tsconfig.base.json) handily specifies an `include` of `["./src/**/*.ts", "./src/**/*.tsx"]` and an `outDir` of `"./dist"`, so you can omit those options to keep your config file small and clean.
## Strict Schema
By default, VSCode will automatically recognize TypeScript config files and apply a schema. However, this schema allows for additional properties in order to prevent throwing errors for tools/frameworks like [Angular](https://angular.dev/) that add [custom fields](https://angular.dev/reference/configs/angular-compiler-options).
However, the problem with this is that you might accidentally misspell a property (or e.g. accidentally add a compiler option to the root object). In these cases, you will not get a red squiggly line in your editor, making for a frustrating troubleshooting experience.
In order to fix this, you should use the strict schema in all of your TypeScript configuration files like this:
```jsonc
{
"$schema": "https://raw.githubusercontent.com/complete-ts/complete/main/packages/complete-tsconfig/schemas/tsconfig-strict-schema.json",
// Other configuration goes here.
}
```

@@ -1,5 +0,5 @@

// This is a tsconfig.json intended to be used as a base for all TypeScript projects. It only
// contains options that have to do with code checking strictness and omits all options having to do
// with environment or transpilation (besides the "include" and "outDir" options, which should be
// standardized across all projects).
// This is a TypeScript configuration intended to be used as a base for all TypeScript projects. It
// only contains options that have to do with code checking strictness and omits all options having
// to do with environment or transpilation (besides the "include" and "outDir" options, which should
// be standardized across all projects).
{

@@ -15,2 +15,7 @@ // We extend the strictest base config:

"compilerOptions": {
// The "strictest" config has the "exactOptionalPropertyTypes" flag set to true. However, this
// is only needed in rare cases, like when using the `in` operator. Furthermore, it can cause
// spurious errors when trying to clear an attribute of an object.
"exactOptionalPropertyTypes": false,
// The "strictest" config has the "noFallthroughCasesInSwitch" flag set to true. However, we

@@ -17,0 +22,0 @@ // prefer the "no-fallthrough" ESLint rule instead, as this does not have to do with types.

@@ -1,2 +0,3 @@

// This is a tsconfig.json intended to be used by TypeScript programs used in a browser environment.
// This is a TypeScript configuration intended to be used by TypeScript programs used in a browser
// environment.
{

@@ -3,0 +4,0 @@ // https://www.typescriptlang.org/docs/handbook/compiler-options.html

@@ -1,2 +0,3 @@

// This is a tsconfig.json intended to be used by TypeScript programs used in a Node.js environment.
// This is a TypeScript configuration intended to be used by TypeScript programs used in a Node.js
// environment.
{

@@ -3,0 +4,0 @@ // We extend the recommended Node config:

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc