Merge branch 'master' into controlFlowTypes

This commit is contained in:
Anders Hejlsberg
2016-04-12 09:37:34 -07:00
79 changed files with 41471 additions and 57735 deletions

View File

@@ -0,0 +1,13 @@
//// [blockScopedFunctionDeclarationES5.ts]
if (true) {
function foo() { }
foo();
}
foo();
//// [blockScopedFunctionDeclarationES5.js]
if (true) {
function foo() { }
foo();
}
foo();

View File

@@ -0,0 +1,11 @@
=== tests/cases/compiler/blockScopedFunctionDeclarationES5.ts ===
if (true) {
function foo() { }
>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11))
foo();
>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11))
}
foo();
>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES5.ts, 0, 11))

View File

@@ -0,0 +1,15 @@
=== tests/cases/compiler/blockScopedFunctionDeclarationES5.ts ===
if (true) {
>true : boolean
function foo() { }
>foo : () => void
foo();
>foo() : void
>foo : () => void
}
foo();
>foo() : void
>foo : () => void

View File

@@ -0,0 +1,13 @@
//// [blockScopedFunctionDeclarationES6.ts]
if (true) {
function foo() { }
foo();
}
foo();
//// [blockScopedFunctionDeclarationES6.js]
if (true) {
function foo() { }
foo();
}
foo();

View File

@@ -0,0 +1,11 @@
=== tests/cases/compiler/blockScopedFunctionDeclarationES6.ts ===
if (true) {
function foo() { }
>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11))
foo();
>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11))
}
foo();
>foo : Symbol(foo, Decl(blockScopedFunctionDeclarationES6.ts, 0, 11))

View File

@@ -0,0 +1,15 @@
=== tests/cases/compiler/blockScopedFunctionDeclarationES6.ts ===
if (true) {
>true : boolean
function foo() { }
>foo : () => void
foo();
>foo() : void
>foo : () => void
}
foo();
>foo() : void
>foo : () => void

View File

@@ -0,0 +1,18 @@
tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts(4,22): error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.
tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts(7,9): error TS2304: Cannot find name 'foo'.
==== tests/cases/compiler/blockScopedFunctionDeclarationInStrictClass.ts (2 errors) ====
class c {
method() {
if (true) {
function foo() { }
~~~
!!! error TS1251: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode.
foo(); // ok
}
foo(); // not ok
~~~
!!! error TS2304: Cannot find name 'foo'.
}
}

View File

@@ -0,0 +1,24 @@
//// [blockScopedFunctionDeclarationInStrictClass.ts]
class c {
method() {
if (true) {
function foo() { }
foo(); // ok
}
foo(); // not ok
}
}
//// [blockScopedFunctionDeclarationInStrictClass.js]
var c = (function () {
function c() {
}
c.prototype.method = function () {
if (true) {
function foo() { }
foo(); // ok
}
foo(); // not ok
};
return c;
}());

View File

@@ -0,0 +1,15 @@
tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts(2,14): error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.
tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts(6,10): error TS2304: Cannot find name 'foo'.
==== tests/cases/compiler/blockScopedFunctionDeclarationInStrictModule.ts (2 errors) ====
if (true) {
function foo() { }
~~~
!!! error TS1252: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode.
foo(); // ok
}
export = foo; // not ok
~~~
!!! error TS2304: Cannot find name 'foo'.

View File

@@ -0,0 +1,16 @@
//// [blockScopedFunctionDeclarationInStrictModule.ts]
if (true) {
function foo() { }
foo(); // ok
}
export = foo; // not ok
//// [blockScopedFunctionDeclarationInStrictModule.js]
define(["require", "exports"], function (require, exports) {
"use strict";
if (true) {
function foo() { }
foo(); // ok
}
});

View File

@@ -0,0 +1,15 @@
tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(3,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts(6,1): error TS2304: Cannot find name 'foo'.
==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES5.ts (2 errors) ====
"use strict";
if (true) {
function foo() { } // Error to declare function in block scope
~~~
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
foo(); // This call should be ok
}
foo(); // Error to find name foo
~~~
!!! error TS2304: Cannot find name 'foo'.

View File

@@ -0,0 +1,15 @@
//// [blockScopedFunctionDeclarationStrictES5.ts]
"use strict";
if (true) {
function foo() { } // Error to declare function in block scope
foo(); // This call should be ok
}
foo(); // Error to find name foo
//// [blockScopedFunctionDeclarationStrictES5.js]
"use strict";
if (true) {
function foo() { } // Error to declare function in block scope
foo(); // This call should be ok
}
foo(); // Error to find name foo

View File

@@ -0,0 +1,12 @@
tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts(6,1): error TS2304: Cannot find name 'foo'.
==== tests/cases/compiler/blockScopedFunctionDeclarationStrictES6.ts (1 errors) ====
"use strict";
if (true) {
function foo() { } // Allowed to declare block scope function
foo(); // This call should be ok
}
foo(); // Cannot find name since foo is block scoped
~~~
!!! error TS2304: Cannot find name 'foo'.

View File

@@ -0,0 +1,15 @@
//// [blockScopedFunctionDeclarationStrictES6.ts]
"use strict";
if (true) {
function foo() { } // Allowed to declare block scope function
foo(); // This call should be ok
}
foo(); // Cannot find name since foo is block scoped
//// [blockScopedFunctionDeclarationStrictES6.js]
"use strict";
if (true) {
function foo() { } // Allowed to declare block scope function
foo(); // This call should be ok
}
foo(); // Cannot find name since foo is block scoped

View File

@@ -0,0 +1,37 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(3,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(8,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(12,5): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target.
==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationES5.ts (6 errors) ====
function foo(a: number) {
if (a === 1) {
function foo() { } // duplicate function
~~~
!!! error TS2393: Duplicate function implementation.
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
else {
function foo() { } // duplicate function
~~~
!!! error TS2393: Duplicate function implementation.
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
foo();
}
foo(10);
foo(); // not ok - needs number
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.

View File

@@ -0,0 +1,35 @@
//// [blockScopedSameNameFunctionDeclarationES5.ts]
function foo(a: number) {
if (a === 1) {
function foo() { } // duplicate function
foo();
foo(10); // not ok
}
else {
function foo() { } // duplicate function
foo();
foo(10); // not ok
}
foo(10); // not ok
foo();
}
foo(10);
foo(); // not ok - needs number
//// [blockScopedSameNameFunctionDeclarationES5.js]
function foo(a) {
if (a === 1) {
function foo() { } // duplicate function
foo();
foo(10); // not ok
}
else {
function foo() { } // duplicate function
foo();
foo(10); // not ok
}
foo(10); // not ok
foo();
}
foo(10);
foo(); // not ok - needs number

View File

@@ -0,0 +1,37 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(3,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(5,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(8,18): error TS2393: Duplicate function implementation.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(10,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(12,5): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts(16,1): error TS2346: Supplied parameters do not match any signature of call target.
==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationES6.ts (6 errors) ====
function foo(a: number) {
if (a === 10) {
function foo() { } // duplicate
~~~
!!! error TS2393: Duplicate function implementation.
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
else {
function foo() { } // duplicate
~~~
!!! error TS2393: Duplicate function implementation.
foo();
foo(10);// not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
foo();
}
foo(10);
foo(); // not ok - needs number
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.

View File

@@ -0,0 +1,35 @@
//// [blockScopedSameNameFunctionDeclarationES6.ts]
function foo(a: number) {
if (a === 10) {
function foo() { } // duplicate
foo();
foo(10); // not ok
}
else {
function foo() { } // duplicate
foo();
foo(10);// not ok
}
foo(10); // not ok
foo();
}
foo(10);
foo(); // not ok - needs number
//// [blockScopedSameNameFunctionDeclarationES6.js]
function foo(a) {
if (a === 10) {
function foo() { } // duplicate
foo();
foo(10); // not ok
}
else {
function foo() { } // duplicate
foo();
foo(10); // not ok
}
foo(10); // not ok
foo();
}
foo(10);
foo(); // not ok - needs number

View File

@@ -0,0 +1,38 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(4,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(6,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(9,18): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(14,5): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target.
==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES5.ts (6 errors) ====
"use strict";
function foo(a: number) {
if (a === 1) {
function foo() { } // Error to declare function in block scope
~~~
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
else {
function foo() { } // Error to declare function in block scope
~~~
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
foo(10);
foo(); // not ok - needs number
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
foo(10);
foo(); // not ok - needs number
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.

View File

@@ -0,0 +1,37 @@
//// [blockScopedSameNameFunctionDeclarationStrictES5.ts]
"use strict";
function foo(a: number) {
if (a === 1) {
function foo() { } // Error to declare function in block scope
foo();
foo(10); // not ok
}
else {
function foo() { } // Error to declare function in block scope
foo();
foo(10); // not ok
}
foo(10);
foo(); // not ok - needs number
}
foo(10);
foo(); // not ok - needs number
//// [blockScopedSameNameFunctionDeclarationStrictES5.js]
"use strict";
function foo(a) {
if (a === 1) {
function foo() { } // Error to declare function in block scope
foo();
foo(10); // not ok
}
else {
function foo() { } // Error to declare function in block scope
foo();
foo(10); // not ok
}
foo(10);
foo(); // not ok - needs number
}
foo(10);
foo(); // not ok - needs number

View File

@@ -0,0 +1,32 @@
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(6,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(11,9): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(14,5): error TS2346: Supplied parameters do not match any signature of call target.
tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts(17,1): error TS2346: Supplied parameters do not match any signature of call target.
==== tests/cases/compiler/blockScopedSameNameFunctionDeclarationStrictES6.ts (4 errors) ====
"use strict";
function foo(a: number) {
if (a === 10) {
function foo() { }
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
else {
function foo() { }
foo();
foo(10); // not ok
~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
foo(10);
foo(); // not ok
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.
}
foo(10);
foo(); // not ok - needs number
~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.

View File

@@ -0,0 +1,37 @@
//// [blockScopedSameNameFunctionDeclarationStrictES6.ts]
"use strict";
function foo(a: number) {
if (a === 10) {
function foo() { }
foo();
foo(10); // not ok
}
else {
function foo() { }
foo();
foo(10); // not ok
}
foo(10);
foo(); // not ok
}
foo(10);
foo(); // not ok - needs number
//// [blockScopedSameNameFunctionDeclarationStrictES6.js]
"use strict";
function foo(a) {
if (a === 10) {
function foo() { }
foo();
foo(10); // not ok
}
else {
function foo() { }
foo();
foo(10); // not ok
}
foo(10);
foo(); // not ok
}
foo(10);
foo(); // not ok - needs number

View File

@@ -0,0 +1,40 @@
tests/cases/compiler/downlevelLetConst18.ts(5,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
tests/cases/compiler/downlevelLetConst18.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
==== tests/cases/compiler/downlevelLetConst18.ts (2 errors) ====
'use strict'
for (let x; ;) {
function foo() { x };
~~~
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
}
for (let x; ;) {
function foo1() { x };
~~~~
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
}
for (let x; ;) {
(() => { x })();
}
for (const x = 1; ;) {
(() => { x })();
}
for (let x; ;) {
({ foo() { x }})
}
for (let x; ;) {
({ get foo() { return x } })
}
for (let x; ;) {
({ set foo(v) { x } })
}

View File

@@ -1,59 +0,0 @@
=== tests/cases/compiler/downlevelLetConst18.ts ===
'use strict'
for (let x; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8))
function foo() { x };
>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 3, 16))
>x : Symbol(x, Decl(downlevelLetConst18.ts, 3, 8))
}
for (let x; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8))
function foo1() { x };
>foo1 : Symbol(foo1, Decl(downlevelLetConst18.ts, 7, 16))
>x : Symbol(x, Decl(downlevelLetConst18.ts, 7, 8))
}
for (let x; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8))
(() => { x })();
>x : Symbol(x, Decl(downlevelLetConst18.ts, 11, 8))
}
for (const x = 1; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10))
(() => { x })();
>x : Symbol(x, Decl(downlevelLetConst18.ts, 15, 10))
}
for (let x; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8))
({ foo() { x }})
>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 20, 6))
>x : Symbol(x, Decl(downlevelLetConst18.ts, 19, 8))
}
for (let x; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8))
({ get foo() { return x } })
>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 24, 6))
>x : Symbol(x, Decl(downlevelLetConst18.ts, 23, 8))
}
for (let x; ;) {
>x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8))
({ set foo(v) { x } })
>foo : Symbol(foo, Decl(downlevelLetConst18.ts, 28, 6))
>v : Symbol(v, Decl(downlevelLetConst18.ts, 28, 15))
>x : Symbol(x, Decl(downlevelLetConst18.ts, 27, 8))
}

View File

@@ -1,73 +0,0 @@
=== tests/cases/compiler/downlevelLetConst18.ts ===
'use strict'
>'use strict' : string
for (let x; ;) {
>x : any
function foo() { x };
>foo : () => void
>x : any
}
for (let x; ;) {
>x : any
function foo1() { x };
>foo1 : () => void
>x : any
}
for (let x; ;) {
>x : any
(() => { x })();
>(() => { x })() : void
>(() => { x }) : () => void
>() => { x } : () => void
>x : any
}
for (const x = 1; ;) {
>x : number
>1 : number
(() => { x })();
>(() => { x })() : void
>(() => { x }) : () => void
>() => { x } : () => void
>x : number
}
for (let x; ;) {
>x : any
({ foo() { x }})
>({ foo() { x }}) : { foo(): void; }
>{ foo() { x }} : { foo(): void; }
>foo : () => void
>x : any
}
for (let x; ;) {
>x : any
({ get foo() { return x } })
>({ get foo() { return x } }) : { readonly foo: any; }
>{ get foo() { return x } } : { readonly foo: any; }
>foo : any
>x : any
}
for (let x; ;) {
>x : any
({ set foo(v) { x } })
>({ set foo(v) { x } }) : { foo: any; }
>{ set foo(v) { x } } : { foo: any; }
>foo : any
>v : any
>x : any
}

View File

@@ -0,0 +1,25 @@
tests/cases/compiler/downlevelLetConst19.ts(9,14): error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
==== tests/cases/compiler/downlevelLetConst19.ts (1 errors) ====
'use strict'
declare function use(a: any);
var x;
function a() {
{
let x;
use(x);
function b() {
~
!!! error TS1250: Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'.
{
let x;
use(x);
}
use(x);
}
}
use(x)
}
use(x)

View File

@@ -1,42 +0,0 @@
=== tests/cases/compiler/downlevelLetConst19.ts ===
'use strict'
declare function use(a: any);
>use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12))
>a : Symbol(a, Decl(downlevelLetConst19.ts, 1, 21))
var x;
>x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3))
function a() {
>a : Symbol(a, Decl(downlevelLetConst19.ts, 2, 6))
{
let x;
>x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7))
use(x);
>use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12))
>x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7))
function b() {
>b : Symbol(b, Decl(downlevelLetConst19.ts, 6, 11))
{
let x;
>x : Symbol(x, Decl(downlevelLetConst19.ts, 10, 15))
use(x);
>use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12))
>x : Symbol(x, Decl(downlevelLetConst19.ts, 10, 15))
}
use(x);
>use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12))
>x : Symbol(x, Decl(downlevelLetConst19.ts, 5, 7))
}
}
use(x)
>use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12))
>x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3))
}
use(x)
>use : Symbol(use, Decl(downlevelLetConst19.ts, 0, 12))
>x : Symbol(x, Decl(downlevelLetConst19.ts, 2, 3))

View File

@@ -1,49 +0,0 @@
=== tests/cases/compiler/downlevelLetConst19.ts ===
'use strict'
>'use strict' : string
declare function use(a: any);
>use : (a: any) => any
>a : any
var x;
>x : any
function a() {
>a : () => void
{
let x;
>x : any
use(x);
>use(x) : any
>use : (a: any) => any
>x : any
function b() {
>b : () => void
{
let x;
>x : any
use(x);
>use(x) : any
>use : (a: any) => any
>x : any
}
use(x);
>use(x) : any
>use : (a: any) => any
>x : any
}
}
use(x)
>use(x) : any
>use : (a: any) => any
>x : any
}
use(x)
>use(x) : any
>use : (a: any) => any
>x : any

View File

@@ -0,0 +1,34 @@
//// [noImplicitAnyDestructuringInPrivateMethod.ts]
type Arg = {
a: number;
};
export class Bar {
private bar({ a, }: Arg): number {
return a;
}
}
export declare class Bar2 {
private bar({ a, });
}
//// [noImplicitAnyDestructuringInPrivateMethod.js]
"use strict";
var Bar = (function () {
function Bar() {
}
Bar.prototype.bar = function (_a) {
var a = _a.a;
return a;
};
return Bar;
}());
exports.Bar = Bar;
//// [noImplicitAnyDestructuringInPrivateMethod.d.ts]
export declare class Bar {
private bar({a});
}
export declare class Bar2 {
private bar({a});
}

View File

@@ -0,0 +1,27 @@
=== tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts ===
type Arg = {
>Arg : Symbol(Arg, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 0))
a: number;
>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 12))
};
export class Bar {
>Bar : Symbol(Bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 2, 2))
private bar({ a, }: Arg): number {
>bar : Symbol(Bar.bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 3, 18))
>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 4, 17))
>Arg : Symbol(Arg, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 0, 0))
return a;
>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 4, 17))
}
}
export declare class Bar2 {
>Bar2 : Symbol(Bar2, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 7, 1))
private bar({ a, });
>bar : Symbol(Bar2.bar, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 8, 27))
>a : Symbol(a, Decl(noImplicitAnyDestructuringInPrivateMethod.ts, 9, 17))
}

View File

@@ -0,0 +1,27 @@
=== tests/cases/compiler/noImplicitAnyDestructuringInPrivateMethod.ts ===
type Arg = {
>Arg : { a: number; }
a: number;
>a : number
};
export class Bar {
>Bar : Bar
private bar({ a, }: Arg): number {
>bar : ({a}: { a: number; }) => number
>a : number
>Arg : { a: number; }
return a;
>a : number
}
}
export declare class Bar2 {
>Bar2 : Bar2
private bar({ a, });
>bar : ({a}: { a: any; }) => any
>a : any
}