File: duplicateLocalVariable2.errors.txt

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (47 lines) | stat: -rw-r--r-- 2,112 bytes parent folder | download
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type.  Variable 'i' must be of type 'string', but here has type 'number'.
tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.


==== tests/cases/compiler/duplicateLocalVariable2.ts (3 errors) ====
    export class TestCase {
        constructor (public name: string, public test: ()=>boolean, public errorMessageRegEx?: string) {
        }
    }
    export class TestRunner { 
        static arrayCompare(arg1: any[], arg2: any[]): boolean {
            return false;
        }
    
        public addTest(test: TestCase) {
        }
    }
    
    export var tests: TestRunner = (function () {
        var testRunner = new TestRunner();
    
        testRunner.addTest(new TestCase("Check UTF8 encoding",
            function () {
                var fb: any;
                fb.writeUtf8Bom();
                var chars = [0x0054];
                for (var i in chars) {
                    fb.writeUtf8CodePoint(chars[i]);
                }
                fb.index = 0;
                var bytes = [];
                for (var i = 0; i < 14; i++) {
                         ~
!!! error TS2403: Subsequent variable declarations must have the same type.  Variable 'i' must be of type 'string', but here has type 'number'.
                                ~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
                                        ~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
                    bytes.push(fb.readByte());
                }
                var expected = [0xEF];
                return TestRunner.arrayCompare(bytes, expected);
            }));
    
        return testRunner;
    })();