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.

Typescript support for jest?

See original GitHub issue

As the title implies, is there typescript support for @react-native-async-storage/async-storage?

I figured in other discussions that the @types should be the same as the original react-native async-storage or the predecessor react-native-community async-storage. However, I don’t know how to implement the previous types on this module.

Instructions would be appreciated!

Could not find a declaration file for module '@react-native-async-storage/async-storage/jest/async-storage-mock'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

15reactions
Guicbdinizcommented, Apr 5, 2021

Closing due to inactivity. If you think this is a mistake, please reply and we’ll reopen it.

I’m having the same issue here with the import. Although I’m able to import import AsyncStorage from "@react-native-async-storage/async-storage", I get a type error when importing import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'

5reactions
krizzucommented, Jan 8, 2021

Typescript issue comes from the fact that the mock is not declared in our typings. In that case, I advise to use Jest setup file to mock AsyncStorage

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting Started - Jest
Jest supports TypeScript, via Babel. First, make sure you followed the instructions on using Babel above. Next, install the @babel/preset- ...
Read more >
Testing TypeScript apps using Jest - LogRocket Blog
Jest is a simple, lightweight testing framework that provides a variety of testing capabilities to JavaScript and TypeScript projects. It ...
Read more >
Jest - TypeScript Deep Dive - Gitbook
That said, jest is an excellent unit testing option which provides great TypeScript support. Note: We assume you start off with a simple...
Read more >
Setting up a project with jest in TypeScript. - ITNEXT
ts-jest is a TypeScript preprocessor for jest , that lets you use jest to test projects written in TypeScript. But first we need...
Read more >
How to configure Jest with TypeScript | Swizec Teller
Configure TypeScript​​ The key parts are: "types": ["node", "jest"] , tells TypeScript to assume node and jest types are globally available. Make ...
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