microsoft / microsoft/TypeScript
JS typedef merged with default export class behaves strangely
@sandersn arbeitet bereits daran.
Seit 28.8.2026.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
class Cls {
x = 12;
static y = "ok"
}
export default Cls;
/**
* @typedef {string | number} default
*/
with checkJs and allowJs on reports no errors, however on usage:
import Def from "./file.js"
type Q = Def;
console.log(Def);
the quick info is pretty comprehensive:

however the type usage is equal to string | number (okay, maybe that's reasonable, how are a typedef and a class even merging anyway), however there's an error on the value usage:
'Def' only refers to a type, but is being used as a value here
Expected behavior:
An error on the attempted merge (a class and a type alias should be overlapping in symbol flags domains) and for the value usage to resolve to the class, probably.
Actual behavior:
The incongruent behavior described above.
cc @sandersn
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.