I have an iife that I would like to compile and I import statement for types. In TypeScript version 3.* it compiles correctly. But in TypeScript version 4.* it appends an export {}. Is there a way to prevent that?
Here is the typescript file test.ts:
import { Tester } from "./tester"
(async function test() : Promise<Tester> { return { hello: "export" } }())
tester.d.ts
export interface Tester {
hello: string
}
Resulting file with TypeScript 4.* test.js
(async function test() { return { hello: "export" }; }());
export {};
Resulting file with TypeScript 3.9.* test.js
(async function test() { return { hello: "export" }; }());
My tsconfig.json file:
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2015",
"moduleResolution": "Node",
"strict": true,
"noImplicitAny": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
"allowJs": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"outDir": "./public/app",
"skipLibCheck": true
},
"compileOnSave": true,"src/app/meals/add/index.template.js", "src/app/utils/html-template-tag.js" ],
"include": ["src/**/*.ts", "src/**/*.js"],
"exclude": [
"node_modules", "src/**/*spec.ts"
]
}
The command I use for it:
tsc -p ./tsconfig.json
Update
I added this bug report to TypeScript.