-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.7.0-dev.20191014
Search Terms:
Cannot read property 'parent' of undefined
Code
// src/Dependency.js
/**
* Some dependency.
*
* @param {object} opts
* @constructor
*/
function Dependency(opts) {
// we're tagged as a constructor but obviously not used that way.
return Object.assign({}, opts);
}
module.exports = Dependency;
// src/index.ts
const Dependency = require('./Dependency');
const deps = Dependency({});
GitHub repo:
https://github.com/brasten/ts-jsdoc-constructor-error
Expected behavior:
Successful compilation (as under previous versions)
OR
a compilation error/warning pointing to the issue (@constructor
does not match up with usage in this case). It took a while to track down which files in my project were causing the issue, and then more time to figure out what the specific issue was.
Actual behavior:
> tsc -b
/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:78446
throw e;
^
TypeError: Cannot read property 'parent' of undefined
at getOuterTypeParameters (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:32718:29)
at getOuterTypeParametersOfClassOrInterface (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:32769:20)
at getDeclaredTypeOfClassOrInterface (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:33003:43)
at createAnonymousTypeNode (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:29876:59)
at typeToTypeNodeHelper (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:29825:28)
at /Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:29617:106
at withContext (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:29661:37)
at Object.typeToTypeNode (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:29617:28)
at typeToString (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:29584:40)
at resolveCallExpression (/Users/brasten/Projects/Scratch/BugReports/ts-top-level-jsdoc/node_modules/typescript/lib/tsc.js:46142:105)
Playground Link: None, not sure how to set up issue in Playground. See Github link above.
Knagis
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue