Skip to content

Commit a11e0a7

Browse files
committed
Update test with trickier case from #15616
1 parent b2cfaf8 commit a11e0a7

File tree

3 files changed

+50
-32
lines changed

3 files changed

+50
-32
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
tests/cases/compiler/weird.js(1,1): error TS2304: Cannot find name 'someFunction'.
2+
tests/cases/compiler/weird.js(1,23): error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
3+
tests/cases/compiler/weird.js(4,17): error TS8009: 'const' can only be used in a .ts file.
4+
tests/cases/compiler/weird.js(4,17): error TS1248: A class member cannot have the 'const' keyword.
5+
tests/cases/compiler/weird.js(5,3): error TS2377: Constructors for derived classes must contain a 'super' call.
6+
tests/cases/compiler/weird.js(6,4): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
7+
tests/cases/compiler/weird.js(8,25): error TS7006: Parameter 'error' implicitly has an 'any' type.
8+
tests/cases/compiler/weird.js(9,54): error TS2663: Cannot find name 'DEFAULT_MESSAGE'. Did you mean the instance member 'this.DEFAULT_MESSAGE'?
9+
10+
11+
==== tests/cases/compiler/weird.js (8 errors) ====
12+
someFunction(function(BaseClass) {
13+
~~~~~~~~~~~~
14+
!!! error TS2304: Cannot find name 'someFunction'.
15+
~~~~~~~~~
16+
!!! error TS7006: Parameter 'BaseClass' implicitly has an 'any' type.
17+
'use strict';
18+
class Hello extends BaseClass {
19+
const DEFAULT_MESSAGE = "nop!";
20+
~~~~~
21+
!!! error TS8009: 'const' can only be used in a .ts file.
22+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23+
!!! error TS1248: A class member cannot have the 'const' keyword.
24+
constructor() {
25+
~~~~~~~~~~~~~~~
26+
this.foo = "bar";
27+
~~~~~~~~~~~~~~~~~~~~
28+
~~~~
29+
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
30+
}
31+
~~~
32+
!!! error TS2377: Constructors for derived classes must contain a 'super' call.
33+
_render(error) {
34+
~~~~~
35+
!!! error TS7006: Parameter 'error' implicitly has an 'any' type.
36+
const message = error.message || DEFAULT_MESSAGE;
37+
~~~~~~~~~~~~~~~
38+
!!! error TS2663: Cannot find name 'DEFAULT_MESSAGE'. Did you mean the instance member 'this.DEFAULT_MESSAGE'?
39+
}
40+
}
41+
});
42+

tests/baselines/reference/checkIndexConstraintOfJavascriptClassExpression.js

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
// @Filename: weird.js
22
// @allowJs: true
3+
// @checkJs: true
4+
// @strict: true
5+
// @noEmit: true
36
// @out: foo.js
47
someFunction(function(BaseClass) {
8+
'use strict';
59
class Hello extends BaseClass {
10+
const DEFAULT_MESSAGE = "nop!";
611
constructor() {
712
this.foo = "bar";
813
}
14+
_render(error) {
15+
const message = error.message || DEFAULT_MESSAGE;
16+
}
917
}
1018
});

0 commit comments

Comments
 (0)