Skip to content

Commit

Permalink
fix(44273): preserves 'override' modifier in JavaScript output
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed May 27, 2021
1 parent 5fde871 commit dac7fdb
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compiler/transformers/ts.ts
Expand Up @@ -368,6 +368,7 @@ namespace ts {
case SyntaxKind.PrivateKeyword:
case SyntaxKind.ProtectedKeyword:
case SyntaxKind.AbstractKeyword:
case SyntaxKind.OverrideKeyword:
case SyntaxKind.ConstKeyword:
case SyntaxKind.DeclareKeyword:
case SyntaxKind.ReadonlyKeyword:
Expand Down
17 changes: 17 additions & 0 deletions tests/baselines/reference/override16.js
@@ -0,0 +1,17 @@
//// [override16.ts]
class A {
foo?: string;
}

class B extends A {
override foo = "string";
}


//// [override16.js]
class A {
foo;
}
class B extends A {
foo = "string";
}
16 changes: 16 additions & 0 deletions tests/baselines/reference/override16.symbols
@@ -0,0 +1,16 @@
=== tests/cases/conformance/override/override16.ts ===
class A {
>A : Symbol(A, Decl(override16.ts, 0, 0))

foo?: string;
>foo : Symbol(A.foo, Decl(override16.ts, 0, 9))
}

class B extends A {
>B : Symbol(B, Decl(override16.ts, 2, 1))
>A : Symbol(A, Decl(override16.ts, 0, 0))

override foo = "string";
>foo : Symbol(B.foo, Decl(override16.ts, 4, 19))
}

17 changes: 17 additions & 0 deletions tests/baselines/reference/override16.types
@@ -0,0 +1,17 @@
=== tests/cases/conformance/override/override16.ts ===
class A {
>A : A

foo?: string;
>foo : string
}

class B extends A {
>B : B
>A : A

override foo = "string";
>foo : string
>"string" : "string"
}

10 changes: 10 additions & 0 deletions tests/cases/conformance/override/override16.ts
@@ -0,0 +1,10 @@
// @target: esnext
// @noImplicitOverride: true

class A {
foo?: string;
}

class B extends A {
override foo = "string";
}

0 comments on commit dac7fdb

Please sign in to comment.