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.

Use @types/react-native-calendars instead of default react-native-calendars types

See original GitHub issue

Description

Default typescript types from react-native-calendars are not correct. I want to use @types/react-native-calendars, because this lib define types right

Expected Behavior

Correctly define types for lib

Observed Behavior

react-native-calendars not correctly define types, some types are incorrect or marked with any. @types/react-native-calendars does not replace them after installation

Environment

"react-native": "0.64.1"
"react-native-calendars": "^1.1255.0"
"@types/react-native": "^0.64.0"
"@types/react-native-calendars": "^1.505.2"

Reproducible Demo

 error TS2305: Module '"react-native-calendars"' has no exported member 'DayComponentProps'.

3 import {DayComponentProps} from 'react-native-calendars';
          ~~~~~~~~~~~~~~~~~

error TS2305: Module '"react-native-calendars"' has no exported member 'DateObject'.

3 import {DateObject} from 'react-native-calendars';
          ~~~~~~~~~~

[01:21:39] Found 2 errors. Watching for file changes.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:6

github_iconTop GitHub Comments

8reactions
ulrellikcommented, Nov 9, 2021

A better workaround, esp. if you want to use recent version, is to just add this to your tsconfig.json:

{
  "compilerOptions": {
...
    "baseUrl": "./",
    "paths": {
      "react-native-calendars": ["node_modules/@types/react-native-calendars"]
    }, 
...
}

This tells TS to use @types/react-native-calendars instead of the inbuilt types which break everything.

3reactions
stale[bot]commented, Feb 8, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-calendars - npm
React Native Calendars 🗓️ 📆 This module includes various customizable React-Native calendar components. The package is both Android and iOS compatible.
Read more >
@types/react-native-calendars | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Performant rendering and Typescript typings with Wix's React ...
Boost rendering performance when using custom components with Wix's React Native Calendar library, and some other challenges.
Read more >
https://cdn.jsdelivr.net/npm/@types/react-native-c...
Type definitions for react-native-calendars 1.20 // Project: https://github.com/wix/react-native-calendars#readme // Definitions by: Tyler Zhang ...
Read more >
wix calendar react native
Нужна помощь в доработке календаря на React Native (wix/react-native-calendars) + консультации. If you'd like to use React Native Navigation by Wix, ...
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