Skip to content

In JS, module.exports should be aliasable with a var declaration #22460

Closed
@sandersn

Description

@sandersn

Code

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js

// from assert
var assert = module.exports = ok;
function fail() {
}
assert.fail = fail;
function ok() {

}
assert.ok = ok;

assert.AssertionError = function (actual, expect) {
    this.name = 'AssertionError';
    this.actual = actual;
    this.expected = expected;
}

Expected behavior:
No errors, and assert results in a module that is callable with exports { ok, fail, AssertionError }.
Actual behavior:
Lots of errors, and no exports, just a callable module.

Metadata

Metadata

Assignees

Labels

SuggestionAn idea for TypeScriptcheckJsRelates to checking JavaScript using TypeScript

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions