TypeScript/tests/baselines/reference/checkJsdocTypedefOnlySourceFile.errors.txt
Martin Probst a03227d60e Avoid a crash with @typedef in a script file. (#33847)
* Avoid a crash with `@typedef` in a script file.

Scripts (as opposed to modules) do not have a symbol object. If a script
contains a `@typdef` defined on a namespace called `exports`, TypeScript
crashes because it attempts to create an exported symbol on the
(non-existent) symbol of the SourceFile.

This change avoids the crash by explicitly checking if the source file
has a symbol object, i.e. whether it is a module.

* Add usage of exports.SomeName typedef.

* Fix bug at bind site rather than in declare func
2019-10-24 14:04:42 -07:00

18 lines
477 B
Plaintext

tests/cases/conformance/jsdoc/0.js(10,20): error TS2694: Namespace 'exports' has no exported member 'SomeName'.
==== tests/cases/conformance/jsdoc/0.js (1 errors) ====
// @ts-check
var exports = {};
/**
* @typedef {string}
*/
exports.SomeName;
/** @type {exports.SomeName} */
~~~~~~~~
!!! error TS2694: Namespace 'exports' has no exported member 'SomeName'.
const myString = 'str';