microsoft / microsoft/TypeScript

Configure from package.json

Open
#32,830 65 comments 241 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Search Terms

package.json, config, configuration, tsconfig

Suggestion

Allow package.json as an alternate source for tsconfig.json options. To be clear, I am requesting that you please re-evaluate #6590 - it has been 2 years since that issue was posted, so interests may have changed and I believe this feature holds good value.

UPDATE: 2022-04-28

Please vote how you would like to see this feature implemented here: https://github.com/microsoft/TypeScript/issues/32830#issuecomment-1112372061

Use Cases

What do you want to use this for?

Provide a broader configuration support and decluttering the project root of configuration files that can easily be moved to package.json.

What shortcomings exist with current approaches?

Some users prefer to store their all their configuration files in 1 larger file. Right now, that is not an option.

Examples

Example of what the package.json would look like.

{
	"name": "example",
	"version": "1.0.0",
	"description": "This is an example",
	"license": "MIT",
	"tsconfig": {
		"compilerOptions": {
			"module": "commonjs",
			"moduleResolution": "node",
			"outDir": ".build",
			"pretty": true,
			"rootDir": "./",
			"sourceMap": true,
			"target": "ES5",
			"strict": true
		},
		"exclude": [
			"node_modules"
		],
		"include": [
			"index.ts",
			"src/**/*"
		]
	}
}

Checklist

My suggestion meets these guidelines:

  • ✅ This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • ✅ This wouldn't change the runtime behavior of existing JavaScript code
  • ✅ This could be implemented without emitting different JS based on the types of the expressions
  • ✅ This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • ✅ This feature would agree with the rest of TypeScript's Design Goals.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the related issue #6590 and the 65-comment discussion, including the implementation poll, to understand the unresolved design choices. The issue is complete when TypeScript can consistently discover and apply the requested tsconfig options from the tsconfig property in package.json.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.