[JS] Add ; after functions in .d.ts

Fixes nit from KT-37752
This commit is contained in:
Svyatoslav Kuzmich
2020-05-21 18:34:02 +03:00
parent 2ca751a9fc
commit f8fdb0dc7e
8 changed files with 66 additions and 66 deletions
@@ -42,10 +42,10 @@ fun ExportedDeclaration.toTypeScript(indent: String): String = indent + when (th
val renderedReturnType = returnType.toTypeScript() val renderedReturnType = returnType.toTypeScript()
"$keyword$name$renderedTypeParameters($renderedParameters): $renderedReturnType" "$keyword$name$renderedTypeParameters($renderedParameters): $renderedReturnType;"
} }
is ExportedConstructor -> is ExportedConstructor ->
"constructor(${parameters.joinToString(", ") { it.toTypeScript() }})" "constructor(${parameters.joinToString(", ") { it.toTypeScript() }});"
is ExportedProperty -> { is ExportedProperty -> {
val keyword = when { val keyword = when {
@@ -1,33 +1,33 @@
declare namespace JS_TESTS { declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined type Nullable<T> = T | null | undefined
class ClassWithDefaultCtor { class ClassWithDefaultCtor {
constructor() constructor();
readonly x: string; readonly x: string;
} }
class ClassWithPrimaryCtor { class ClassWithPrimaryCtor {
constructor(x: string) constructor(x: string);
readonly x: string; readonly x: string;
} }
class ClassWithSecondaryCtor { class ClassWithSecondaryCtor {
private constructor(); private constructor();
readonly x: string; readonly x: string;
static create(y: string): ClassWithSecondaryCtor static create(y: string): ClassWithSecondaryCtor;
} }
class ClassWithMultipleSecondaryCtors { class ClassWithMultipleSecondaryCtors {
private constructor(); private constructor();
readonly x: string; readonly x: string;
static createFromString(y: string): ClassWithMultipleSecondaryCtors static createFromString(y: string): ClassWithMultipleSecondaryCtors;
static createFromInts(y: number, z: number): ClassWithMultipleSecondaryCtors static createFromInts(y: number, z: number): ClassWithMultipleSecondaryCtors;
} }
class OpenClassWithMixedConstructors { class OpenClassWithMixedConstructors {
constructor(x: string) constructor(x: string);
readonly x: string; readonly x: string;
static createFromStrings(y: string, z: string): OpenClassWithMixedConstructors static createFromStrings(y: string, z: string): OpenClassWithMixedConstructors;
static createFromInts(y: number, z: number): OpenClassWithMixedConstructors static createFromInts(y: number, z: number): OpenClassWithMixedConstructors;
} }
class DerivedClassWithSecondaryCtor extends OpenClassWithMixedConstructors { class DerivedClassWithSecondaryCtor extends OpenClassWithMixedConstructors {
private constructor(); private constructor();
static delegateToPrimary(y: string): DerivedClassWithSecondaryCtor static delegateToPrimary(y: string): DerivedClassWithSecondaryCtor;
static delegateToCreateFromInts(y: number, z: number): DerivedClassWithSecondaryCtor static delegateToCreateFromInts(y: number, z: number): DerivedClassWithSecondaryCtor;
} }
} }
@@ -1,17 +1,17 @@
declare namespace JS_TESTS { declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined type Nullable<T> = T | null | undefined
namespace foo { namespace foo {
function sum(x: number, y: number): number function sum(x: number, y: number): number;
function varargInt(x: Int32Array): number function varargInt(x: Int32Array): number;
function varargNullableInt(x: Array<Nullable<number>>): number function varargNullableInt(x: Array<Nullable<number>>): number;
function varargWithOtherParameters(x: string, y: Array<string>, z: string): number function varargWithOtherParameters(x: string, y: Array<string>, z: string): number;
function varargWithComplexType(x: Array<(p0: Array<Int32Array>) => Array<Int32Array>>): number function varargWithComplexType(x: Array<(p0: Array<Int32Array>) => Array<Int32Array>>): number;
function sumNullable(x: Nullable<number>, y: Nullable<number>): number function sumNullable(x: Nullable<number>, y: Nullable<number>): number;
function defaultParameters(x: number, y: string): string function defaultParameters(x: number, y: string): string;
function generic1<T>(x: T): T function generic1<T>(x: T): T;
function generic2<T>(x: Nullable<T>): boolean function generic2<T>(x: Nullable<T>): boolean;
function generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E> function generic3<A, B, C, D, E>(a: A, b: B, c: C, d: D): Nullable<E>;
function inlineFun(x: number, callback: (p0: number) => void): void function inlineFun(x: number, callback: (p0: number) => void): void;
const _const_val: number; const _const_val: number;
const _val: number; const _val: number;
let _var: number; let _var: number;
@@ -20,23 +20,23 @@ declare namespace JS_TESTS {
let _varCustom: number; let _varCustom: number;
let _varCustomWithField: number; let _varCustomWithField: number;
class A { class A {
constructor() constructor();
} }
class A1 { class A1 {
constructor(x: number) constructor(x: number);
readonly x: number; readonly x: number;
} }
class A2 { class A2 {
constructor(x: string, y: boolean) constructor(x: string, y: boolean);
readonly x: string; readonly x: string;
y: boolean; y: boolean;
} }
class A3 { class A3 {
constructor() constructor();
readonly x: number; readonly x: number;
} }
class A4 { class A4 {
constructor() constructor();
readonly _valCustom: number; readonly _valCustom: number;
readonly _valCustomWithField: number; readonly _valCustomWithField: number;
_varCustom: number; _varCustom: number;
@@ -4,31 +4,31 @@ declare namespace JS_TESTS {
interface I<T, S, U> { interface I<T, S, U> {
x: T; x: T;
readonly y: S; readonly y: S;
z(u: U): void z(u: U): void;
} }
interface I2 { interface I2 {
x: string; x: string;
readonly y: boolean; readonly y: boolean;
z(z: number): void z(z: number): void;
} }
} }
namespace foo { namespace foo {
abstract class AC implements foo.I2 { abstract class AC implements foo.I2 {
constructor() constructor();
x: string; x: string;
abstract readonly y: boolean; abstract readonly y: boolean;
abstract z(z: number): void abstract z(z: number): void;
readonly acProp: string; readonly acProp: string;
abstract readonly acAbstractProp: string; abstract readonly acAbstractProp: string;
} }
class OC extends foo.AC implements foo.I<string, boolean, number> { class OC extends foo.AC implements foo.I<string, boolean, number> {
constructor(y: boolean, acAbstractProp: string) constructor(y: boolean, acAbstractProp: string);
readonly y: boolean; readonly y: boolean;
readonly acAbstractProp: string; readonly acAbstractProp: string;
z(z: number): void z(z: number): void;
} }
class FC extends foo.OC { class FC extends foo.OC {
constructor() constructor();
} }
} }
} }
@@ -2,36 +2,36 @@ declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined type Nullable<T> = T | null | undefined
namespace foo.bar.baz { namespace foo.bar.baz {
class C1 { class C1 {
constructor(value: string) constructor(value: string);
readonly value: string; readonly value: string;
component1(): string component1(): string;
copy(value: string): foo.bar.baz.C1 copy(value: string): foo.bar.baz.C1;
toString(): string toString(): string;
hashCode(): number hashCode(): number;
equals(other: Nullable<any>): boolean equals(other: Nullable<any>): boolean;
} }
function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string;
} }
namespace a.b { namespace a.b {
class C2 { class C2 {
constructor(value: string) constructor(value: string);
readonly value: string; readonly value: string;
component1(): string component1(): string;
copy(value: string): a.b.C2 copy(value: string): a.b.C2;
toString(): string toString(): string;
hashCode(): number hashCode(): number;
equals(other: Nullable<any>): boolean equals(other: Nullable<any>): boolean;
} }
function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string;
} }
class C3 { class C3 {
constructor(value: string) constructor(value: string);
readonly value: string; readonly value: string;
component1(): string component1(): string;
copy(value: string): C3 copy(value: string): C3;
toString(): string toString(): string;
hashCode(): number hashCode(): number;
equals(other: Nullable<any>): boolean equals(other: Nullable<any>): boolean;
} }
function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string function f(x1: foo.bar.baz.C1, x2: a.b.C2, x3: C3): string;
} }
@@ -2,7 +2,7 @@ declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined type Nullable<T> = T | null | undefined
namespace foo { namespace foo {
const _any: any; const _any: any;
function _nothing(): never function _nothing(): never;
const _throwable: Error; const _throwable: Error;
const _string: string; const _string: string;
const _boolean: boolean; const _boolean: boolean;
@@ -10,17 +10,17 @@ declare namespace JS_TESTS {
} }
namespace foo { namespace foo {
const exportedVal: number; const exportedVal: number;
function exportedFun(): number function exportedFun(): number;
class ExportedClass { class ExportedClass {
constructor() constructor();
readonly value: number; readonly value: number;
} }
} }
namespace foo { namespace foo {
const fileLevelExportedVal: number; const fileLevelExportedVal: number;
function fileLevelExportedFun(): number function fileLevelExportedFun(): number;
class FileLevelExportedClass { class FileLevelExportedClass {
constructor() constructor();
readonly value: number; readonly value: number;
} }
} }
@@ -3,18 +3,18 @@ declare namespace JS_TESTS {
interface publicInterface { interface publicInterface {
} }
const publicVal: number; const publicVal: number;
function publicFun(): number function publicFun(): number;
class publicClass { class publicClass {
constructor() constructor();
} }
class Class { class Class {
constructor() constructor();
readonly publicVal: number; readonly publicVal: number;
publicFun(): number publicFun(): number;
} }
namespace Class { namespace Class {
class publicClass { class publicClass {
constructor() constructor();
} }
} }
} }