mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
48 lines
2.1 KiB
Plaintext
48 lines
2.1 KiB
Plaintext
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'.
|
|
duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'.
|
|
duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
|
|
|
|
|
|
==== 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'.
|
|
!!! related TS6203 duplicateLocalVariable2.ts:22:22: 'i' was also declared here.
|
|
~~~~~~
|
|
!!! 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;
|
|
})(); |