GovTechSG / sgds-govtech-react

React components for SGDS
https://react.designsystem.tech.gov.sg/
MIT License
15 stars 6 forks source link

Stepper does not export StepperProps, unlike other components #240

Closed rjx18 closed 3 months ago

rjx18 commented 4 months ago

Prerequisites

Describe the issue

I am trying to wrap each component with a higher-order function and then re-export them in my library for further use. However, with Stepper, I am getting the following error:

Exported variable 'Stepper' has or is using name 'StepperProps' from external module "/home/xiongjr/git/jtc-oneui-react/node_modules/@govtechsg/sgds-react/Stepper/Stepper" but cannot be named.ts(4023)

This is a simplified example of what I am trying to do:

import { Stepper as SgdsStepper, useStep as SgdsUseStep } from "@govtechsg/sgds-react/Stepper"
import withSx from "../utils/withSx";

const Stepper = withSx(SgdsStepper)

export { Stepper }

I think the issue lies in the fact that StepperProps is not exported from Stepper.tsx. In all other components, component props are also exported.

import React from 'react';
import { UseStepMethods } from './useStep';
interface StepperProps {
    methods: UseStepMethods;
}
declare const Stepper: React.FC<StepperProps>;
export default Stepper;

Suggestion Add export to StepperProps:

import React from 'react';
import { UseStepMethods } from './useStep';
export interface StepperProps {
    methods: UseStepMethods;
}
declare const Stepper: React.FC<StepperProps>;
export default Stepper;

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

No response

Describe your frontend stack. What version of React and @govtechsg/sgds-react are you using? CSR or SSR?

React v17, sgds-react v2.5.1

clukhei commented 3 months ago

https://github.com/GovTechSG/sgds-govtech-react/releases/tag/v2.5.2

fix is released in 2.5.2 @rjx18