Skip to content

Find all references for module.exports expandoes differ depending on expandoes members are calculated or not #36988

Description

TypeScript Version: 3.7.x-dev.201xxxxx

Found with #36808

Search Terms:

Code
Test case : tests/cases/fourslash/findAllRefs_importType_js.ts

/// <reference path='fourslash.ts' />// @allowJs: true// @checkJs: true// @Filename: /a.js////[|[|{| "contextRangeIndex": 0 |}module|].exports = [|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 2 |}C|] {}|];|]////[|module.exports.[|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 4 |}D|] = [|class [|{| "isWriteAccess": true, "isDefinition": true, "contextRangeIndex": 6 |}D|] {}|];|]// @Filename: /b.js/////** [|@type {import("[|{| "contextRangeIndex": 8 |}./a|]")}|] */////const x = 0;/////** [|@type {import("[|{| "contextRangeIndex": 10 |}./a|]").[|D|]}|] */////const y = 0;verify.noErrors();// TODO: GH#24025const[rModuleDef,rModule,r0Def,r0,r1Def,r1,r2Def,r2,r3Def,r3,r4Def,r4,r5]=test.ranges();verify.referenceGroups([r3,r4],[{definition: 'module "/a"',ranges: [r4,rModule]},{definition: "(local class) C",ranges: [r0]},{definition: "(alias) (local class) export=\nimport export=",ranges: [r3]},]);// This is correct result of findallrefsverify.referenceGroups(rModule,[{definition: 'module "/a"',ranges: [r3,r4,rModule]}]);verify.referenceGroups(r0,[{definition: "(local class) C",ranges: [r0]},// TODO: This definition is really ugly{definition: "(alias) (local class) export=\nimport export=",ranges: [r3]},]);verify.referenceGroups([r1,r5],[{definition: "class D\n(property) D: typeof D",ranges: [r1,r5,r5]},// TODO: should only reference r5 once]);verify.referenceGroups(r2,[{definition: "(local class) D",ranges: [r2]},{definition: "class D\n(property) D: typeof D",ranges: [r5]},]);verify.referenceGroups([r3,r4],[{definition: 'module "/a"',ranges: [r4,rModule]},/// This should be same as the correct one checked at the start//{ definition: "(local class) C", ranges: [r0] },//{ definition: "(alias) (local class) export=\nimport export=", ranges: [r3] },]);

Expected behavior:

Actual behavior:

Playground Link:

Related Issues:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions