- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.1k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts files
Milestone
Description
TypeScript Version: 4.1.2
Search Terms:
An explicit type annotation may unblock declaration emit
private name
Code
https://codesandbox.io/s/tsc-ts-docs-visibility-repro-f73gw?file=/src/index.js
// @filename: base.js
class Base {
    constructor() {}
}
const BaseFactory = () => {
    return new Base();
};
BaseFactory.Base = Base;
module.exports = BaseFactory;
// @filename: index.js
/** @typedef {import('./base')} BaseFactory */
/**
 *
 * @param {InstanceType<BaseFactory["Base"]>} base
 */
const test = (base) => {
    return base;
};Expected behavior:
No error from the compiler
Actual behavior:
src/index.js:7:1 - error TS9006: Declaration emit for this file requires using private name 'Base' from module '"/sandbox/src/base"'. An explicit type annotation may unblock declaration emit.
7 const test = (base) => {
  ~~~~~
Found 1 error.
Playground Link: 
https://codesandbox.io/s/tsc-ts-docs-visibility-repro-f73gw?file=/src/index.js
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts files