mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 19:52:53 +00:00
fix: correct isThing guard
This commit is contained in:
@@ -24,7 +24,11 @@ import {SCThing, SCThingType} from '../Thing';
|
|||||||
* @param {any} something Something to check
|
* @param {any} something Something to check
|
||||||
*/
|
*/
|
||||||
export function isThing(something: any): something is SCThing {
|
export function isThing(something: any): something is SCThing {
|
||||||
return (something.type && something.type in SCThingType);
|
return (
|
||||||
|
typeof something === 'object'
|
||||||
|
&& typeof something.type === 'string'
|
||||||
|
&& Object.values(SCThingType).indexOf(something.type) >= 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user