TypeScript 的 tsc 是否创建以前转译文件的缓存?
Does TypeScript's tsc create a cache of previously transpiled files?
我为 greeter.ts 创建了一个定义文件,然后是其他一些 *.ts 文件。当我 运行 tsc --project ./tsconfig.tsc.json --declaration
它为所有其他 *.ts 文件生成 *.d.ts 文件,我手动创建的 greeter.d.ts 除外。它拒绝覆盖它。所以,我再次删除了 greeter.d.ts 和 运行 tsc。它输出相同的错误 error TS5055: Cannot write file '~/project/greeter.d.ts' because it would overwrite input file.
,即使该文件不再存在。
那么,为什么 tsc 能够覆盖它之前生成的文件,而不是我创建的文件?更有什者,我删除后它还认为手动创建的*.d.ts文件存在。逻辑上,某处有缓存,但我没有找到相关信息。
是否有以前 t运行 个溢出文件的缓存?
我怀疑它会创建缓存。我发现如何 "knows" 我手动创建了一个定义文件。在我的 greeter.ts 中,我这样引用它:
/// <reference path="greeter.d.ts" />
export class Greeter {
public greeting: string;
constructor() {
console.log('Greeter()');
}
public activate() {
this.greeting = 'hello worldz';
}
}
删除引用清除了错误并且 tsc 能够创建文件。
我为 greeter.ts 创建了一个定义文件,然后是其他一些 *.ts 文件。当我 运行 tsc --project ./tsconfig.tsc.json --declaration
它为所有其他 *.ts 文件生成 *.d.ts 文件,我手动创建的 greeter.d.ts 除外。它拒绝覆盖它。所以,我再次删除了 greeter.d.ts 和 运行 tsc。它输出相同的错误 error TS5055: Cannot write file '~/project/greeter.d.ts' because it would overwrite input file.
,即使该文件不再存在。
那么,为什么 tsc 能够覆盖它之前生成的文件,而不是我创建的文件?更有什者,我删除后它还认为手动创建的*.d.ts文件存在。逻辑上,某处有缓存,但我没有找到相关信息。
是否有以前 t运行 个溢出文件的缓存?
我怀疑它会创建缓存。我发现如何 "knows" 我手动创建了一个定义文件。在我的 greeter.ts 中,我这样引用它:
/// <reference path="greeter.d.ts" />
export class Greeter {
public greeting: string;
constructor() {
console.log('Greeter()');
}
public activate() {
this.greeting = 'hello worldz';
}
}
删除引用清除了错误并且 tsc 能够创建文件。