Skip to content
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

Allow using all supported Moment inputs with TimeAgoPipe #206

Merged
merged 2 commits into from Dec 9, 2018
Merged

Allow using all supported Moment inputs with TimeAgoPipe #206

merged 2 commits into from Dec 9, 2018

Conversation

theodorejb
Copy link
Contributor

Makes it possible to use TimeAgoPipe with string/number dates when the fullTemplateTypeCheck Angular compiler option is enabled. Fixes #204.

Also enables type checking when running tests. Previously a test could contain a type error, but all tests would be reported as passing since ts-jest only uses TypeScript as a file preprocessor (see kulshekhar/ts-jest#79).

This is a non-breaking change which can be included in a minor/patch release.

Previously a test could contain a type error, but all tests would be reported as passing since ts-jest only uses TypeScript as a file preprocessor.
See kulshekhar/ts-jest#79.
Copy link
Owner

@urish urish left a comment

Choose a reason for hiding this comment

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

Thank you very much! See my comments regarding explicitly adding return types.

Also, interesting note regarding reporting type errors from jest - as far as I can remember, if you specify a value for tsConfig in ts-jest config, it does type check.

src/time-ago.pipe.ts Outdated Show resolved Hide resolved
src/time-ago.pipe.ts Outdated Show resolved Hide resolved
@theodorejb
Copy link
Contributor Author

as far as I can remember, if you specify a value for tsConfig in ts-jest config, it does type check.

I tried this, but it didn't work. The tsConfig option is documented at https://kulshekhar.github.io/ts-jest/user/config/tsConfig. By default ts-jest uses the project's tsconfig.json file, and this is just a way to override that. It doesn't enable type checking when running tests.

There is a different enableTsDiagnostics ts-jest option which was documented in an old version of the readme. This actually does work - the test suite fails and I get a TypeScript compiler error when a test contains a type error. However, I wasn't sure about using this option since it isn't documented anymore, and the old documentation said it was an experimental feature that could be removed and will hurt performance.

@urish urish merged commit f0dc4aa into urish:master Dec 9, 2018
@urish
Copy link
Owner

urish commented Dec 9, 2018

Released as 3.3.0

@theodorejb theodorejb deleted the support-full-template-type-check branch December 10, 2018 03:00
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.

None yet

2 participants