Skip to content

Conversation

ayazhafiz
Copy link
Contributor

Exposes hasInitializer as a public function so that users of
TypeScript APIs do not have to roll their own HasInitializer type
guards.

Closes #33115.

Exposes `hasInitializer` as a public function so that users of
TypeScript APIs do not have to roll their own `HasInitializer` type
guards.

Closes microsoft#33115.
@msftclas
Copy link

msftclas commented Sep 3, 2019

CLA assistant check
All CLA requirements met.

@weswigham
Copy link
Member

Our internal hasInitializer "guard" isn't really safe guard - it (just) checks if an initializer field is actually present, because in many cases it is optional (and so using it as a type guard in incorrect in the false branch case) - the implementation using node kinds which you had in your issue is likely much more correct for your usecase.

@ayazhafiz
Copy link
Contributor Author

@weswigham would you prefer creating a new guard or changing the existing one?

@weswigham
Copy link
Member

A new one, probably

@ayazhafiz
Copy link
Contributor Author

Closing in favor of #33229

@ayazhafiz ayazhafiz closed this Sep 4, 2019
@ayazhafiz ayazhafiz deleted the feat/expose-hasInitializer branch September 4, 2019 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose a isExpressionInitializer type guard function
3 participants