* module.exports aliases have correct flags They are marked both as (1) alias and (2) assignment declaration. This fixes alias resolution in cases where multiple module.exports assignments exist, but differ in whether they are aliases or not: ```js function f() { } module.exports = f module.exports = 23 ``` Previously, this construct would fail to resolve the alias `f` because the `export=` symbol would be marked as Alias | Value but not Assignment. This change just adds Assignment so that the assignment declaration alias-following rules apply: you should always follow the alias, regardless of other flags. Also, isAliasSymbolDeclaration needed to be tightened up. Previously, I missed the condition that `module.exports =` aliases required an EntityNameDeclaration on right-hand-side, just like `export default` and `export =` aliases. * Address PR comments 1. Rename test to be more accurate. 2. Always mark module.exports assignments with SymbolFlags.Assignment.
22 lines
328 B
TypeScript
22 lines
328 B
TypeScript
/// <reference path="fourslash.ts" />
|
|
|
|
// @allowJs: true
|
|
// @checkJs: true
|
|
|
|
// @Filename: /a.js
|
|
////function f() {}
|
|
////module.exports = f;
|
|
////module.exports = 42;
|
|
|
|
// @Filename: /b.js
|
|
////export const foo = 0;
|
|
|
|
// @Filename: /c.js
|
|
////foo
|
|
|
|
goTo.file("/c.js");
|
|
verify.importFixAtPosition([
|
|
`import { foo } from "./b";
|
|
|
|
foo`]);
|