[JS] Prevent default class constructors in d.ts files.

Generate private TypeScript constructor for classes without public
primary Kotlin constructor.
This commit is contained in:
Svyatoslav Kuzmich
2020-05-21 17:50:41 +03:00
parent 695d383ed1
commit 2ca751a9fc
2 changed files with 13 additions and 1 deletions
@@ -9,10 +9,12 @@ declare namespace JS_TESTS {
readonly x: string;
}
class ClassWithSecondaryCtor {
private constructor();
readonly x: string;
static create(y: string): ClassWithSecondaryCtor
}
class ClassWithMultipleSecondaryCtors {
private constructor();
readonly x: string;
static createFromString(y: string): ClassWithMultipleSecondaryCtors
static createFromInts(y: number, z: number): ClassWithMultipleSecondaryCtors
@@ -24,6 +26,7 @@ declare namespace JS_TESTS {
static createFromInts(y: number, z: number): OpenClassWithMixedConstructors
}
class DerivedClassWithSecondaryCtor extends OpenClassWithMixedConstructors {
private constructor();
static delegateToPrimary(y: string): DerivedClassWithSecondaryCtor
static delegateToCreateFromInts(y: number, z: number): DerivedClassWithSecondaryCtor
}