Skip to content

Commit

Permalink
fix(createfullpagestep): hasFieldset and fieldsetLegendText types (#6057
Browse files Browse the repository at this point in the history
)

fieldsetLegendText should not be required when hasFieldset is not specified.

Basically, not specifying hasFieldset is the same thing as setting it to false.

Refs #4512.
  • Loading branch information
wkeese authored Sep 17, 2024
1 parent 7390b55 commit b5db933
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,24 @@ interface CreateFullPageStepBaseProps extends PropsWithChildren {
title: ReactNode;
}

// Try to specify the hasFieldset and fieldsetLegendText Typescript requirements.
// Basically, fieldsetLegendText should only be specified when hasFieldset is true.
// And usually, hasFieldset won't be specified at all unless it's being set to true.
type CreateFullPageStepFieldsetProps =
| {
// fieldsetLegendText should not be specified unless hasFieldset is true, but
// not sure how to do that in Typescript.
fieldsetLegendText?: string;
}
| {
hasFieldset: false;

// fieldsetLegendText should not be specified unless hasFieldset is true, but
// not sure how to do that in Typescript.
fieldsetLegendText?: string;
}
| {
hasFieldset?: true;
hasFieldset: true;
fieldsetLegendText: string;
};

Expand Down Expand Up @@ -271,7 +282,6 @@ CreateFullPageStep.propTypes = {
/**
* This will conditionally disable the submit button in the multi step CreateFullPage
*/
/**@ts-ignore */
disableSubmit: PropTypes.bool,

/**
Expand All @@ -285,7 +295,6 @@ CreateFullPageStep.propTypes = {
/**
* This optional prop will render your form content inside of a fieldset html element
*/
/**@ts-ignore */
hasFieldset: PropTypes.bool,

/**
Expand Down

0 comments on commit b5db933

Please sign in to comment.