Developer Tip
typescript
Seif Sgayer
TypeScript Type Guards
function isString(value: unknown): value is string {
return typeof value === 'string';
}
// Usage
if (isString(value)) {
// value is typed as string here
console.log(value.toUpperCase());
}