Skip to content

feat(base): assertion function type guard#2

Merged
antfu merged 1 commit intoantfu:mainfrom
johannschopplich:assertion-function
Jun 18, 2021
Merged

feat(base): assertion function type guard#2
antfu merged 1 commit intoantfu:mainfrom
johannschopplich:assertion-function

Conversation

@johannschopplich
Copy link
Copy Markdown
Contributor

@johannschopplich johannschopplich commented Jun 18, 2021

  • Use assertion function syntax to let TypeScript know the condition is handled. Otherwise TypeScript will throw erros like "this variable may be undefined" etc.
  • I believe the ErrorConstructor can handle only one argument, the message string.

@antfu antfu merged commit 973ac74 into antfu:main Jun 18, 2021
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.

2 participants