-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
DiscussionIssues which may not have code impactIssues which may not have code impact
Description
Hey there!
I’m updating Programming TypeScript to include assertions in control flow analysis, and was looking for guidance about naming.
Type assertions (x as T
) and assertions in control flow analysis (asserts x is T
) are similarly named. What’s a good way to call these these features, in a way that doesn’t confuse people and aligns with the way the TS team is communicating it?
A couple of ideas:
- Rename
x as T
to “type coercion” or “type casting" (even though it’s not a runtime behavior), and callasserts x is T
a “type assertion” - Keep
x as T
as-is (“type assertion”), and callasserts x is T
a “user-defined type assertion”, similar to a “user-defined type guard”
Thanks!
Metadata
Metadata
Assignees
Labels
DiscussionIssues which may not have code impactIssues which may not have code impact