File: optionalArgsWithDefaultValues.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (27 lines) | stat: -rw-r--r-- 1,506 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
tests/cases/compiler/optionalArgsWithDefaultValues.ts(1,25): error TS1015: Parameter cannot have question mark and initializer.
tests/cases/compiler/optionalArgsWithDefaultValues.ts(4,27): error TS1015: Parameter cannot have question mark and initializer.
tests/cases/compiler/optionalArgsWithDefaultValues.ts(5,28): error TS1015: Parameter cannot have question mark and initializer.
tests/cases/compiler/optionalArgsWithDefaultValues.ts(8,10): error TS1015: Parameter cannot have question mark and initializer.
tests/cases/compiler/optionalArgsWithDefaultValues.ts(9,13): error TS1015: Parameter cannot have question mark and initializer.


==== tests/cases/compiler/optionalArgsWithDefaultValues.ts (5 errors) ====
    function foo(x: number, y?:boolean=false, z?=0) {}
                            ~
!!! error TS1015: Parameter cannot have question mark and initializer.
    
    class CCC {
        public foo(x: number, y?:boolean=false, z?=0) {}
                              ~
!!! error TS1015: Parameter cannot have question mark and initializer.
        static foo2(x: number, y?:boolean=false, z?=0) {}
                               ~
!!! error TS1015: Parameter cannot have question mark and initializer.
    }
    
    var a = (x?=0) => { return 1; };
             ~
!!! error TS1015: Parameter cannot have question mark and initializer.
    var b = (x, y?:number = 2) => { x; };
                ~
!!! error TS1015: Parameter cannot have question mark and initializer.