declare class C {
}
function C() {
}
Intentional and tested.
(This is analogous to how a concrete class can merge with an interface that adds more behavior that isn't implemented)
Feel free to add to the release notes if you'd like~
Yes, this means you can actually declare callable constructors in proper _TS_ implementation code now.
export declare class Point2D {
x: number;
y: number;
constructor(x: number, y: number);
}
export function Point2D(this: Point2D | undefined, x: number, y: number) {
if (!(this instanceof Point2D)) {
return new Point2D(x, y);
}
this.x = x;
this.y = y;
}
That's why it closed out ole issue #183.
Seems reasonable.
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
https://github.com/microsoft/TypeScript/issues/32897#issuecomment-521511765
@wemeetagain your example code is no longer working in the TypeScript 3.9, is it a regression?
Cannot redeclare exported variable 'Point2D'.(2323)
https://www.typescriptlang.org/play/index.html?ssl=1&ssc=1&pln=5&pc=1#code/KYDwDg9gTgLgBAE2AYwDYEMrDm9BnPOABQgEsA7GAJgBE4BvAWACg424QAuOcgVwFsARsCgBuFuzgBPbnyEjxrdsgjk8MKL2QxoACi48BwqABppsoyICUigL4tQkWHABmvcttKriZSrV0wABakeNwkFNR0AD5w7kguFMAIZgZyxmYyhvJQVgwS7KQucLoAhAHBhBTq6B7AEEXhfjRWuUxKkmxYMLxQ5DzAAO4+Ef4gGTb5bPbtcEEhAHQgcAC8HIqSc3jzUivSdixAA