Skip to content

Invalid property read for find-all-references when exporting non-existent binding #51963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DanielRosenwasser opened this issue Dec 19, 2022 · 2 comments · Fixed by #52006
Closed
Labels
Bug A bug in TypeScript Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. Good First Issue Well scoped, documented and has the green light Help Wanted You can do this

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Dec 19, 2022

// @filename: ./bar.ts
import { Foo/**/ } from "./foo";
// @filename: ./foo.ts
export { Foo }
{
    "compilerOptions": {
        "module": "commonjs"
    }
}

Find all references on Foo at /**/

TypeError: Cannot read properties of undefined (reading 'escapedName')
    at getImport ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:137739:24)
    at getImportOrExportSymbol ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:137672:58)
    at getImportOrExportReferences ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:139039:28)
    at getReferencesAtLocation ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:138981:5)
    at getReferencesInContainer ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:138928:7)
    at getReferencesInContainerOrFiles ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:138557:7)
    at getReferencedSymbolsForSymbol ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:138550:7)
    at Object.getReferencedSymbolsForNode ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:138346:24)
    at Object.findReferencedSymbols ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:137952:34)
    at Object.findReferences ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:122190:41)
    at [WORKSPACE]/node_modules/typescript/lib/tsserver.js:158208:43
    at searchPosition ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:158351:28)
    at getPerProjectReferences ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:158326:32)
    at getReferencesWorker ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:158201:29)
    at IpcIOSession.getReferences ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:159748:24)
    at references ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:158579:43)
    at [WORKSPACE]/node_modules/typescript/lib/tsserver.js:160677:69
    at IpcIOSession.executeWithRequestId ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:160669:14)
    at IpcIOSession.executeCommand ([WORKSPACE]/node_modules/typescript/lib/tsserver.js:160677:29)

Related:

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this Good First Issue Well scoped, documented and has the green light Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. labels Dec 19, 2022
@a-tarasyuk
Copy link
Contributor

a-tarasyuk commented Dec 21, 2022

The following test works as expected

/// <reference path="fourslash.ts" />

// @Filename: /tsconfig.json
//// { "compilerOptions": { "module": "commonjs" } }

// @filename: /bar.ts
////import { Foo } from "./foo";

// @filename: /foo.ts
////export { Foo/**/ }

verify.baselineFindAllReferences('');

@DanielRosenwasser
Copy link
Member Author

DanielRosenwasser commented Dec 23, 2022

Whoops! Try it on the import, not the export. I fixed the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Symbol Navigation Relates to go-to-definition, find-all-references, highlighting/occurrences. Good First Issue Well scoped, documented and has the green light Help Wanted You can do this
Projects
None yet
2 participants