Skip to content

Commit 8cde778

Browse files
alex-juaklkv
authored andcommitted
Ensure compatible types
Ensures type safety without the need for inline type assertions
1 parent 9c967a8 commit 8cde778

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

packages/components/src/components/hds/app-footer/status-link.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ export default class HdsAppFooterStatusLinkComponent extends Component<HdsAppFoo
6565
*/
6666
get statusIcon() {
6767
if (this.status && !this.args.statusIcon) {
68-
return STATUSES[this.status]
69-
?.iconName as FlightIconSignature['Args']['name'];
68+
return STATUSES[this.status]?.iconName;
7069
}
7170
return this.args.statusIcon;
7271
}

packages/components/src/components/hds/app-footer/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) HashiCorp, Inc.
33
* SPDX-License-Identifier: MPL-2.0
44
*/
5+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
56

67
export enum HdsAppFooterStatusValues {
78
Operational = 'operational',
@@ -16,7 +17,7 @@ export const HdsAppFooterStatusLinkStatusValues: Record<
1617
HdsAppFooterStatusValues,
1718
{
1819
text: string;
19-
iconName: string;
20+
iconName: FlightIconSignature['Args']['name'];
2021
}
2122
> = {
2223
[HdsAppFooterStatusValues.Operational]: {

packages/components/src/components/hds/stepper/task/indicator.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
HdsStepperStatusToIconsValues,
1212
} from '../types.ts';
1313
import type { HdsStepperStatuses } from '../types.ts';
14-
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
1514

1615
export const DEFAULT_STATUS = HdsStepperStatusesValues.Incomplete;
1716
export const STATUSES: string[] = Object.values(HdsStepperStatusesValues);
@@ -62,9 +61,7 @@ export default class HdsStepperTaskIndicatorComponent extends Component<HdsStepp
6261
*/
6362

6463
get iconName() {
65-
return MAPPING_STATUS_TO_ICONS[
66-
this.status
67-
] as FlightIconSignature['Args']['name'];
64+
return MAPPING_STATUS_TO_ICONS[this.status];
6865
}
6966

7067
/**

packages/components/src/components/hds/stepper/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) HashiCorp, Inc.
33
* SPDX-License-Identifier: MPL-2.0
44
*/
5+
import type { FlightIconSignature } from '@hashicorp/ember-flight-icons/components/flight-icon';
56

67
export enum HdsStepperStatusesValues {
78
Incomplete = 'incomplete',
@@ -14,7 +15,7 @@ export type HdsStepperStatuses = `${HdsStepperStatusesValues}`;
1415

1516
export const HdsStepperStatusToIconsValues: Record<
1617
HdsStepperStatusesValues,
17-
string
18+
FlightIconSignature['Args']['name']
1819
> = {
1920
[HdsStepperStatusesValues.Incomplete]: 'circle',
2021
[HdsStepperStatusesValues.Progress]: 'circle-half',

0 commit comments

Comments
 (0)