-
Notifications
You must be signed in to change notification settings - Fork 23
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
Allow non-enum Input in components #2093
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ export class InputComponent implements OnChanges { | |
|
||
@HostBinding('class') | ||
@Input() | ||
size: InputSize = InputSize.large; | ||
size: InputSize | keyof InputSize = InputSize.large; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolves to: (property) InputComponent.size: number | InputSize | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | ... 29 more ... | "padEnd" |
||
|
||
/** | ||
* Removes padding, width, rounded borders and drop-shadow when set to `true`. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,7 @@ export class PopoverComponent implements AfterViewInit, OnDestroy { | |
wrapperElement: ElementRef<HTMLDivElement>; | ||
|
||
@Input() | ||
popout: HorizontalDirection = HorizontalDirection.right; | ||
popout: HorizontalDirection | keyof HorizontalDirection = HorizontalDirection.right; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolves to:
|
||
|
||
@Input() | ||
target: HTMLElement | ElementRef<HTMLElement>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ export class SegmentedControlComponent { | |
} | ||
} | ||
|
||
@Input() mode: SegmentedControlMode = SegmentedControlMode.default; | ||
@Input() mode: SegmentedControlMode | keyof SegmentedControlMode = SegmentedControlMode.default; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolves to:
|
||
|
||
@HostBinding('class') | ||
get _modeCssClass() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately
keyof AvatarSize
returns all of the keys for a string object (i think it is a string object - not 100% sure).I've created an example here: link to typescript playground.
Notice the type of

TestType
I think we need something like
valueof AvatarSize
(unfortunately i do not think valueof exists...).This comment goes for all of the places where
keyof
has been used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only the case where the case in the enum maps to a string. I already fixed it for
ButtonSize
, but didn't see it forAvatarSize
. I found 2 others.