Skip to content

Crash in JS constructors initialized with intermediate module.exports assignment #37194

Closed

Description

// @filename: foo.js
var /*definition*/Foo = module.exports = function () {

}

Foo.prototype.blah = function() {

}

new Foo/*use*/()

Go to definition on /*use*/.

Expected: cursor navigates to /*definition*/
Actual:

Debug Failure. Expected declaration to have at least one class-like declaration
Error: Debug Failure. Expected declaration to have at least one class-like declaration
    at getConstructSignatureDefinition (...\TypeScript\lib\tsserver.js:115538:89)
    at getDefinitionFromSymbol (...\TypeScript\lib\tsserver.js:115533:20)
    at getDefinitionAtPosition (...\TypeScript\lib\tsserver.js:115340:32)
    at Object.getDefinitionAndBoundSpan (...\TypeScript\lib\tsserver.js:115457:31)
    at Proxy.getDefinitionAndBoundSpan (...\TypeScript\lib\tsserver.js:135385:38)
    at IOSession.Session.getDefinitionAndBoundSpan (...\TypeScript\lib\tsserver.js:144925:83)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (...\TypeScript\lib\tsserver.js:144251:61)
    at ...\TypeScript\lib\tsserver.js:145957:88
    at IOSession.Session.executeWithRequestId (...\TypeScript\lib\tsserver.js:145948:28)
    at IOSession.Session.executeCommand (...\TypeScript\lib\tsserver.js:145957:33)
    at IOSession.Session.onMessage (...\TypeScript\lib\tsserver.js:145981:35)
    at Interface.<anonymous> (...\TypeScript\lib\tsserver.js:147296:27)
    at Interface.emit (events.js:200:13)
    at Interface._onLine (readline.js:314:10)
    at Interface._normalWrite (readline.js:459:12)
    at Socket.ondata (readline.js:170:10)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)```

Activity

  1. added
    Bug
    Effort: Moderate
    Domain: JavaScript
    Crash
    on Mar 3, 2020
  2. minestarks commented on Mar 4, 2020

    @minestarks
    Contributor

    this was first seen in 3.9.0-dev.20200228

  3. DanielRosenwasser commented on Mar 4, 2020

    @DanielRosenwasser
    MemberAuthor

    I'm pretty bad at narrowing these down but maybe it's related to #37027 ?

  4. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugCrashDomain: JavaScriptEffort: Moderate

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions