Skip to content

Commit 5252cd9

Browse files
tests
1 parent 0e9334b commit 5252cd9

File tree

4 files changed

+9
-17
lines changed

4 files changed

+9
-17
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference path="moduleNameResolver.ts"/>
22
/// <reference path="binder.ts"/>
3-
/// <reference types="node"/>
4-
declare var console: Console;
3+
// /// <reference types="node"/>
4+
// declare var console: Console;
55

66
/* @internal */
77
namespace ts {
@@ -6286,7 +6286,8 @@ namespace ts {
62866286
const signature = getSignatureFromDeclaration(signatureDeclaration);
62876287
const parameterIndex = ts.indexOf(signatureDeclaration.parameters, node);
62886288
Debug.assert(parameterIndex >= 0);
6289-
return hasRealRestParameter(signature) && parameterIndex >= signature.minArgumentCount;
6289+
return parameterIndex >= signature.minArgumentCount;
6290+
// return hasRealRestParameter(signature) && parameterIndex >= signature.minArgumentCount;
62906291
}
62916292
const iife = getImmediatelyInvokedFunctionExpression(node.parent);
62926293
if (iife) {
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(1,33): error TS2501: A rest element cannot contain a binding pattern.
2-
tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(2,21): error TS2345: Argument of type 'Map<string, number>' is not assignable to parameter of type '[any, any]'.
3-
Property '0' is missing in type 'Map<string, number>'.
2+
tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(2,1): error TS2554: Expected 2 arguments, but got 1.
43

54

65
==== tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts (2 errors) ====
76
function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { }
87
~~~~~~~~~~~~~~~~~~~~
98
!!! error TS2501: A rest element cannot contain a binding pattern.
109
takeFirstTwoEntries(new Map([["", 0], ["hello", 1]]));
11-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12-
!!! error TS2345: Argument of type 'Map<string, number>' is not assignable to parameter of type '[any, any]'.
13-
!!! error TS2345: Property '0' is missing in type 'Map<string, number>'.
10+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11+
!!! error TS2554: Expected 2 arguments, but got 1.

tests/baselines/reference/mappedTypeErrors.errors.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(77,59): error TS2345: A
2626
Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'.
2727
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(83,58): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Partial<{ x: number; y: number; }>'.
2828
Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'.
29-
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(105,15): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
30-
Types of property 'a' are incompatible.
31-
Type 'undefined' is not assignable to type 'string'.
3229
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(106,17): error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
3330
Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
3431
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(123,12): error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
@@ -49,7 +46,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,16): error TS2322:
4946
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: Type 'P' cannot be used to index type 'T'.
5047

5148

52-
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (26 errors) ====
49+
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (25 errors) ====
5350
interface Shape {
5451
name: string;
5552
width: number;
@@ -200,10 +197,6 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536:
200197
setState(foo, { });
201198
setState(foo, foo);
202199
setState(foo, { a: undefined }); // Error
203-
~~~~~~~~~~~~~~~~
204-
!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
205-
!!! error TS2345: Types of property 'a' are incompatible.
206-
!!! error TS2345: Type 'undefined' is not assignable to type 'string'.
207200
setState(foo, { c: true }); // Error
208201
~~~~~~~
209202
!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.

tests/baselines/reference/partiallyAnnotatedFunctionInferenceWithTypeParameter.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ testRest((t1, t2: D, t3) => {})
119119
>t3 : D
120120

121121
testRest((t2: D, ...t3) => {})
122-
>testRest((t2: D, ...t3) => {}) : any
122+
>testRest((t2: D, ...t3) => {}) : D
123123
>testRest : <T extends C>(a: (t: T, t1: T, ...ts: T[]) => void) => T
124124
>(t2: D, ...t3) => {} : (t2: D, ...t3: any[]) => void
125125
>t2 : D

0 commit comments

Comments
 (0)