-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[TS migration] Migrate 'ExpensifyWordmark.js' component to TypeScript #31478
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
Changes from 2 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 |
---|---|---|
|
@@ -462,7 +462,7 @@ function getBorderColorStyle(borderColor: string): ViewStyle { | |
/** | ||
* Returns the width style for the wordmark logo on the sign in page | ||
*/ | ||
function getSignInWordmarkWidthStyle(environment: string, isSmallScreenWidth: boolean): ViewStyle { | ||
function getSignInWordmarkWidthStyle(environment: ValueOf<typeof CONST.ENVIRONMENT> | undefined, isSmallScreenWidth: boolean): ViewStyle { | ||
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. Is there a shorthand way to set the param type here? Asking as I'm new to Typescript but familiar with Kotlin/Swift. Also, is making this optional really necessary? It looks like the only usage of this function will reliably return an Environment... or is this due to a potential issue with 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. @Julesssss We can switch
Yeah, since 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. Okay thanks. I'm not too bothered about the param ordering, but 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. @Julesssss Updated 🙂 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. @fabioh8010 @Julesssss @VickyStash Shouldn't environment be required? I think we should throw an exception instead of returning an empty object in useEnvironment because EnrivonmentProvider is passed in root app. So that will allow us to remove possible null from getSignInWordmarkWidthStyle. I think there is no case when the environment is null. 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. @ArekChr yeah if it is possible to enforce a non-optional environment, that sounds good to me. Happy to review a PR if you could raise one 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. @ArekChr @fabioh8010
It should be ok since these values are also used as default state values here and this way the environment will be non-optional value. |
||
if (environment === CONST.ENVIRONMENT.DEV) { | ||
return isSmallScreenWidth ? {width: variables.signInLogoWidthPill} : {width: variables.signInLogoWidthLargeScreenPill}; | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.