microsoft / microsoft/TypeScript
Allow tsconfig.yaml in addition to tsconfig.json
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Search Terms
yaml
tsconfig format
Suggestion
I suggest allowing the tsconfig.json file to be replaced with tsconfig.yaml.
This would be implemented by simply converting the yaml to json and passing it to whatever method currently interprets the contents of tsconfig.json.
Additionally, I would propose that the presence of both a tsconfig.json and a tsconfig.yaml file in the root of a project is an error.
Use Cases
Like #30400 (which I found originally), I'd like to add comments to my project config. Also, yaml is just a nicer format for something intended to be edited by a human.
I have created this simply because #30400 (which called for adding tsconfig.js) was closed for reasons which do not apply to yaml. So I thought there should be an open issue. You can always close it for other reasons, right?
Examples
following the example in the handbook
% cat example.json
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"files": [
"core.ts",
"sys.ts",
"types.ts",
"scanner.ts",
"parser.ts",
"utilities.ts",
"binder.ts",
"checker.ts",
"emitter.ts",
"program.ts",
"commandLineParser.ts",
"tsc.ts",
"diagnosticInformationMap.generated.ts"
]
}
% cat example.yaml
compilerOptions:
module: commonjs
noImplicitAny: true
removeComments: true
preserveConstEnums: true
sourceMap: true
files:
- core.ts
- sys.ts
- types.ts
- scanner.ts
- parser.ts
- utilities.ts
- binder.ts
- checker.ts
- emitter.ts
- program.ts
- commandLineParser.ts
- tsc.ts
- diagnosticInformationMap.generated.ts
Checklist
I'M PRETTY SURE 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the existing tsconfig.json format is located and interpreted, using the handbook example as the expected configuration shape. Define completion as accepting an equivalent tsconfig.yaml while reporting an error when both configuration files are present.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, yaml
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100