Skip to content

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

Merged
dashed merged 1 commit into
masterfrom
typescript/get-dynamic-text
Aug 19, 2019
Merged

chore(ts): Better generics for getDynamicText function#14415
dashed merged 1 commit into
masterfrom
typescript/get-dynamic-text

Conversation

@dashed

@dashed dashed commented Aug 15, 2019

Copy link
Copy Markdown
Member

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
Copy Markdown
Member

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

@dashed

dashed commented Aug 15, 2019

Copy link
Copy Markdown
Member Author

@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