yours is tsconfig.jsonmost likely wrong. The following worked very well:
tsconfig.json:
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"sourceMap": true
},
"exclude": [
"node_modules",
"typings/browser",
"typings/browser.d.ts"
],
"compileOnSave": true
}
ping.ts:
export async function ping() {
for (var i = 0; i < 10; i++) {
await delay(300);
console.log("ping");
}
}
function delay(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
main.ts:
import {ping} from "./ping"
async function main() {
await ping();
}
main();
source
share