You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var typeAssertedNumber =/**@type{number}*/ (numberOrString);
174
170
```
175
171
172
+
A more practical and common use case is to assign a specific HTML element type for a element.
173
+
174
+
Sometimes you will have information about the type of a value that TypeScript can’t know about.
175
+
176
+
For example, if you’re using `document.getElementById`, TypeScript only knows that this will return *some* kind of `HTMLElement`, but you might know that your page will always have an `HTMLCanvasElement` with a given ID.
177
+
178
+
In this situation, you can use a *type assertion* to specify a more specific type:
0 commit comments