Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

fixExportClass.ts no longer works. #44

Closed
texastoland opened this issue May 17, 2016 · 4 comments
Closed

fixExportClass.ts no longer works. #44

texastoland opened this issue May 17, 2016 · 4 comments

Comments

@texastoland
Copy link

texastoland commented May 17, 2016

Using typescript@next I get the following:

export class A{}           // A = A;
class A{};export {A}       // ;\nexport {A};
export default class A{}   // exports["default"] = A;
class A{};export default A // export default A;
@Victorystick
Copy link
Contributor

@AppShipIt Can you elaborate on the problem? I can't really tell what input code resulted in what output.

Also, I believe export A is invalid syntax; did you mean export { A }?

@texastoland
Copy link
Author

texastoland commented May 18, 2016

did you mean export { A }?

Corrected thanks!

what input code resulted in what output.

From a shell session with a recent drop of TS 1.9:

$ ./node_modules/typescript/bin/tsc --version
Version 1.9.0-dev.20160428-1.0

$ INPUT='export class A{}'

$ node -e "
> const ts=require('typescript');
> console.log(ts.transpileModule('$INPUT',{
> compilerOptions:{module:ts.ModuleKind.ES2015}
> }).outputText)"
var A = (function () {
    function A() {
    }
    return A;
}());
A = A;

$ INPUT='class A{};export {A}'

$ node -e "const ts=require('typescript');console.log(ts.transpileModule('$INPUT',{compilerOptions:{module:ts.ModuleKind.ES2015}}).outputText)"
var A = (function () {
    function A() {
    }
    return A;
}());
;
export { A };

Repeating each variation from the description should yield my commented text as the last line.

Can you elaborate on the problem?

Looking again (with more rest) your regex will just skip export [default] <name> versions. But I wanted to share it may begin failing on export [default] class <name>.

@Victorystick
Copy link
Contributor

Have you tried overriding the TypeScript version used by the plugin to test this? I think the plugin should be handling this.

typescriptPlugin({
  typescript: require('typescript')
})

@texastoland
Copy link
Author

Oh I see what you're doing my bad!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants