Skip to content

Instantly share code, notes, and snippets.

@ahocevar
Last active November 26, 2019 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahocevar/b3e58e7eac7750faa235ef66bdb559ab to your computer and use it in GitHub Desktop.
Save ahocevar/b3e58e7eac7750faa235ef66bdb559ab to your computer and use it in GitHub Desktop.

Minimal example to reproduce microsoft/TypeScript#34869

git clone https://gist.github.com/b3e58e7eac7750faa235ef66bdb559ab.git
cd b3e58e7eac7750faa235ef66bdb559ab
npm install
npm run build

The last command runs tsc and will output

TypeError: Cannot read property 'valueDeclaration' of undefined

and a stack trace. No output will be generated.

export default class Foo {
constructor() {
console.log(this.getType());
}
/**
* @abstract
* @returns {import("./type").default}
*/
getType() {}
}
import PointFoo from './pointfoo';
new PointFoo();
{
"name": "valuedeclaration-of-undefined",
"version": "1.0.0",
"description": "Reproduces https://github.com/microsoft/TypeScript/issues/34869",
"main": "index.js",
"scripts": {
"build": "tsc",
"start": "node -r esm index.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"esm": "^3.2.25",
"typescript": "^3.8.0-dev.20191126"
}
}
import Foo from './foo';
import Type from './type';
export default class PointFoo extends Foo {
/**
* @inheritDoc
*/
getType() {
return Type.POINT;
}
}
{
"compilerOptions": {
"outDir": "./build",
"emitDeclarationOnly": true,
"declaration": true,
"allowJs": true,
"checkJs": true
},
"include": [
"./*.js"
]
}
/**
* @enum {string}
*/
export default {
'POINT': 'point',
'LINE': 'line'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment