Skip to content

TypeError: Cannot read property 'kind' of undefined in 'Object.isIdentifier' during 'getApplicableRefactors' #21786

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
aozgaa opened this issue Feb 9, 2018 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Source: Telemetry The issue relates to the telemetry in editors

Comments

@aozgaa
Copy link
Contributor

aozgaa commented Feb 9, 2018

This issue comes from crash dumps in telemetry. We've tried to de-duplicate issues on a best-effort basis, comparing the sequence of methods called and the command requested while ignoring line numbers.
TypeScript Version Prefix: 2.7.1
VSCode Version 1.19.3
command requested: getApplicableRefactors
hitting sessions: 5469
proportion of all sessions: 0.0204163913496321
five line hash: 3ba58056c0d0fc407907dd09aad9434c
stack

TypeError: Cannot read property 'kind' of undefined
    at Object.isIdentifier (tsserver.js:9638:20)
    at Object.isExportsIdentifier (tsserver.js:7262:19)
    at Object.isExportsOrModuleExportsOrAlias (tsserver.js:19987:19)
    at isAtTriggerLocation (tsserver.js:80032:31)
    at isAtTriggerLocation (tsserver.js:80037:44)
    at Object.getAvailableActions (tsserver.js:80009:21)
    at unknown (tsserver.js:77123:128)
    at getIterator (tsserver.js:1733:23)
    at Object.next (tsserver.js:1728:35)
    at Object.arrayFrom (tsserver.js:2267:32)
    at Object.getApplicableRefactors (tsserver.js:77122:23)
    at Object.getApplicableRefactors (tsserver.js:83337:32)
    at IOSession.Session.getApplicableRefactors (tsserver.js:90194:53)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:89150:61)
    at unknown (tsserver.js:90393:88)
    at IOSession.Session.executeWithRequestId (tsserver.js:90384:28)
    at IOSession.Session.executeCommand (tsserver.js:90393:33)
    at IOSession.Session.onMessage (tsserver.js:90413:35)
    at Interface.<anonymous> (tsserver.js:91614:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)
@aozgaa aozgaa added the Source: Telemetry The issue relates to the telemetry in editors label Feb 9, 2018
@mhegazy mhegazy added the Bug A bug in TypeScript label Feb 9, 2018
@mhegazy mhegazy added this to the TypeScript 2.8 milestone Feb 9, 2018
@amcasey
Copy link
Member

amcasey commented Feb 9, 2018

This is in the "Convert to ES6 module" code fix.

@amcasey
Copy link
Member

amcasey commented Feb 9, 2018

VariableDeclaration.initializer is optional and isExportsOrModuleExportsOrAlias doesn't handle undefined.

@aozgaa
Copy link
Contributor Author

aozgaa commented Mar 5, 2018

This issue reproduced in the following context:
TypeScript Version Prefix: 2.7.2
VSCode Version 1.20.1
command requested: getApplicableRefactors
hitting sessions: 996
proportion of all sessions: 0.020447966494898273
stack

TypeError: Cannot read property 'kind' of undefined
    at Object.isIdentifier (tsserver.js:9640:20)
    at Object.isExportsIdentifier (tsserver.js:7264:19)
    at Object.isExportsOrModuleExportsOrAlias (tsserver.js:19989:19)
    at isAtTriggerLocation (tsserver.js:80192:31)
    at isAtTriggerLocation (tsserver.js:80197:44)
    at Object.getAvailableActions (tsserver.js:80169:21)
    at unknown (tsserver.js:77283:128)
    at getIterator (tsserver.js:1734:23)
    at Object.next (tsserver.js:1729:35)
    at Object.arrayFrom (tsserver.js:2268:32)
    at Object.getApplicableRefactors (tsserver.js:77282:23)
    at Object.getApplicableRefactors (tsserver.js:83497:32)
    at IOSession.Session.getApplicableRefactors (tsserver.js:90354:53)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:89310:61)
    at unknown (tsserver.js:90553:88)
    at IOSession.Session.executeWithRequestId (tsserver.js:90544:28)
    at IOSession.Session.executeCommand (tsserver.js:90553:33)
    at IOSession.Session.onMessage (tsserver.js:90573:35)
    at Interface.<anonymous> (tsserver.js:91774:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Source: Telemetry The issue relates to the telemetry in editors
Projects
None yet
Development

No branches or pull requests

3 participants