export interface IDisposable { dispose(): void; } /** * Check if `thing` is {@link IDisposable disposable}. */ export function isDisposable(thing: E): thing is E & IDisposable { return ( typeof thing === 'object' && thing !== null && typeof ((thing)).dispose === 'function' && ((thing)).dispose.length === 0 ); }