Closed
Description
TypeScript Version: 4.0.0-dev.20200516
Search Terms: commonjs, esmodule, rootDir
Code
Consider this file:
onst {version: VERSION} = require('../package.json');
console.log(VERSION);
async function foo() {
let obj = {};
console.log(obj);
}
export async function bar() {
console.log('foo');
await foo();
}
And this file:
const {version: VERSION} = require('../package.json');
console.log(VERSION);
async function foo() {
let obj = await import('./anotherFile');
console.log(obj);
}
export async function bar() {
console.log('foo');
await foo();
}
Expected behavior:
Running tsc
to compile them, they should both succeed or both fail?
Actual behavior:
The first file can be compiled smoothly, while the second was complained about error TS6059
and error TS6307
.
Playground Link: https://glitch.com/~aromatic-bittersweet-biplane
Related Issues: