Skip to content

TypeError: Cannot read property 'get' of undefined at Object.getJSXImplicitImportBase #44024

@salik1992

Description

@salik1992

Bug Report

🔎 Search Terms

ts getJSXImplicitImportBase
ts jest getJSXImplicitImportBase
ts file.pragmas

🕗 Version & Regression Information

4.2.4

  • This is the behaviour in every version I tried, and I reviewed the FAQ for entries about everything but it hasn't been covered.

⏯ Playground Link

I can't provide a link to a playground as this issue seems to be tied to the structure of the repository and dependencies.
I have tried to reproduce a minimal example but without luck for now.

💻 Code

This seems to be tied to the structure of the repository and dependencies:

  • There are 2 monorepositories - core and product
  • One of the packages in core is toast
  • In product there are ui and services
  • Bothui and services are dependent on toast which is installed as an external dependency from npmjs registry in both of them
  • ui is dependent on services
     toast   <-- external dependency (core monorepo)
      |  |
services |  <-- product monorepo
     \   |       
       ui   <-- product monorepo

In ui there is a Toast with custom visual implementations for the toast from core with its own tests.

🙁 Actual behavior

Running tests with npx jest packages/ui/src/components/Toast/__tests__/Toast.spec.tsx crashes with:

TypeError: Cannot read property 'get' of undefined

      at Object.getJSXImplicitImportBase (../../node_modules/typescript/lib/typescript.js:19175:95)
      at transformSourceFile (../../node_modules/typescript/lib/typescript.js:88624:51)
      at transformSourceFileOrBundle (../../node_modules/typescript/lib/typescript.js:82540:57)
      at transformation (../../node_modules/typescript/lib/typescript.js:100190:24)
      at transformRoot (../../node_modules/typescript/lib/typescript.js:100217:82)
      at Object.transformNodes (../../node_modules/typescript/lib/typescript.js:100201:78)
      at emitJsFileOrBundle (../../node_modules/typescript/lib/typescript.js:100852:32)
      at emitSourceFileOrBundle (../../node_modules/typescript/lib/typescript.js:100799:13)
      at forEachEmittedFile (../../node_modules/typescript/lib/typescript.js:100520:34)
      at Object.emitFiles (../../node_modules/typescript/lib/typescript.js:100779:9)

when inspecting the issue I have noticed this behaviour:

  • The file that causes the crash is packages/ui/node_modules/@private/core-toast/src/index.ts
  • SourceFileObject of this file is missing pragmas map
  • But it contains redirectInfo with redirectTarget: packages/ui/node_modules/@private/product-services/node_modules/@private/core-toast/src/index.ts
  • The SourceFileObject from this redirectInfo contains pragmas map

This happens during local development as well as in travis CI.

🙂 Expected behavior

The jest tests run without crashing.

Maybe related issue

#43373

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions