forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
74 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/baselines/reference/arityAndOrderCompatibility01.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
tests/baselines/reference/typeInferenceWithTupleType.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts(16,9): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures. | ||
|
||
|
||
==== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts (1 errors) ==== | ||
function combine<T, U>(x: T, y: U): [T, U] { | ||
return [x, y]; | ||
} | ||
|
||
var combineResult = combine("string", 10); | ||
var combineEle1 = combineResult[0]; // string | ||
var combineEle2 = combineResult[1]; // number | ||
|
||
function zip<T, U>(array1: T[], array2: U[]): [[T, U]] { | ||
if (array1.length != array2.length) { | ||
return [[undefined, undefined]]; | ||
} | ||
var length = array1.length; | ||
var zipResult: [[T, U]]; | ||
for (var i = 0; i < length; ++i) { | ||
zipResult.push([array1[i], array2[i]]); | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'never' has no compatible call signatures. | ||
} | ||
return zipResult; | ||
} | ||
|
||
var zipResult = zip(["foo", "bar"], [5, 6]); | ||
var zipResultEle = zipResult[0]; // [string, number] | ||
var zipResultEleEle = zipResult[0][0]; // string | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/cases/conformance/types/tuple/arityAndOrderCompatibility01.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters