Giter Club home page Giter Club logo

Comments (10)

ghernandezr avatar ghernandezr commented on May 31, 2024 24

I solve this issue declaring my own .d.ts file, I am using create-react-app, this search for the file src/global.d.ts
This is how it look to me, any suggestion is welcome:

declare module 'react-step-progress-bar' {
  interface ProgressBarProps {
    percent?: number;
    filledBackground?: any;
    height?: string | number;
    stepPositions?: number;
  }

  interface StepProps {
    transition?: any;
    position?: any;
  }
  class ProgressBar extends React.Component<ProgressBarProps, any> {}
  class Step extends React.Component<StepProps, any> {}
}  

Thanks!!!!

from react-step-progress-bar.

andresdsep avatar andresdsep commented on May 31, 2024 10

Had a closer look to the package code and made a couple of changes to @ghernandezr's types:

declare module 'react-step-progress-bar' {
  import React from 'react';

  interface ProgressBarProps {
    percent: number;
    stepPositions?: Array<number>;
    unfilledBackground?: string;
    filledBackground?: string;
    width?: number;
    height?: number;
    hasStepZero?: boolean;
    text?: string;
  }
  interface StepProps {
    children: (props: {
      accomplished: boolean;
      transitionState: string;
      index: number;
      position: number;
    }) => React.ReactNode;
    transition?: 'scale' | 'rotate' | 'skew';
    transitionDuration?: number;
  }
  class ProgressBar extends React.Component<ProgressBarProps, any> {}
  class Step extends React.Component<StepProps, any> {}
}

from react-step-progress-bar.

tomniermann avatar tomniermann commented on May 31, 2024 2

ProgressBarProps also needs children so...

declare module 'react-step-progress-bar' {
  import React from 'react'

  interface ProgressBarProps {
    percent: number
    stepPositions?: number[]
    unfilledBackground?: string
    filledBackground?: string
    width?: number
    height?: number
    hasStepZero?: boolean
    text?: string
    children?:
    | React.ReactChild
    | React.ReactChild[]
  }
  interface StepProps {
    children: (props: {
      accomplished: boolean
      transitionState: string
      index: number
      position: number
    }) => React.ReactNode
    transition?: 'scale' | 'rotate' | 'skew'
    transitionDuration?: number
  }
  class ProgressBar extends React.Component<ProgressBarProps, any> {}
  class Step extends React.Component<StepProps, any> {}
}

from react-step-progress-bar.

mannamh avatar mannamh commented on May 31, 2024 1

Same issue when i tried in one f my react project

from react-step-progress-bar.

gothraven avatar gothraven commented on May 31, 2024 1

Thank you @tomniermann @andresdsep πŸ™ I hope the types will be included in future releases!

from react-step-progress-bar.

rknyra avatar rknyra commented on May 31, 2024

same issue here πŸ€”πŸ˜•πŸ˜•

from react-step-progress-bar.

pierreericgarcia avatar pierreericgarcia commented on May 31, 2024

Thank you so much for your feedbacks ! I'll use typescript for the 2.0 !

from react-step-progress-bar.

pinefirst avatar pinefirst commented on May 31, 2024

I have same issue in typescript

from react-step-progress-bar.

gothraven avatar gothraven commented on May 31, 2024

@pierreericgarcia I'm looking forward to help with adding types and or transforming the code base into typescript but I don't see branches for that matter, I'd love to get in touch with you if there is more I should know about the migration to typescript πŸ™

from react-step-progress-bar.

temirovtemirlan avatar temirovtemirlan commented on May 31, 2024

Thank you very much, for typing this awesome libraryπŸš€πŸš€πŸš€

from react-step-progress-bar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.