"export class" does not compile with outfile=foo (module=none, es6)
See original GitHub issueTypeScript Version: 3.8.3
Search Terms:
Code
{
"$schema": "http://json.schemastore.org/tsconfig",
"compilerOptions": {
"module": "none",
"target": "es6",
"types": [],
"outFile": "newFile.js" // <- important
},
"files": [
"main.ts"
]
}
// main.ts
declare module Common {
abstract class absCom {
constructor();
}
}
export /* <- important */ class Com extends Common.absCom {
constructor() {
super();
}
}
Expected behavior:
This should compile without problems.
Actual behavior:
When I configure an outfile
no file is generated (js
and no .d.ts
, .js.map
).
But we get no error message about this!
This is the same with --verbose
:
[13:11:21] Project 'foo/tsconfig.json' is out of date because output file 'foo/newFile.js' does not exist
[13:11:21] Building project 'foo/tsconfig.json'...
[13:11:23] Updating unchanged output timestamps of project 'foo/tsconfig.json'...
Test 1:
Removing the outfile
generates the following block in main.js
:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Com extends Common.absCom {
constructor() {
super();
}
}
exports.Com = Com;
Test 2:
Removing export
in main.ts
we get in newFile.js
:
class Com extends Common.absCom {
constructor() {
super();
}
}
Thats why I think merging Object.defineProperty(exports, "__esModule", { value: true });
into one outfile
causes the abort.
Playground Link:
Not possible, as we need outfile
to trigger the bug.
Related Issues: none found
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
How to properly export an ES6 class in Node 4?
in my case, the display function is not exported unless in the constructor I wrote this.display = display , any idea why? –...
Read more >ES6 Modules and How to Use Import and Export in JavaScript
You can export members one by one. What's not exported won't be available directly outside the module: export const myNumbers = [ ...
Read more >export - JavaScript - MDN Web Docs
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the ......
Read more >Export and Import - The Modern JavaScript Tutorial
Please note that export before a class or a function does not make it a ... Modern build tools, such as webpack and...
Read more >Module Compiler Option in TypeScript - tsmean
What does the module option in the TypeScript compiler options do exactly? Learn what CommonJS, AMD or ES6 actually do.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I always interpreted the docs as
and not as
Waiting for feedback from product owner.
Wow. We are using
outFile
withmodule=none
for over five years without problems.