aba932aefa
* Commonjs module:create synthetic exports symbol Previously, the `module` identifier in commonjs modules got a synthetic type with a single property `exports`. The exports property reused the file's symbol, which, for a module file, gives the correct exported properties. However, the name of this symbol was still the filename of the file, not `exports`. This PR creates a synthetic symbol for `exports` by copying in a similar way to esModuleInterop's `default` symbol in `resolveESModuleSymbol` (although the intent there is to strip off signatures from the symbol). * correct parent of synthetic symbol
35 lines
3.6 KiB
Plaintext
35 lines
3.6 KiB
Plaintext
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js(5,1): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js(6,1): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
tests/cases/conformance/salsa/usage.js(2,11): error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
tests/cases/conformance/salsa/usage.js(3,11): error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
|
|
|
|
==== tests/cases/conformance/salsa/usage.js (2 errors) ====
|
|
const x = require("./lateBoundAssignmentDeclarationSupport2.js");
|
|
const y = x["my-fake-sym"];
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
const z = x[x.S];
|
|
~~~~~~
|
|
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2")'.
|
|
|
|
==== tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js (2 errors) ====
|
|
// currently unsupported
|
|
const _sym = Symbol();
|
|
const _str = "my-fake-sym";
|
|
|
|
module.exports[_sym] = "ok";
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS7053: Element implicitly has an 'any' type because expression of type 'unique symbol' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
!!! error TS7053: Property '[_sym]' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
module.exports[_str] = "ok";
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS7053: Element implicitly has an 'any' type because expression of type '"my-fake-sym"' can't be used to index type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
!!! error TS7053: Property 'my-fake-sym' does not exist on type 'typeof import("tests/cases/conformance/salsa/lateBoundAssignmentDeclarationSupport2.js")'.
|
|
module.exports.S = _sym; |