microsoft / microsoft/TypeScript
Provide way to configure default compiler options for TS Server Inferred Project
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 132
Description
Search Terms
Inferred Project
TS Server
Suggestion
Add an option to configure the default compilerOptions for inferred projects outside of the host.
Related to: https://docs.google.com/document/d/1eB6cGCG_2ircfS5GzpDC9dBgikeYYcMxghVH5sDESHw/edit#heading=h.telvo0tzo7t0 and https://github.com/microsoft/TypeScript/issues/39632
Checklist
Use Cases
Currently, there is no way to configure the default compilerOptions for inferred projects outside of the server host. Being able to configure should options would be give a better DX when not using the default compiler options such as experimentalDecorators, strictNullChecks etc... together with stricter file inclusions, ie favoring explicitly listing the entry-point files using files instead of include with globbing.
Previously when not using TypeScript solution style tsconfig this could be achieved by adding a tsconfig.json in the root of the project which will include all files and set these options example.
{
"compilerOptions": {
"experimentalDecorators": true,
"strictNullChecks": true,
...
}
}
This trickery cannot be used when using a solution style tsconfig, because the root tsconfig will not contain any files due to files: [] setting.
Examples
Ideally, compiler options for inferred projects are configured in a TypeScript configuration file. When using solution style tsconfig, such configuration can be set here.
{
"files": [],
"compilerOptions": {
"experimentalDecorators": true,
"strictNullChecks": true,
...
},
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
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.
//cc @kyliau
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le comportement de TS Server pour les inferred projects et par l’issue liée 39632, puis examinez comment sont gérés les fichiers tsconfig de type solution-style avec files: []. Déterminez l’emplacement et la priorité de la configuration nécessaires pour des valeurs par défaut de compilerOptions telles que experimentalDecorators et strictNullChecks. Le travail est terminé lorsque les inferred projects peuvent recevoir ces valeurs par défaut sans modifier le comportement des projets existants.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100