Types TypeScript support
See original GitHub issueError using TypeScript.
TypeScript error in ./client/src/components/Clients/index.tsx(2,27):
Could not find a declaration file for module 'react-items-carousel'. ./client/node_modules/react-items-carousel/dist/react-items-carousel.js' implicitly has an 'any' type.
Try `npm install @types/react-items-carousel` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-items-carousel';` TS7016
1 | import React, { useState } from 'react'
> 2 | import ItemsCarousel from 'react-items-carousel';
| ^
3 | // import '@brainhubeu/react-carousel/lib/style.css'
4 | // import './Clietns.scss'
5 |
I recommend to you use dts gen created by Microsoft.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Handbook - Basic Types
In TypeScript, we support the same types as you would expect in JavaScript, with an extra enumeration type thrown in to help things...
Read more >Documentation - Advanced Types
This page lists some of the more advanced ways in which you can model types, it works in tandem with the Utility Types...
Read more >TypeScript: JavaScript With Syntax For Types.
TypeScript extends JavaScript by adding types to the language. TypeScript speeds up your development experience by catching errors and providing fixes ...
Read more >Documentation - Everyday Types
JavaScript has three very commonly used primitives: string , number , and boolean . Each has a corresponding type in TypeScript. As you...
Read more >Documentation - Utility Types
TypeScript provides several utility types to facilitate common type transformations. These utilities are available globally.
Read more >Top Related Medium Post
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Jehangir-Wahid, thanks man, it works like a charm! You just save-me some hours!!
Hi @Oluwasetemi and other guys,
I just came across this issue and is still not fixed. It can be fixed it by adding the
react-items-carousel
module manually. Just do the following in your React application.types
, named types, in the root directory of your application.index.d.ts
in the sub-directory, i.e. react-items-carousel, and your directory structure will be likeDeclare the carousel module in the file
index.d.ts
, like the following.declare module "react-items-carousel";
Now add your
local types
directory to the TypeScript configuration filetsconfig.json
in thecompilerOptions
object.Exclude the root directory you just created for your local
types
, so that it will not be compiled. Yourtsconfig.json
file will look like the following after adding these two.And that’s all, you are good to go to use the
react-items-carousel
module withTypeScript
support.