Skip to content
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.

ignoreDiagnostics like ts-loader #150

Merged
merged 5 commits into from
Jun 5, 2016
Merged

ignoreDiagnostics like ts-loader #150

merged 5 commits into from
Jun 5, 2016

Conversation

texastoland
Copy link
Contributor

Close #148.

@texastoland
Copy link
Contributor Author

CC @yaroslavya

@s-panferov
Copy link
Owner

@AppShipIt thanks! I'll look through it!

I know that some people find this useful, but in my practice i've never wanted to silence errors. Could you please provide some examples about why do you need this?

@texastoland
Copy link
Contributor Author

texastoland commented Jun 2, 2016

Yeah I'll add a note to the readme as well. The major one is microsoft/TypeScript#6319. TL;DR you cannot get tree shaking from WebPack 2 without it. I took a lot of inspiration from the Rollup plugin (see microsoft/TypeScript#6319 (comment)). But I'm also trying to migrate a legacy code base from Babel. TypeScript complains about a number of constructs (class/instance properties most annoyingly e.g. microsoft/TypeScript#7216) in JavaScript (no types yet) but nonetheless transpiles correctly. It sounds like they plan to be fix that but not soon.

@texastoland
Copy link
Contributor Author

texastoland commented Jun 3, 2016

@s-panferov I refactored the npm scripts too. Let me know if you prefer that in a separate PR.

Edit:
Nixing the Babel step broke the build because you're using it to transpile async…await to ES5. I reverted it and rebased. Compellingly microsoft/TypeScript#1564 (comment) provides another use case for my feature.

Rename conventionally and initiate `lint` before `build`, `build` before `test`, and `test` before `publish`.
lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
}
return (
`[${ instanceName }] ` + (diagnostic.file ? diagnostic.file.fileName : '')
Copy link
Owner

@s-panferov s-panferov Jun 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instanceName disappeared. Was it intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted where it moved to. This just unwrapped errors.map(). Most of the diff is indentation.

@s-panferov
Copy link
Owner

@AppShipIt hi!, Sorry for the delay, I had a hard work week. I have only two little questions and after that it can be merged.

@s-panferov
Copy link
Owner

Sorry, my eyes lie to me today. Everything is fine! Thanks again!

@s-panferov s-panferov merged commit 8892545 into s-panferov:master Jun 5, 2016
@@ -1,6 +1,3 @@
.tscache
node_modules
dist
Copy link
Contributor Author

@texastoland texastoland Jun 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right I should've left this line so TS output doesn't get published to npm. The next two lines can still be removed though and maybe add dist.babel/test.

@s-panferov
Copy link
Owner

Landed as awesome-typescript-loader@0.19.0

@texastoland
Copy link
Contributor Author

Giphy

@olegstepura
Copy link

@AppShipIt I'm kind of lost. Can we use generators in Typescript with awesome-typescript-loader without the extra compilation step (e.g. Typescript -> ES5, not Typescript -> ES6 (babel here) -> ES5)?

@texastoland
Copy link
Contributor Author

texastoland commented Jun 20, 2016

Generators (or async) cannot currently target ES5 because TS won't ship a runtime until 2.0 (see roadmap). Regardless ignoreDiagnostics has proven useful to compile other not yet fully supported features. Until a very recent beta TS warned against ES2015 modules with ES5 code for tree shaking but emitted mostly correct. Errors transpiling nonstandard features like properties from vanilla JS using the allowJs flag will also eventually work but not within the next couple releases.

@olegstepura
Copy link

@AppShipIt so even if we use regenerator we cannot avoid babel step at the moment, right?

@texastoland
Copy link
Contributor Author

texastoland commented Jun 21, 2016

Yes and no. TS will correctly emit async in combination with regenerator-loader and ignoreDiagnostics. But I've tried a couple tricks unsuccessfully to re-emit generator functions. For my team that was acceptable until 2.0.

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

Successfully merging this pull request may close these issues.

3 participants