microsoft / microsoft/TypeScript

Provide way to configure default compiler options for TS Server Inferred Project

Abierto
#39,689 3 comentarios 8 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

In Discussion Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

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

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el comportamiento de TS Server para inferred projects y el issue vinculado 39632; después, revisa cómo se gestionan los archivos tsconfig de tipo solution-style con files: []. Determina la ubicación y la precedencia de configuración necesarias para valores predeterminados de compilerOptions como experimentalDecorators y strictNullChecks. Se considera terminado cuando los inferred projects pueden recibir esos valores predeterminados sin cambiar el comportamiento de los proyectos existentes.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.