Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove any type for Angular wrapper #3297

Merged
merged 2 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';

export 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
Loading