This commit is contained in:
1 parent
5db9407d78
commit
678964b8de
4 files changed
+29
-3
No files matched your search
Whitespace-only changes.
+4
-3
@@ -2588,12 +2588,13 @@ function genericPrintNoParens(path, options, print, args) {
|
||||
parts.push(printTypeScriptModifiers(path, options, print));
|
||||
|
||||
// Global declaration looks like this:
|
||||
// declare global { ... }
|
||||
// (declare)? global { ... }
|
||||
const isGlobalDeclaration =
|
||||
n.name.type === "Identifier" &&
|
||||
n.name.name === "global" &&
|
||||
n.modifiers &&
|
||||
n.modifiers.some(modifier => modifier.type === "TSDeclareKeyword");
|
||||
!/namespace|module/.test(
|
||||
options.originalText.slice(util.locStart(n), util.locStart(n.name))
|
||||
);
|
||||
|
||||
if (!isGlobalDeclaration) {
|
||||
parts.push(isExternalModule ? "module " : "namespace ");
|
||||
|
||||
@@ -6,3 +6,24 @@ declare module 'autoprefixer';
|
||||
declare module "autoprefixer";
|
||||
|
||||
`;
|
||||
|
||||
exports[`global.js 1`] = `
|
||||
namespace global {}
|
||||
module global {}
|
||||
global {}
|
||||
declare global {}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
namespace global {
|
||||
|
||||
}
|
||||
namespace global {
|
||||
|
||||
}
|
||||
global {
|
||||
|
||||
}
|
||||
declare global {
|
||||
|
||||
}
|
||||
|
||||
`;
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace global {}
|
||||
module global {}
|
||||
global {}
|
||||
declare global {}
|
||||
Reference in new issue
Block a user