Skip to content

chore(ts): Better generics for getDynamicText function #14415

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

Merged
merged 1 commit into from
Aug 19, 2019

Conversation

dashed
Copy link
Member

@dashed dashed commented Aug 15, 2019

We utilize generics to infer types based on the given value and fixed parameters, and as well as the matched types for anything consuming the getDynamicText function.

By default fixed is inferred to be the same type as value.

This PR is a dependency for #14345

@lynnagara
Copy link
Member

Value frequently won't have the same type as fixed - is this going to be an issue?

@dashed
Copy link
Member Author

dashed commented Aug 15, 2019

@lynnagara no it won't. TS is smart enough to adjust the types as necessary based on the arguments and the return types.

For example:

Screen Shot 2019-08-15 at 4 12 43 PM

@dashed dashed merged commit ee1732f into master Aug 19, 2019
@evanpurkhiser evanpurkhiser deleted the typescript/get-dynamic-text branch August 22, 2019 22:52
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants