mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Add additional test
This commit is contained in:
parent
12906a74de
commit
2f5af2e04b
@ -6,9 +6,11 @@ tests/cases/compiler/controlFlowArrayErrors.ts(30,12): error TS2345: Argument of
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(35,12): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string | number'.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(49,5): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '((...items: (string | number)[]) => number) | ((...items: boolean[]) => number)' has no compatible call signatures.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(57,12): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(61,11): error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
tests/cases/compiler/controlFlowArrayErrors.ts(64,9): error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
|
||||
|
||||
==== tests/cases/compiler/controlFlowArrayErrors.ts (8 errors) ====
|
||||
==== tests/cases/compiler/controlFlowArrayErrors.ts (10 errors) ====
|
||||
|
||||
declare function cond(): boolean;
|
||||
|
||||
@ -82,4 +84,16 @@ tests/cases/compiler/controlFlowArrayErrors.ts(57,12): error TS2345: Argument of
|
||||
y.push("hello"); // Error
|
||||
~~~~~~~
|
||||
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
|
||||
}
|
||||
|
||||
function f8() {
|
||||
const x = []; // Implicit any[] error in some locations
|
||||
~
|
||||
!!! error TS7034: Variable 'x' implicitly has type 'any[]' in some locations where its type cannot be determined.
|
||||
x.push(5);
|
||||
function g() {
|
||||
x; // Implicit any[] error
|
||||
~
|
||||
!!! error TS7005: Variable 'x' implicitly has an 'any[]' type.
|
||||
}
|
||||
}
|
||||
@ -56,6 +56,14 @@ function f7() {
|
||||
let y = x; // y has non-evolving array value
|
||||
x.push("hello"); // Ok
|
||||
y.push("hello"); // Error
|
||||
}
|
||||
|
||||
function f8() {
|
||||
const x = []; // Implicit any[] error in some locations
|
||||
x.push(5);
|
||||
function g() {
|
||||
x; // Implicit any[] error
|
||||
}
|
||||
}
|
||||
|
||||
//// [controlFlowArrayErrors.js]
|
||||
@ -108,3 +116,10 @@ function f7() {
|
||||
x.push("hello"); // Ok
|
||||
y.push("hello"); // Error
|
||||
}
|
||||
function f8() {
|
||||
var x = []; // Implicit any[] error in some locations
|
||||
x.push(5);
|
||||
function g() {
|
||||
x; // Implicit any[] error
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,4 +56,12 @@ function f7() {
|
||||
let y = x; // y has non-evolving array value
|
||||
x.push("hello"); // Ok
|
||||
y.push("hello"); // Error
|
||||
}
|
||||
|
||||
function f8() {
|
||||
const x = []; // Implicit any[] error in some locations
|
||||
x.push(5);
|
||||
function g() {
|
||||
x; // Implicit any[] error
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user