question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for TypeScript 3.7.2

See original GitHub issue

Hello!

ts-jest currently does not work with TypeScript 3.7.2. Import statements are not transformed in the transformed code of imports in test files.

src/db/seeds/1-users/users.ts:1
import { ObjectId } from '../../../app/helpers/db';
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
ChrisLahayecommented, Dec 2, 2019

For me the problem was that I was using target: esnext which tells the compiler that your runtime will be able to handle esnext features, i.e. supports the nullish coalescing and optional chaining operator. I am using node 12 which only supports up until es2018. For people encountering this problem, check what runtime you are using and which features (e.g. operators and functions) are supported (see https://node.green/), and then set your target appropriately.

6reactions
squalsoftcommented, Jan 9, 2020

Yes, “target”: “ES2019” resolves this issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

3.7.2 - typescript - npm
TypeScript is a language for application scale JavaScript development. Latest version: 4.9.4, last published: 2 days ago.
Read more >
Documentation - TypeScript 3.7
Better Support for never -Returning Functions. As part of the work for assertion signatures, TypeScript needed to encode more about where and which...
Read more >
TypeScript 3.7.2 for Visual Studio
This is a standalone, power tool release of TypeScript 3.7.2 for Visual Studio. It includes both the TypeScript experience for Visual Studio ...
Read more >
TypeScript 3.7.2 - Support for the experimental syntax ...
In my project I am using TS 3.7.2 which should support optional chaining. But when I try to use ...
Read more >
Announcing TypeScript 3.7 - Microsoft Developer Blogs
Optional Chaining · Nullish Coalescing · Assertion Functions · Better Support for never -Returning Functions · --declaration and --allowJs · (More) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found