add tests

This commit is contained in:
uhyo committed 2022-06-08 21:09:04 +09:00
1 parent 4aec8efd18
commit a37d6d471b
10 files changed
+107

No files matched your search

@@ -0,0 +1,10 @@
tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts(1,15): error TS2797: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
==== tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts (1 errors) ====
type F = ({a: string}) => void;
~~~~~~
!!! error TS2797: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
const f = ({a: string}) => string;
@@ -0,0 +1,11 @@
//// [renamingDestructuredPropertyInFunctionType.ts]
type F = ({a: string}) => void;
const f = ({a: string}) => string;
//// [renamingDestructuredPropertyInFunctionType.js]
var f = function (_a) {
var string = _a.a;
return string;
};
@@ -0,0 +1,12 @@
=== tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts ===
type F = ({a: string}) => void;
>F : Symbol(F, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 0))
>a : Symbol(a)
>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 0, 11))
const f = ({a: string}) => string;
>f : Symbol(f, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 5))
>a : Symbol(a)
>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 12))
>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType.ts, 2, 12))
@@ -0,0 +1,13 @@
=== tests/cases/compiler/renamingDestructuredPropertyInFunctionType.ts ===
type F = ({a: string}) => void;
>F : F
>a : any
>string : any
const f = ({a: string}) => string;
>f : ({ a: string }: { a: any; }) => any
>({a: string}) => string : ({ a: string }: { a: any; }) => any
>a : any
>string : any
>string : any
@@ -0,0 +1,14 @@
tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts(1,15): error TS2797: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts(3,16): error TS7031: Binding element 'string' implicitly has an 'any' type.
==== tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts (2 errors) ====
type F = ({a: string}) => void;
~~~~~~
!!! error TS2797: Renaming a property in destructuring assignment is only allowed in a function or constructor implementation.
const f = ({a: string}) => string;
~~~~~~
!!! error TS7031: Binding element 'string' implicitly has an 'any' type.
@@ -0,0 +1,12 @@
//// [renamingDestructuredPropertyInFunctionType2.ts]
type F = ({a: string}) => void;
const f = ({a: string}) => string;
//// [renamingDestructuredPropertyInFunctionType2.js]
var f = function (_a) {
var string = _a.a;
return string;
};
@@ -0,0 +1,13 @@
=== tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts ===
type F = ({a: string}) => void;
>F : Symbol(F, Decl(renamingDestructuredPropertyInFunctionType2.ts, 0, 0))
>a : Symbol(a)
>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType2.ts, 0, 11))
const f = ({a: string}) => string;
>f : Symbol(f, Decl(renamingDestructuredPropertyInFunctionType2.ts, 2, 5))
>a : Symbol(a)
>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType2.ts, 2, 12))
>string : Symbol(string, Decl(renamingDestructuredPropertyInFunctionType2.ts, 2, 12))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/renamingDestructuredPropertyInFunctionType2.ts ===
type F = ({a: string}) => void;
>F : F
>a : any
>string : any
const f = ({a: string}) => string;
>f : ({ a: string }: { a: any; }) => any
>({a: string}) => string : ({ a: string }: { a: any; }) => any
>a : any
>string : any
>string : any
@@ -0,0 +1,3 @@
type F = ({a: string}) => void;
const f = ({a: string}) => string;
@@ -0,0 +1,5 @@
// @noImplicitAny: true
type F = ({a: string}) => void;
const f = ({a: string}) => string;