mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Test:correct parens around keyof in decl emit
This commit is contained in:
@@ -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;
|
||||
};
|
||||
@@ -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))
|
||||
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// @declaration: true
|
||||
function doSomethingWithKeys<T>(...keys: (keyof T)[]) { }
|
||||
|
||||
const utilityFunctions = {
|
||||
doSomethingWithKeys
|
||||
};
|
||||
Reference in New Issue
Block a user