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
@@ -75,7 +75,7 @@ The `UnknownIdentifier` interface exists for future-proofing and you might encou
75
75
76
76
#### Basic usage
77
77
78
-
```typescript
78
+
```javascript
79
79
// create an identifier
80
80
constunknownId= { id:"a raw id that originated in the service" };
81
81
```
@@ -88,7 +88,7 @@ const unknownId = { id: "a raw id that originated in the service" };
88
88
89
89
While you construct identifiers for a concrete type that you pass *into* the SDK, the SDK returns a `CommunicationIdentifierKind`, which is a [discriminated union](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#discriminated-unions). It's easy to narrow to a concrete type and we suggest a switch-case statement with pattern matching:
The identifier interfaces have been designed so that you don't have to specify `kind` to reduce verbosity, and the discriminating union with the `kind` property is only used when returned from the SDK. However, if you find yourself needing to translate an identifier to its corresponding discriminating union type you can use this helper:
118
118
119
-
```typescript
119
+
```javascript
120
120
constidentifierKind=getIdentifierKind(identifier); // now you can switch-case on the kind
121
121
```
122
122
@@ -128,7 +128,7 @@ For that purpose, identifiers have another representation called `RawId`. An ide
0 commit comments