From 16ab528bd000467e98f06c922e6a33fadc1df195 Mon Sep 17 00:00:00 2001 From: Andrey Bienkowski Date: Thu, 2 Sep 2021 04:30:37 +0000 Subject: [PATCH] Add link to the typesript integration instructions I installed jest and typescript, but they refused to integrate. jest was throwing SyntaxErrors at me when parsing typescript files. Searching for typescript on you website got me here https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#typescript-support which a very unhelpful because it does not contain instructions on how to configure the integration. It turned out that I need babel.config.js --- ...019-01-25-jest-24-refreshing-polished-typescript-friendly.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/blog/2019-01-25-jest-24-refreshing-polished-typescript-friendly.md b/website/blog/2019-01-25-jest-24-refreshing-polished-typescript-friendly.md index 30f0f7fbc9ad..de03462d4398 100644 --- a/website/blog/2019-01-25-jest-24-refreshing-polished-typescript-friendly.md +++ b/website/blog/2019-01-25-jest-24-refreshing-polished-typescript-friendly.md @@ -19,6 +19,8 @@ The aim of the redesign was to highlight more of what makes Jest awesome, and to ## TypeScript support +See [this instructions](https://jestjs.io/docs/getting-started#using-typescript) to enable TypeScript support. + We've upgraded to Babel 7 internally for Jest 24, which comes with support for TypeScript projects. That means Jest can support transpiling TypeScript out of the box, as long as you configure Babel to use it with `@babel/preset-typescript`. One caveat to the default TypeScript support, similar to Flow, is that Babel will only strip out the type annotations to make your code valid JavaScript. It will _not_ typecheck your code. While Jest has supported Babel 7 since version 22 released in December 2017, it required usage of a bridge module in order to fit in with Jest's support of Babel 6. In Jest 24 we have migrated entirely over to Babel 7, with great help from community member [@milesj](https://github.com/milesj). This means that setup is now easier and we can take advantage of other Babel 7 features, such as config loading and automatic `modules` transpilation. Make sure to remove the `babel-core@^7.0.0-bridge.0` as it's not needed now.