Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Feb 5, 2018

Adds a helper function for converting T | undefined to T[].

@rbuckton
Copy link
Contributor

rbuckton commented Feb 5, 2018

Is this really necessary? It will be inlined to the same code and its not much shorter than writing x ? [x] : [].

@ghost
Copy link
Author

ghost commented Feb 5, 2018

Perhaps not, though in the linked PR I want to write optionToArray(getActionsForAddMissingInitializer(context, propertyDeclaration, newLineCharacter)) instead of applying to a local variable -- would be nice to be able to write let x = getActions... in x ? [x] : [], but we could do it in reverse with a lambda (x => x ? [x] : [])(...) (in other words, write the definition of optionToArray inline).

@ghost ghost closed this Feb 5, 2018
@ghost ghost deleted the optionToArray branch February 5, 2018 19:30
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
This pull request was closed.
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.

1 participant