File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { expectError } from './util' ;
2
+
3
+ // ----------------------------------------------------------------------
4
+
5
+ test . each ( [
6
+ [ 'class' , 'constructor' ] ,
7
+ [ 'class' , 'method' ] ,
8
+ [ 'interface' , 'method' ] ,
9
+ ] ) (
10
+ 'not okay to rename a positional parameter' ,
11
+ ( scope , decl ) =>
12
+ expectError (
13
+ / p o s i t i o n a l p a r a m e t e r w a s r e n a m e d f r o m ' p r e v i o u s ' t o ' c u r r e n t ' / ,
14
+ // Note: name is ITest so we're good for both class & interface... Yes, this is ugly.
15
+ `
16
+ export ${ scope } ITest {
17
+ ${ decl } (previous: any)${ decl === 'constructor' ? '' : ': void' } ${ scope === 'class' ? ' { previous.use(); }' : ';' }
18
+ }` ,
19
+ `
20
+ export ${ scope } ITest {
21
+ ${ decl } (current: any)${ decl === 'constructor' ? '' : ': void' } ${ scope === 'class' ? ' { current.use(); }' : ';' }
22
+ }` ,
23
+ ) ,
24
+ ) ;
You can’t perform that action at this time.
0 commit comments