* For duplicate source files of the same package, make one redirect to the other * Add reuseProgramStructure tests * Copy `sourceFileToPackageId` and `isSourceFileTargetOfRedirect` only if we completely reuse old structure * Use fallthrough instead of early exit from loop * Use a set to efficiently detect duplicate package names * Move map setting outside of createRedirectSourceFile * Correctly handle seenPackageNames set * sourceFileToPackageId -> sourceFileToPackageName * Renames * Respond to PR comments * Fix bug where `oldSourceFile !== newSourceFile` because oldSourceFile was a redirect * Clean up redirectInfo * Respond to PR comments
52 lines
1,001 B
TypeScript
52 lines
1,001 B
TypeScript
//// [tests/cases/compiler/duplicatePackage.ts] ////
|
|
|
|
//// [index.d.ts]
|
|
import X from "x";
|
|
export function a(x: X): void;
|
|
|
|
//// [index.d.ts]
|
|
export default class X {
|
|
private x: number;
|
|
}
|
|
|
|
//// [package.json]
|
|
{ "name": "x", "version": "1.2.3" }
|
|
|
|
//// [index.d.ts]
|
|
import X from "x";
|
|
export const b: X;
|
|
|
|
//// [index.d.ts]
|
|
content not parsed
|
|
|
|
//// [package.json]
|
|
{ "name": "x", "version": "1.2.3" }
|
|
|
|
//// [index.d.ts]
|
|
import X from "x";
|
|
export const c: X;
|
|
|
|
//// [index.d.ts]
|
|
export default class X {
|
|
private x: number;
|
|
}
|
|
|
|
//// [package.json]
|
|
{ "name": "x", "version": "1.2.4" }
|
|
|
|
//// [a.ts]
|
|
import { a } from "a";
|
|
import { b } from "b";
|
|
import { c } from "c";
|
|
a(b); // Works
|
|
a(c); // Error, these are from different versions of the library.
|
|
|
|
|
|
//// [a.js]
|
|
"use strict";
|
|
exports.__esModule = true;
|
|
var a_1 = require("a");
|
|
var b_1 = require("b");
|
|
var c_1 = require("c");
|
|
a_1.a(b_1.b); // Works
|
|
a_1.a(c_1.c); // Error, these are from different versions of the library.
|