const myObject: { [key: string]: string } = {foo: 'bar'}With target=es2017 and TypeScript 2.8
const foo = () => {
return [1, 2, 3];
};
export const myAdd: (x: number, y: number) => number = (
x: number,
y: number,
) => {
return x + y;
};
export function myAdd2(x: number, y: number): number {
return x + y;
}produces this JavaScript output:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const foo = () => {
return [1, 2, 3];
};
exports.myAdd = (x, y) => {
return x + y;
};
function myAdd2(x, y) {
return x + y;
}
exports.myAdd2 = myAdd2;