Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 06f8d91

Browse files
tsjs-language-engcopybara-github
authored andcommitted
Use moduleNamespace instead of rootNamespace for externs type
PiperOrigin-RevId: 565372825
1 parent b1bf86b commit 06f8d91

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/externs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ const EXTERNS_HEADER = `/**
129129
* to this root.
130130
*/
131131
export function getGeneratedExterns(
132-
externs: {[fileName: string]: {output: string, rootNamespace: string}},
132+
externs: {[fileName: string]: {output: string, moduleNamespace: string}},
133133
rootDir: string): string {
134134
let allExterns = EXTERNS_HEADER;
135135
for (const fileName of Object.keys(externs)) {
@@ -159,7 +159,7 @@ function isInGlobalAugmentation(declaration: ts.Declaration): boolean {
159159
export function generateExterns(
160160
typeChecker: ts.TypeChecker, sourceFile: ts.SourceFile,
161161
host: AnnotatorHost&GoogModuleProcessorHost):
162-
{output: string, diagnostics: ts.Diagnostic[], rootNamespace: string} {
162+
{output: string, diagnostics: ts.Diagnostic[], moduleNamespace: string} {
163163
let output = '';
164164
const diagnostics: ts.Diagnostic[] = [];
165165
const isDts = isDtsFileName(sourceFile.fileName);
@@ -282,7 +282,7 @@ export function generateExterns(
282282
}
283283
}
284284

285-
return {output, diagnostics, rootNamespace};
285+
return {output, diagnostics, moduleNamespace};
286286

287287
function emit(str: string) {
288288
output += str;

src/tsickle.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export function mergeEmitResults(emitResults: EmitResult[]): EmitResult {
8787
let emitSkipped = true;
8888
const emittedFiles: string[] = [];
8989
const externs:
90-
{[fileName: string]: {output: string, rootNamespace: string}} = {};
90+
{[fileName: string]: {output: string, moduleNamespace: string}} = {};
9191
const modulesManifest = new ModulesManifest();
9292
const tsMigrationExportsShimFiles = new Map<string, string>();
9393
for (const er of emitResults) {
@@ -120,7 +120,7 @@ export interface EmitResult extends ts.EmitResult {
120120
* externs.js files produced by tsickle, if any. module IDs are relative paths
121121
* from fileNameToModuleId.
122122
*/
123-
externs: {[moduleId: string]: {output: string, rootNamespace: string}};
123+
externs: {[moduleId: string]: {output: string, moduleNamespace: string}};
124124

125125
/**
126126
* Content for the generated files, keyed by their intended filename.
@@ -247,7 +247,7 @@ export function emit(
247247
tsTransformers);
248248

249249
const externs:
250-
{[fileName: string]: {output: string, rootNamespace: string}} = {};
250+
{[fileName: string]: {output: string, moduleNamespace: string}} = {};
251251
if (host.transformTypesToClosure) {
252252
const sourceFiles =
253253
targetSourceFile ? [targetSourceFile] : program.getSourceFiles();
@@ -256,10 +256,10 @@ export function emit(
256256
if (isDts && host.shouldSkipTsickleProcessing(sourceFile.fileName)) {
257257
continue;
258258
}
259-
const {output, diagnostics, rootNamespace} =
259+
const {output, diagnostics, moduleNamespace} =
260260
generateExterns(typeChecker, sourceFile, host);
261261
if (output) {
262-
externs[sourceFile.fileName] = {output, rootNamespace};
262+
externs[sourceFile.fileName] = {output, moduleNamespace};
263263
}
264264
if (diagnostics) {
265265
tsickleDiagnostics.push(...diagnostics);

test/golden_tsickle_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ testFn('golden tests', () => {
226226
if (!test.name.endsWith('.no_externs')) {
227227
// Concatenate externs for the files that are in this tests sources (but
228228
// not other, shared .d.ts files).
229-
const filteredExterns: {[k: string]: { output: string; rootNamespace: string; }} = {};
229+
const filteredExterns: {[k: string]: { output: string; moduleNamespace: string; }} = {};
230230
let anyExternsGenerated = false;
231231
for (const fileName of tsSources.keys()) {
232232
if (externs[fileName]) {

0 commit comments

Comments
 (0)