Skip to content

Commit ca82cf1

Browse files
committed
Test:correct parens around keyof in decl emit
1 parent 21166f4 commit ca82cf1

File tree

4 files changed

+62
-0
lines changed

4 files changed

+62
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [declarationEmitIndexTypeArray.ts]
2+
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
3+
4+
const utilityFunctions = {
5+
doSomethingWithKeys
6+
};
7+
8+
9+
//// [declarationEmitIndexTypeArray.js]
10+
function doSomethingWithKeys() {
11+
var keys = [];
12+
for (var _i = 0; _i < arguments.length; _i++) {
13+
keys[_i] = arguments[_i];
14+
}
15+
}
16+
var utilityFunctions = {
17+
doSomethingWithKeys: doSomethingWithKeys
18+
};
19+
20+
21+
//// [declarationEmitIndexTypeArray.d.ts]
22+
declare function doSomethingWithKeys<T>(...keys: (keyof T)[]): void;
23+
declare const utilityFunctions: {
24+
doSomethingWithKeys: <T>(...keys: (keyof T)[]) => void;
25+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
=== tests/cases/compiler/declarationEmitIndexTypeArray.ts ===
2+
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
3+
>doSomethingWithKeys : Symbol(doSomethingWithKeys, Decl(declarationEmitIndexTypeArray.ts, 0, 0))
4+
>T : Symbol(T, Decl(declarationEmitIndexTypeArray.ts, 0, 29))
5+
>keys : Symbol(keys, Decl(declarationEmitIndexTypeArray.ts, 0, 32))
6+
>T : Symbol(T, Decl(declarationEmitIndexTypeArray.ts, 0, 29))
7+
8+
const utilityFunctions = {
9+
>utilityFunctions : Symbol(utilityFunctions, Decl(declarationEmitIndexTypeArray.ts, 2, 5))
10+
11+
doSomethingWithKeys
12+
>doSomethingWithKeys : Symbol(doSomethingWithKeys, Decl(declarationEmitIndexTypeArray.ts, 2, 26))
13+
14+
};
15+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/declarationEmitIndexTypeArray.ts ===
2+
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
3+
>doSomethingWithKeys : <T>(...keys: keyof T[]) => void
4+
>T : T
5+
>keys : keyof T[]
6+
>T : T
7+
8+
const utilityFunctions = {
9+
>utilityFunctions : { doSomethingWithKeys: <T>(...keys: keyof T[]) => void; }
10+
>{ doSomethingWithKeys} : { doSomethingWithKeys: <T>(...keys: keyof T[]) => void; }
11+
12+
doSomethingWithKeys
13+
>doSomethingWithKeys : <T>(...keys: keyof T[]) => void
14+
15+
};
16+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @declaration: true
2+
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
3+
4+
const utilityFunctions = {
5+
doSomethingWithKeys
6+
};

0 commit comments

Comments
 (0)