|
| 1 | +//// [tests/cases/compiler/exportStarNameCollisions.ts] //// |
| 2 | + |
| 3 | +//// [a.ts] |
| 4 | +export const onlyA = 1; |
| 5 | +export const shared = "a"; |
| 6 | +export interface SharedType { fromA: true } |
| 7 | +export default "a"; |
| 8 | + |
| 9 | +//// [b.ts] |
| 10 | +export const onlyB = 2; |
| 11 | +export const shared = "b"; |
| 12 | +export interface SharedType { fromB: true } |
| 13 | +export default "b"; |
| 14 | + |
| 15 | +//// [b2.ts] |
| 16 | +export const shared = "b2"; |
| 17 | + |
| 18 | +//// [sameSymbol.ts] |
| 19 | +export { shared } from "./a"; |
| 20 | + |
| 21 | +//// [twoStarsCollide.ts] |
| 22 | +// 'shared' and 'SharedType' come from both modules with different meanings. |
| 23 | +export * from "./a"; |
| 24 | +export * from "./b"; |
| 25 | + |
| 26 | +//// [threeStarsCollide.ts] |
| 27 | +// Both later declarations are reported against the first one. |
| 28 | +export * from "./a"; |
| 29 | +export * from "./b"; |
| 30 | +export * from "./b2"; |
| 31 | + |
| 32 | +//// [sameSymbolTwice.ts] |
| 33 | +// Reaching the same symbol through two declarations is not a collision. |
| 34 | +export * from "./a"; |
| 35 | +export * from "./sameSymbol"; |
| 36 | + |
| 37 | +//// [localShadows.ts] |
| 38 | +// A module's own export takes precedence and silences the collision. |
| 39 | +export * from "./a"; |
| 40 | +export * from "./b"; |
| 41 | +export const shared = "local"; |
| 42 | + |
| 43 | +//// [singleStar.ts] |
| 44 | +export * from "./a"; |
| 45 | + |
| 46 | +//// [typeOnlyThenValue.ts] |
| 47 | +export type * from "./a"; |
| 48 | +export * from "./b"; |
| 49 | + |
| 50 | +//// [valueThenTypeOnly.ts] |
| 51 | +export * from "./a"; |
| 52 | +export type * from "./b"; |
| 53 | + |
| 54 | +//// [chained.ts] |
| 55 | +export * from "./twoStarsCollide"; |
| 56 | +export * from "./singleStar"; |
| 57 | + |
| 58 | +//// [consumer.ts] |
| 59 | +import { onlyA, onlyB, shared as s1 } from "./twoStarsCollide"; |
| 60 | +import { shared as s2 } from "./sameSymbolTwice"; |
| 61 | +import { shared as s3 } from "./localShadows"; |
| 62 | +import { shared as s4, onlyA as a4 } from "./singleStar"; |
| 63 | +import { onlyA as a5, onlyB as b5 } from "./typeOnlyThenValue"; |
| 64 | +import { onlyA as a6, onlyB as b6 } from "./valueThenTypeOnly"; |
| 65 | +import { onlyA as a7, onlyB as b7, shared as s7 } from "./chained"; |
| 66 | +import type { SharedType } from "./twoStarsCollide"; |
| 67 | +export const values = [onlyA, onlyB, s1, s2, s3, s4, a4, a5, b5, a6, b6, a7, b7, s7]; |
| 68 | +export let t: SharedType | undefined; |
| 69 | + |
| 70 | + |
| 71 | +//// [a.js] |
| 72 | +export const onlyA = 1; |
| 73 | +export const shared = "a"; |
| 74 | +export default "a"; |
| 75 | +//// [b.js] |
| 76 | +export const onlyB = 2; |
| 77 | +export const shared = "b"; |
| 78 | +export default "b"; |
| 79 | +//// [b2.js] |
| 80 | +export const shared = "b2"; |
| 81 | +//// [sameSymbol.js] |
| 82 | +export { shared } from "./a"; |
| 83 | +//// [twoStarsCollide.js] |
| 84 | +// 'shared' and 'SharedType' come from both modules with different meanings. |
| 85 | +export * from "./a"; |
| 86 | +export * from "./b"; |
| 87 | +//// [threeStarsCollide.js] |
| 88 | +// Both later declarations are reported against the first one. |
| 89 | +export * from "./a"; |
| 90 | +export * from "./b"; |
| 91 | +export * from "./b2"; |
| 92 | +//// [sameSymbolTwice.js] |
| 93 | +// Reaching the same symbol through two declarations is not a collision. |
| 94 | +export * from "./a"; |
| 95 | +export * from "./sameSymbol"; |
| 96 | +//// [localShadows.js] |
| 97 | +// A module's own export takes precedence and silences the collision. |
| 98 | +export * from "./a"; |
| 99 | +export * from "./b"; |
| 100 | +export const shared = "local"; |
| 101 | +//// [singleStar.js] |
| 102 | +export * from "./a"; |
| 103 | +//// [typeOnlyThenValue.js] |
| 104 | +export * from "./b"; |
| 105 | +//// [valueThenTypeOnly.js] |
| 106 | +export * from "./a"; |
| 107 | +//// [chained.js] |
| 108 | +export * from "./twoStarsCollide"; |
| 109 | +export * from "./singleStar"; |
| 110 | +//// [consumer.js] |
| 111 | +import { onlyA, onlyB, shared as s1 } from "./twoStarsCollide"; |
| 112 | +import { shared as s2 } from "./sameSymbolTwice"; |
| 113 | +import { shared as s3 } from "./localShadows"; |
| 114 | +import { shared as s4, onlyA as a4 } from "./singleStar"; |
| 115 | +import { onlyB as b5 } from "./typeOnlyThenValue"; |
| 116 | +import { onlyA as a6 } from "./valueThenTypeOnly"; |
| 117 | +import { onlyA as a7, onlyB as b7, shared as s7 } from "./chained"; |
| 118 | +export const values = [onlyA, onlyB, s1, s2, s3, s4, a4, a5, b5, a6, b6, a7, b7, s7]; |
| 119 | +export let t; |
| 120 | + |
| 121 | + |
| 122 | +//// [a.d.ts] |
| 123 | +export declare const onlyA = 1; |
| 124 | +export declare const shared = "a"; |
| 125 | +export interface SharedType { |
| 126 | + fromA: true; |
| 127 | +} |
| 128 | +declare const _default = "a"; |
| 129 | +export default _default; |
| 130 | +//// [b.d.ts] |
| 131 | +export declare const onlyB = 2; |
| 132 | +export declare const shared = "b"; |
| 133 | +export interface SharedType { |
| 134 | + fromB: true; |
| 135 | +} |
| 136 | +declare const _default = "b"; |
| 137 | +export default _default; |
| 138 | +//// [b2.d.ts] |
| 139 | +export declare const shared = "b2"; |
| 140 | +//// [sameSymbol.d.ts] |
| 141 | +export { shared } from "./a"; |
| 142 | +//// [twoStarsCollide.d.ts] |
| 143 | +export * from "./a"; |
| 144 | +export * from "./b"; |
| 145 | +//// [threeStarsCollide.d.ts] |
| 146 | +export * from "./a"; |
| 147 | +export * from "./b"; |
| 148 | +export * from "./b2"; |
| 149 | +//// [sameSymbolTwice.d.ts] |
| 150 | +export * from "./a"; |
| 151 | +export * from "./sameSymbol"; |
| 152 | +//// [localShadows.d.ts] |
| 153 | +export * from "./a"; |
| 154 | +export * from "./b"; |
| 155 | +export declare const shared = "local"; |
| 156 | +//// [singleStar.d.ts] |
| 157 | +export * from "./a"; |
| 158 | +//// [typeOnlyThenValue.d.ts] |
| 159 | +export type * from "./a"; |
| 160 | +export * from "./b"; |
| 161 | +//// [valueThenTypeOnly.d.ts] |
| 162 | +export * from "./a"; |
| 163 | +export type * from "./b"; |
| 164 | +//// [chained.d.ts] |
| 165 | +export * from "./twoStarsCollide"; |
| 166 | +export * from "./singleStar"; |
| 167 | +//// [consumer.d.ts] |
| 168 | +import type { SharedType } from "./twoStarsCollide"; |
| 169 | +export declare const values: (string | number)[]; |
| 170 | +export declare let t: SharedType | undefined; |
0 commit comments