microsoft / microsoft/TypeScript

[Breaking Change] Typescript 3.7 converts reference paths to tsconfig specified paths breaking multi-project compiles.

Abierto
#36,763 12 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

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

Descripción

Typescript is replacing part of a relative path with one of the paths specified in tsconfig's path section. This is breaking the projects that rely on this file as they cannot resolve the path.

TypeScript Version: 3.7
Visual Studio Version: Community 2017

Search Terms:
Typescirpt paths tsconfig reference paths alias.

Code

In the client project at folder\folder\file.ts

/// <reference path="../../External/Knockout/index.d.ts" />

Becomes (in ClientDeclarations) folder\folder\file.d.ts:

/// <reference types="@Client/external/knockout/index" />

My tsconfig file (folder names with sensitive information are replaced with ***)

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "amd",
    "target": "es6",
    "lib": [ "es6", "dom" ],
    "sourceMap": true,
    "strict": true,
    "build": true,
    "declaration": true,
    "declarationDir": "../ClientDeclarations",
    "baseUrl": "./",
    "paths": {
      "@Common/*": [ "../Common/*" ],
      "@Server/*": [ "../ServerDeclarations/*" ],
      "@Client/*": [ "./*"]
    }
  },
  "include": [
    "./*",
    "./External/***/koco.ts",
    "./External/***/kocss.ts",
    "./External/***/kopath.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "references": [
    { "path": "../Common" }
  ]
}

Expected behavior:
The path should not be transformed during output.

Actual behavior:
The path is transformed to include an @Client reference, which my dependant projects can't resolve. This did not happen in tsc 3.4.

Additionally all of the casing is altered - meaning that this path would not resolve on linux machines.

Related Issues:
I haven't been able to find any - probably because what I'm trying to look for is called a "path" (in tsconfig) which is a highly overloaded term, making searching for anything related to it almost impossible. It would be nice to call it something like a "path alias" so that searching for related issues was easier.

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

Reproduce la salida de declaraciones con tsc 3.7 usando las rutas de tsconfig mostradas, la referencia de proyecto y la ruta de referencia /// relativa; después, compárala con tsc 3.4. Rastrea cómo declaration emit convierte la referencia y las mayúsculas y minúsculas. Se considera terminado cuando la referencia relativa siga siendo resoluble en proyectos dependientes sin un alias @Client incorrecto ni un cambio de mayúsculas y minúsculas.

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

Evaluación

Stack tecnológico
typescript
Área
build-system, compilers
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
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.