Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5424,7 +5424,7 @@ func (c *Checker) checkExternalModuleExports(node *ast.Node) {
exportEqualsSymbol := moduleSymbol.Exports[ast.InternalSymbolNameExportEquals]
if exportEqualsSymbol != nil && c.hasExportedMembers(moduleSymbol) {
declaration := core.OrElse(c.getDeclarationOfAliasSymbol(exportEqualsSymbol), exportEqualsSymbol.ValueDeclaration)
if declaration != nil && !isTopLevelInExternalModuleAugmentation(declaration) {
if declaration != nil && !isTopLevelInExternalModuleAugmentation(declaration) && !ast.IsInJSFile(declaration) {
c.error(declaration, diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements)
}
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
index.js(9,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type.


==== index.js (2 errors) ====
==== index.js (1 errors) ====
/**
* @typedef Options
* @property {string} opt
Expand All @@ -12,8 +11,6 @@ index.js(9,34): error TS7006: Parameter 'options' implicitly has an 'any' type.
* @param {Options} options
*/
module.exports = function loader(options) {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
~~~~~~~
!!! error TS7006: Parameter 'options' implicitly has an 'any' type.

Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
file.js(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
file.js(8,9): error TS2339: Property 'customSymbol2' does not exist on type 'typeof import("file")'.


==== file.js (2 errors) ====
==== file.js (1 errors) ====
const customSymbol = Symbol("custom");

// This is a common pattern in Node’s built-in modules:
module.exports = {
~~~~~~~~~~~~~~~~~~
customSymbol,
~~~~~~~~~~~~~~~~~
};
~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.

exports.customSymbol2 = Symbol("custom");
~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/x.js(1,16): error TS2339: Property 'x' does not exist on type 'typeof import("/y")'.
/x.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements.


==== /x.js (2 errors) ====
==== /x.js (1 errors) ====
module.exports.x = 1;
~
!!! error TS2339: Property 'x' does not exist on type 'typeof import("/y")'.
module.exports = require("./y.js");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.

==== /y.d.ts (0 errors) ====
export declare type x = 1;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
bar.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
bar.js(2,9): error TS2339: Property 'blah' does not exist on type 'typeof import("bar")'.
bar.js(2,24): error TS2339: Property 'someProp' does not exist on type 'typeof import("bar")'.


==== bar.js (3 errors) ====
==== bar.js (2 errors) ====
module.exports = function () {};
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
exports.blah = exports.someProp;
~~~~
!!! error TS2339: Property 'blah' does not exist on type 'typeof import("bar")'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
mod1.js(5,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
use.js(1,30): error TS2694: Namespace 'C' has no exported member 'Con'.


==== mod1.js (1 errors) ====
==== mod1.js (0 errors) ====
/** @callback Con - some kind of continuation
* @param {object | undefined} error
* @return {any} I don't even know what this should return
*/
module.exports = C
~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
function C() {
this.p = 1
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
bug43713.js(1,9): error TS2305: Module '"./commonJSAliasedExport"' has no exported member 'funky'.
commonJSAliasedExport.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on type '(ast: any) => any'.


Expand All @@ -12,15 +11,13 @@ commonJSAliasedExport.js(7,16): error TS2339: Property 'funky' does not exist on
var diddy = funky(1)


==== commonJSAliasedExport.js (2 errors) ====
==== commonJSAliasedExport.js (1 errors) ====
const donkey = (ast) => ast;

function funky(declaration) {
return false;
}
module.exports = donkey;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.funky = funky;
~~~~~
!!! error TS2339: Property 'funky' does not exist on type '(ast: any) => any'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
bug24934.js(2,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
use.js(1,21): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'esModuleInterop' flag and referencing its default export.


==== bug24934.js (1 errors) ====
==== bug24934.js (0 errors) ====
export function abc(a, b, c) { return 5; }
module.exports = { abc };
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
==== use.js (1 errors) ====
import { abc } from './bug24934';
~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
cls.js(7,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
cls.js(8,16): error TS2339: Property 'Strings' does not exist on type 'typeof Foo'.


==== cls.js (2 errors) ====
==== cls.js (1 errors) ====
const Bar = require("./bar");
const Strings = {
a: "A",
b: "B"
};
class Foo extends Bar {}
module.exports = Foo;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.Strings = Strings;
~~~~~~~
!!! error TS2339: Property 'Strings' does not exist on type 'typeof Foo'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
source.js(15,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
source.js(16,16): error TS2339: Property 'Strings' does not exist on type 'typeof Handler'.


==== source.js (2 errors) ====
==== source.js (1 errors) ====
class Handler {
static get OPTIONS() {
return 1;
Expand All @@ -18,8 +17,6 @@ source.js(16,16): error TS2339: Property 'Strings' does not exist on type 'typeo
}

module.exports = Handler;
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.Strings = Strings
~~~~~~~
!!! error TS2339: Property 'Strings' does not exist on type 'typeof Handler'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
index.js(3,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
index.js(4,16): error TS2339: Property 'memberName' does not exist on type '() => void'.


==== index.js (2 errors) ====
==== index.js (1 errors) ====
const m = require("./exporter");

module.exports = m.default;
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.memberName = "thing";
~~~~~~~~~~
!!! error TS2339: Property 'memberName' does not exist on type '() => void'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
index.js(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
index.js(9,16): error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'.


==== index.js (2 errors) ====
==== index.js (1 errors) ====
module.exports = class {
~~~~~~~~~~~~~~~~~~~~~~~~
/**
~~~~~~~
* @param {number} p
~~~~~~~~~~~~~~~~~~~~~~~~
*/
~~~~~~~
constructor(p) {
~~~~~~~~~~~~~~~~~~~~
this.t = 12 + p;
~~~~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
}
~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.Sub = class {
~~~
!!! error TS2339: Property 'Sub' does not exist on type 'typeof (Anonymous class)'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
index.js(7,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
index.js(12,16): error TS2339: Property 'Another' does not exist on type 'typeof Q'.


==== index.js (2 errors) ====
==== index.js (1 errors) ====
class A {
member = new Q();
}
class Q {
x = 42;
}
module.exports = class Q {
~~~~~~~~~~~~~~~~~~~~~~~~~~
constructor() {
~~~~~~~~~~~~~~~~~~~
this.x = new A();
~~~~~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
}
~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
module.exports.Another = Q;
~~~~~~~
!!! error TS2339: Property 'Another' does not exist on type 'typeof Q'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
index.js(6,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
index.js(8,16): error TS2339: Property 'additional' does not exist on type 'Foo'.


==== index.js (2 errors) ====
==== index.js (1 errors) ====
class Foo {
static stat = 10;
member = 10;
}

module.exports = new Foo();
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.

module.exports.additional = 20;
~~~~~~~~~~
Expand Down
Loading
Loading