theapache64
theapache64

Reputation: 11744

TypeScript : How to fix TS7016 : Type definition not found 404

I am new in react, and I've been doing a project with Flow. Last night i met TypeScript. It's awesome.

I've decided to migrate to TypeScript from Flow and have been converting my .js/.jsx files to .ts/.tsx. I've installed type definitions for react, redux etc It works perfectly fine. But , I can't find type definition for a library called react-native-material-color. It's not a famous library. I am getting below error.

image

and when i try to install the typedef using npm , am getting 404

enter image description here

  1. How can i fix the error ?

  2. Is there any option to tell TypeScript to skip the type check for a specific library ?

Upvotes: 3

Views: 1308

Answers (2)

laurent lahmy
laurent lahmy

Reputation: 1689

Quick and dirty:

// @ts-ignore
import Color from "react-native-material-color"

Upvotes: 2

Jamie Birch
Jamie Birch

Reputation: 6112

  1. You can fix the error by writing typings yourself, or preferably by installing the types (if they do exist) using npm install --save-dev @types/react-native-material-color.

  2. You can require the implementation without importing the typings like so:

Example:

const Color = require("react-native-material-color");

Upvotes: 5

Related Questions