Skip to content

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

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 Mar 3, 2020 · 2 comments · Fixed by #37253
Closed
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: JavaScript The issue relates to JavaScript specifically Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this

Comments

@DanielRosenwasser
Copy link
Member

// @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)```

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Help Wanted You can do this Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Domain: JavaScript The issue relates to JavaScript specifically Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output labels Mar 3, 2020
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.9.0 milestone Mar 3, 2020
@minestarks
Copy link
Member

this was first seen in 3.9.0-dev.20200228

@DanielRosenwasser
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: JavaScript The issue relates to JavaScript specifically Effort: Moderate Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual". Help Wanted You can do this
Projects
None yet
3 participants