Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KiaraGrouwstra committed Aug 27, 2017
1 parent 0e9334b commit 5252cd9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
7 changes: 4 additions & 3 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference path="moduleNameResolver.ts"/>
/// <reference path="binder.ts"/>
/// <reference types="node"/>
declare var console: Console;
// /// <reference types="node"/>
// declare var console: Console;

/* @internal */
namespace ts {
Expand Down Expand Up @@ -6286,7 +6286,8 @@ namespace ts {
const signature = getSignatureFromDeclaration(signatureDeclaration);
const parameterIndex = ts.indexOf(signatureDeclaration.parameters, node);
Debug.assert(parameterIndex >= 0);
return hasRealRestParameter(signature) && parameterIndex >= signature.minArgumentCount;
return parameterIndex >= signature.minArgumentCount;
// return hasRealRestParameter(signature) && parameterIndex >= signature.minArgumentCount;
}
const iife = getImmediatelyInvokedFunctionExpression(node.parent);
if (iife) {
Expand Down
8 changes: 3 additions & 5 deletions tests/baselines/reference/iterableArrayPattern25.errors.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(1,33): error TS2501: A rest element cannot contain a binding pattern.
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]'.
Property '0' is missing in type 'Map<string, number>'.
tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts(2,1): error TS2554: Expected 2 arguments, but got 1.


==== tests/cases/conformance/es6/destructuring/iterableArrayPattern25.ts (2 errors) ====
function takeFirstTwoEntries(...[[k1, v1], [k2, v2]]) { }
~~~~~~~~~~~~~~~~~~~~
!!! error TS2501: A rest element cannot contain a binding pattern.
takeFirstTwoEntries(new Map([["", 0], ["hello", 1]]));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type 'Map<string, number>' is not assignable to parameter of type '[any, any]'.
!!! error TS2345: Property '0' is missing in type 'Map<string, number>'.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2554: Expected 2 arguments, but got 1.
9 changes: 1 addition & 8 deletions tests/baselines/reference/mappedTypeErrors.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(77,59): error TS2345: A
Object literal may only specify known properties, and 'z' does not exist in type 'Readonly<{ x: number; y: number; }>'.
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; }>'.
Object literal may only specify known properties, and 'z' does not exist in type 'Partial<{ x: number; y: number; }>'.
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">'.
Types of property 'a' are incompatible.
Type 'undefined' is not assignable to type 'string'.
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">'.
Object literal may only specify known properties, and 'c' does not exist in type 'Pick<Foo, "a" | "b">'.
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">'.
Expand All @@ -49,7 +46,7 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,16): error TS2322:
tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: Type 'P' cannot be used to index type 'T'.


==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (26 errors) ====
==== tests/cases/conformance/types/mapped/mappedTypeErrors.ts (25 errors) ====
interface Shape {
name: string;
width: number;
Expand Down Expand Up @@ -200,10 +197,6 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536:
setState(foo, { });
setState(foo, foo);
setState(foo, { a: undefined }); // Error
~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '{ a: undefined; }' is not assignable to parameter of type 'Pick<Foo, "a">'.
!!! error TS2345: Types of property 'a' are incompatible.
!!! error TS2345: Type 'undefined' is not assignable to type 'string'.
setState(foo, { c: true }); // Error
~~~~~~~
!!! error TS2345: Argument of type '{ c: boolean; }' is not assignable to parameter of type 'Pick<Foo, "a" | "b">'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ testRest((t1, t2: D, t3) => {})
>t3 : D

testRest((t2: D, ...t3) => {})
>testRest((t2: D, ...t3) => {}) : any
>testRest((t2: D, ...t3) => {}) : D
>testRest : <T extends C>(a: (t: T, t1: T, ...ts: T[]) => void) => T
>(t2: D, ...t3) => {} : (t2: D, ...t3: any[]) => void
>t2 : D
Expand Down

0 comments on commit 5252cd9

Please sign in to comment.