[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()
"$keyword$name$renderedTypeParameters($renderedParameters): $renderedReturnType"
"$keyword$name$renderedTypeParameters($renderedParameters): $renderedReturnType;"
}
is ExportedConstructor ->
"constructor(${parameters.joinToString(", ") { it.toTypeScript() }})"
"constructor(${parameters.joinToString(", ") { it.toTypeScript() }});"
is ExportedProperty -> {
val keyword = when {
@@ -1,33 +1,33 @@
declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
class ClassWithDefaultCtor {
constructor()
constructor();
readonly x: string;
}
class ClassWithPrimaryCtor {
constructor(x: string)
constructor(x: string);
readonly x: string;
}
class ClassWithSecondaryCtor {
private constructor();
readonly x: string;
static create(y: string): ClassWithSecondaryCtor
static create(y: string): ClassWithSecondaryCtor;
}
class ClassWithMultipleSecondaryCtors {
private constructor();
readonly x: string;
static createFromString(y: string): ClassWithMultipleSecondaryCtors
static createFromInts(y: number, z: number): ClassWithMultipleSecondaryCtors
static createFromString(y: string): ClassWithMultipleSecondaryCtors;
static createFromInts(y: number, z: number): ClassWithMultipleSecondaryCtors;
}
class OpenClassWithMixedConstructors {
constructor(x: string)
constructor(x: string);
readonly x: string;
static createFromStrings(y: string, z: string): OpenClassWithMixedConstructors
static createFromInts(y: number, z: number): OpenClassWithMixedConstructors
static createFromStrings(y: string, z: string): OpenClassWithMixedConstructors;
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
static delegateToPrimary(y: string): DerivedClassWithSecondaryCtor;
static delegateToCreateFromInts(y: number, z: number): DerivedClassWithSecondaryCtor;
}
}
@@ -1,17 +1,17 @@
declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
namespace foo {
function sum(x: number, y: number): number
function varargInt(x: Int32Array): number
function varargNullableInt(x: Array<Nullable<number>>): number
function varargWithOtherParameters(x: string, y: Array<string>, z: string): number
function varargWithComplexType(x: Array<(p0: Array<Int32Array>) => Array<Int32Array>>): number
function sumNullable(x: Nullable<number>, y: Nullable<number>): number
function defaultParameters(x: number, y: string): string
function generic1<T>(x: T): T
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 inlineFun(x: number, callback: (p0: number) => void): void
function sum(x: number, y: number): number;
function varargInt(x: Int32Array): number;
function varargNullableInt(x: Array<Nullable<number>>): number;
function varargWithOtherParameters(x: string, y: Array<string>, z: string): number;
function varargWithComplexType(x: Array<(p0: Array<Int32Array>) => Array<Int32Array>>): number;
function sumNullable(x: Nullable<number>, y: Nullable<number>): number;
function defaultParameters(x: number, y: string): string;
function generic1<T>(x: T): T;
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 inlineFun(x: number, callback: (p0: number) => void): void;
const _const_val: number;
const _val: number;
let _var: number;
@@ -20,23 +20,23 @@ declare namespace JS_TESTS {
let _varCustom: number;
let _varCustomWithField: number;
class A {
constructor()
constructor();
}
class A1 {
constructor(x: number)
constructor(x: number);
readonly x: number;
}
class A2 {
constructor(x: string, y: boolean)
constructor(x: string, y: boolean);
readonly x: string;
y: boolean;
}
class A3 {
constructor()
constructor();
readonly x: number;
}
class A4 {
constructor()
constructor();
readonly _valCustom: number;
readonly _valCustomWithField: number;
_varCustom: number;
@@ -4,31 +4,31 @@ declare namespace JS_TESTS {
interface I<T, S, U> {
x: T;
readonly y: S;
z(u: U): void
z(u: U): void;
}
interface I2 {
x: string;
readonly y: boolean;
z(z: number): void
z(z: number): void;
}
}
namespace foo {
abstract class AC implements foo.I2 {
constructor()
constructor();
x: string;
abstract readonly y: boolean;
abstract z(z: number): void
abstract z(z: number): void;
readonly acProp: string;
abstract readonly acAbstractProp: string;
}
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 acAbstractProp: string;
z(z: number): void
z(z: number): void;
}
class FC extends foo.OC {
constructor()
constructor();
}
}
}
@@ -2,36 +2,36 @@ declare namespace JS_TESTS {
type Nullable<T> = T | null | undefined
namespace foo.bar.baz {
class C1 {
constructor(value: string)
constructor(value: string);
readonly value: string;
component1(): string
copy(value: string): foo.bar.baz.C1
toString(): string
hashCode(): number
equals(other: Nullable<any>): boolean
component1(): string;
copy(value: string): foo.bar.baz.C1;
toString(): string;
hashCode(): number;
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 {
class C2 {
constructor(value: string)
constructor(value: string);
readonly value: string;
component1(): string
copy(value: string): a.b.C2
toString(): string
hashCode(): number
equals(other: Nullable<any>): boolean
component1(): string;
copy(value: string): a.b.C2;
toString(): string;
hashCode(): number;
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 {
constructor(value: string)
constructor(value: string);
readonly value: string;
component1(): string
copy(value: string): C3
toString(): string
hashCode(): number
equals(other: Nullable<any>): boolean
component1(): string;
copy(value: string): C3;
toString(): string;
hashCode(): number;
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
namespace foo {
const _any: any;
function _nothing(): never
function _nothing(): never;
const _throwable: Error;
const _string: string;
const _boolean: boolean;
@@ -10,17 +10,17 @@ declare namespace JS_TESTS {
}
namespace foo {
const exportedVal: number;
function exportedFun(): number
function exportedFun(): number;
class ExportedClass {
constructor()
constructor();
readonly value: number;
}
}
namespace foo {
const fileLevelExportedVal: number;
function fileLevelExportedFun(): number
function fileLevelExportedFun(): number;
class FileLevelExportedClass {
constructor()
constructor();
readonly value: number;
}
}
@@ -3,18 +3,18 @@ declare namespace JS_TESTS {
interface publicInterface {
}
const publicVal: number;
function publicFun(): number
function publicFun(): number;
class publicClass {
constructor()
constructor();
}
class Class {
constructor()
constructor();
readonly publicVal: number;
publicFun(): number
publicFun(): number;
}
namespace Class {
class publicClass {
constructor()
constructor();
}
}
}