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
Units of measure is a useful [F# feature](http://msdn.microsoft.com/en-us/library/dd233243.aspx) that provides the optional ability to create tighter constraints on floating point and signed integer values.
11
9
12
-
TypeScript could benefit from a similar Units of Measure feature and expand to include tiny type support for `string`, `boolean`, and `date` objects. Such a feature would add zero runtime overhead, increase type constraints, and help decrease programmer error.
10
+
TypeScript could benefit from a similar units of measure feature and expand to include tiny type support for `string`, `boolean`, and `date` objects. Such a feature would add zero runtime overhead, increase type constraints, and help decrease programmer error.
13
11
14
12
## Defining Type Annotations
15
13
@@ -19,6 +17,8 @@ Type annotations are defined similarly to ambient types:
19
17
declaretype<unit-name> [ =measure ];
20
18
```
21
19
20
+
The optional measure part can be used to define a new type in terms of previously defined types. Note that this composite type cannot be used with non-`number` types.
21
+
22
22
**Examples:**
23
23
24
24
```typescript
@@ -28,7 +28,7 @@ declare type a = m/s^2;
28
28
declaretypeemail;
29
29
```
30
30
31
-
Note: The caret symbol is not used as the bitwise XOR operator, but as an exponent. In this case, `m/s^2` is equivalent to `m/s/s`.
31
+
Note: The caret symbol does not denote a bitwise XOR operator, but rather an exponent. In this case, `m/s^2` is equivalent to `m/s/s`.
0 commit comments