Skip to content

Commit

Permalink
fix: remove any type for Angular wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideMininni-Fincons committed Dec 13, 2024
1 parent d614fc3 commit 6432be7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SbbRadioButtonGroupElement extends SbbDisabledMixin(LitElement) {
* The value of the radio group.
*/
@property()
public set value(val: any | null) {
public set value(val: string | null) {
this._fallbackValue = val;
if (!this._didLoad) {
return;
Expand All @@ -69,13 +69,13 @@ class SbbRadioButtonGroupElement extends SbbDisabledMixin(LitElement) {
toCheck.checked = true;
}
}
public get value(): any | null {
public get value(): string | null {
return this.radioButtons.find((r) => r.checked && !r.disabled)?.value ?? this._fallbackValue;
}
/**
* Used to preserve the `value` in case the radios are not yet 'loaded'
*/
private _fallbackValue: any | null = null;
private _fallbackValue: string | null = null;

/**
* Size variant, either xs, s or m.
Expand Down
2 changes: 1 addition & 1 deletion src/elements/radio-button/radio-button-group/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ In order to ensure readability for screen-readers, please provide an `aria-label
| `radioButtons` | - | public | `(SbbRadioButtonElement \| SbbRadioButtonPanelElement)[]` | | List of contained radio buttons. |
| `required` | `required` | public | `boolean` | `false` | Whether the radio group is required. |
| `size` | `size` | public | `SbbRadioButtonSize` | `'m' / 'xs' (lean)` | Size variant, either xs, s or m. |
| `value` | `value` | public | `any \| null` | | The value of the radio group. |
| `value` | `value` | public | `string \| null` | | The value of the radio group. |

## Events

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import '@sbb-esta/lyne-elements/chip-label.js';
import '@sbb-esta/lyne-elements/radio-button.js';
import type { SbbRadioButtonGroupElement } from '@sbb-esta/lyne-elements/radio-button/radio-button-group/radio-button-group.js';

type DiffFileType = 'baselineFile' | 'failedFile' | 'diffFile';

/**
* Displays two images in fullscreen to overlay them.
*/
Expand All @@ -21,8 +23,7 @@ class FullscreenDiff extends LitElement {

@property() public accessor screenshotFiles: ScreenshotFiles | null = null;

@property() public accessor selectedFile: 'baselineFile' | 'failedFile' | 'diffFile' =
'failedFile';
@property() public accessor selectedFile: DiffFileType = 'failedFile';

public override render(): TemplateResult {
if (!this.screenshotFiles) {
Expand All @@ -38,7 +39,7 @@ class FullscreenDiff extends LitElement {
class="app-radio-button-group"
value=${this.selectedFile}
@change=${(event: Event) =>
(this.selectedFile = (event.target as SbbRadioButtonGroupElement).value)}
(this.selectedFile = (event.target as SbbRadioButtonGroupElement).value as DiffFileType)}
>
${!this.screenshotFiles.isNew
? html`<sbb-radio-button value="baselineFile">Baseline</sbb-radio-button>`
Expand Down

0 comments on commit 6432be7

Please sign in to comment.