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.

how to support typescript?

See original GitHub issue

image

i am try yarn add @types/react-native-shadow, but is not found !

无法找到模块“react-native-shadow”的声明文件。“d:/phpstudy_pro/WWW/wuzhai/app/node_modules/react-native-shadow/index.js”隐式拥有 "any" 类型。
  Try `npm install @types/react-native-shadow` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-shadow';`

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

17reactions
ACHPcommented, Aug 3, 2020

This is the definition file I created in my project ( under src/@types/react-native-shadow.d.ts It might not be perfect, but it work for us. Hope it can help

declare type RNComponent<P = {}, S = {}, SS = any> = import('react').Component<P, S, SS>;
declare type RNConstructor<T> = import('react-native').Constructor<T>;
declare type RNViewProps = import('react-native').ViewProps;
declare type RNViewStyle = import('react-native').ViewStyle;

declare module 'react-native-shadow' {
  interface BoxShadowType {
    width: number,
    height: number,
    color: string,
    border: number,
    radius: number,
    opacity: number,
    x: number,
    y: number,
    style?: RNViewStyle,
  }

  interface BorderShadowType {
    width: number,
    color: string,
    border: number,
    opacity: number,
    style?: RNViewStyle,
    side: 'top' | 'bottom' | 'left' | 'right',
    inset: boolean,
  }
  export const BoxShadow : RNConstructor<RNComponent<RNViewProps & {setting?: BoxShadowType}>>;
  export const BorderShadow : RNConstructor<RNComponent<RNViewProps & {setting?: BorderShadowType}>>;
}

6reactions
jong-huicommented, Jun 1, 2020

my way:

// @ts-ignore
import {BoxShadow} from 'react-native-shadow';
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set up TypeScript
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal. To do...
Read more >
How to Add TypeScript to a JavaScript Project - freeCodeCamp
How to convert a JavaScript application to support TypeScript. · Install typescript · Typescript config file · Create your first .TS file in...
Read more >
How To Set Up a New TypeScript Project - DigitalOcean
To begin your TypeScript project, you will need to create a directory for your project: mkdir typescript-project. Now change into your project ...
Read more >
TypeScript tutorial with Visual Studio Code
Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript...
Read more >
How to Setup a TypeScript + Node.js Project | Khalil Stemmler
Initial Setup · Setup Node.js package.json · Add TypeScript as a dev dependency · Install ambient Node.js types for TypeScript · Create a...
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