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
{{ message }}
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
Consider to use unknown type instead of any for Metrics Utils functions.
Fact: unknown acts like a type-safe version of any by requiring us to perform some type of checking before we can use the value of the unknown element or any of its properties.
Dependency on #279 (unknown type is available since TypeScript 3.0).
Example usage:
export function isLengthMethodInterface(obj: unknown):
obj is LengthMethodInterface {
return _isSizeAttributeInterface(obj);
}
// Performs a structural check on given object.
// tslint:disable-next-line:no-any
function _isSizeAttributeInterface(obj: any): boolean {
return !!obj && typeof obj === 'object' && 'size' in obj &&
typeof obj.size === 'number';
}
The text was updated successfully, but these errors were encountered:
Consider to use
unknown
type instead ofany
for Metrics Utils functions.Fact:
unknown
acts like a type-safe version ofany
by requiring us to perform some type of checking before we can use the value of theunknown
element or any of its properties.Dependency on #279 (
unknown
type is available since TypeScript 3.0).Example usage:
The text was updated successfully, but these errors were encountered: