Test:correct parens around keyof in decl emit

This commit is contained in:
Nathan Shively-Sanders 2017-06-13 14:00:26 -07:00
parent 43d47de74d
commit 2d2ac6794f
4 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,25 @@
//// [declarationEmitIndexTypeArray.ts]
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
const utilityFunctions = {
doSomethingWithKeys
};
//// [declarationEmitIndexTypeArray.js]
function doSomethingWithKeys() {
var keys = [];
for (var _i = 0; _i < arguments.length; _i++) {
keys[_i] = arguments[_i];
}
}
var utilityFunctions = {
doSomethingWithKeys: doSomethingWithKeys
};
//// [declarationEmitIndexTypeArray.d.ts]
declare function doSomethingWithKeys<T>(...keys: (keyof T)[]): void;
declare const utilityFunctions: {
doSomethingWithKeys: <T>(...keys: (keyof T)[]) => void;
};

View file

@ -0,0 +1,15 @@
=== tests/cases/compiler/declarationEmitIndexTypeArray.ts ===
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
>doSomethingWithKeys : Symbol(doSomethingWithKeys, Decl(declarationEmitIndexTypeArray.ts, 0, 0))
>T : Symbol(T, Decl(declarationEmitIndexTypeArray.ts, 0, 29))
>keys : Symbol(keys, Decl(declarationEmitIndexTypeArray.ts, 0, 32))
>T : Symbol(T, Decl(declarationEmitIndexTypeArray.ts, 0, 29))
const utilityFunctions = {
>utilityFunctions : Symbol(utilityFunctions, Decl(declarationEmitIndexTypeArray.ts, 2, 5))
doSomethingWithKeys
>doSomethingWithKeys : Symbol(doSomethingWithKeys, Decl(declarationEmitIndexTypeArray.ts, 2, 26))
};

View file

@ -0,0 +1,16 @@
=== tests/cases/compiler/declarationEmitIndexTypeArray.ts ===
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
>doSomethingWithKeys : <T>(...keys: keyof T[]) => void
>T : T
>keys : keyof T[]
>T : T
const utilityFunctions = {
>utilityFunctions : { doSomethingWithKeys: <T>(...keys: keyof T[]) => void; }
>{ doSomethingWithKeys} : { doSomethingWithKeys: <T>(...keys: keyof T[]) => void; }
doSomethingWithKeys
>doSomethingWithKeys : <T>(...keys: keyof T[]) => void
};

View file

@ -0,0 +1,6 @@
// @declaration: true
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
const utilityFunctions = {
doSomethingWithKeys
};