Skip to content

Adding fixes for typescript >= 2.0.0 #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Adding fixes for typescript >= 2.0.0 #70

wants to merge 1 commit into from

Conversation

orkisz
Copy link

@orkisz orkisz commented Sep 16, 2016

Hi,

This change fixes build issues when using TypeScript >= 2.0.0. Basically, TS compiler does not allow conversion any -> enum anymore.

@orkisz
Copy link
Author

orkisz commented Sep 16, 2016

Should fix #65

@langley-agm
Copy link
Contributor

Hi @orkisz,

The thing is, the distribution is already compiled. You don't have to recompile it no matter your project's typescript version. See #39. If you avoid compiling your already compiled third parties, you'll avoid these kind of issues and you'll make your project's build phase more efficient.

@orkisz
Copy link
Author

orkisz commented Sep 17, 2016

Hi, @langley-agm

Yes, I know distribution is already compiled. But the problem is: package.json's main file is core.js (paired with core.d.ts which is good). What does core.js? It does:

export * from "./app/core/level";
export * from "./app/core/logger";
export * from "./app/core/providers";

All these referenced files are TS files so module bundler like Webpack will try to compile them.

TheFirstDeity in #65 pointed out how to resolve these issues. Basically, the easiest way is to use ES6- or ES5-compiled versions but emit declaration files for them. If you don't mind, I will create another PR to fix that.

@orkisz orkisz mentioned this pull request Sep 17, 2016
@langley-agm
Copy link
Contributor

TheFirstDeity in #65 pointed out how to resolve these issues.

He pointed out some ideas yes, I haven't been able to review his PR as he made several refactors. TBH I probably won't have enough time until a couple of months for now but since Angular 2 is out officially and they're using typescript beta in their quickstart I'll apply a fix for this error msg only probably next week, and leave a todo open for the compiling third parties issue.

As for your comments, core.js doesn't do:

export * from "./app/core/level";

it does:

__export(require("./app/core/level"));

which can be a .js file, doesn't have to be a .ts file.

You tell webpack what they are, this whole thing is a matter of configuration. As for my understanding Webpack does not compile code, typescript does, webpack tells him what and how, and it can also just bundle already compiled stuff, again, its a matter of configuration.

@langley-agm
Copy link
Contributor

Hey @orkisz

Since I now know it can be used by webpack without structure changes I'm going to apply this fix for the level type error. I think I like it better than the "+" workaround. Do you want me to or do you want to reopen this PR?

@orkisz
Copy link
Author

orkisz commented Oct 3, 2016

Hey, @langley-agm

It's up to you.

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

Successfully merging this pull request may close these issues.

2 participants