Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive with rxjs-no-subclass #87

Closed
timbru31 opened this issue Mar 6, 2019 · 3 comments
Closed

False positive with rxjs-no-subclass #87

timbru31 opened this issue Mar 6, 2019 · 3 comments
Labels

Comments

@timbru31
Copy link

timbru31 commented Mar 6, 2019

Hi there 👋,

thanks for these rules, really awesome 👍
I'm having a false positive with the rule rxjs-no-subclass. OpenLayers defines Observables, too.
Below is an example snippet which triggers the rule:

declare module 'ol/Object' {
	import Observable from 'ol/Observable';

	// tslint:disable-next-line:rxjs-no-subclass
	class BaseObject extends Observable {
		get(key: string): any;
	}
}

The Observable class is:

declare module 'ol/Observable' {
	export interface GlobalObject { [key: string]: any; }
	export type EventsKey = GlobalObject;

	class Observable {
		constructor();
		changed(): void;
		getRevision(): number;
		on(type: (string | string[]), listener: Function): (EventsKey | EventsKey[]);
		once(type: (string | string[]), listener: Function): (EventsKey | EventsKey[]);
		un(type: (string | string[]), listener: Function): void;
	}

	export default Observable;
}
@cartant cartant added the bug label Mar 6, 2019
@cartant
Copy link
Owner

cartant commented Mar 7, 2019

This should be solvable. However, it will involve digging around in TypeScript's Type representation. And, AFAICT, the documentation is ... the source. I will have a look at this on the weekend. Hopefully, it won't be too much of a challenge.

cartant added a commit that referenced this issue Mar 9, 2019
@cartant cartant closed this as completed in 31d00c0 Mar 9, 2019
@cartant
Copy link
Owner

cartant commented Mar 9, 2019

Should be fixed in 4.18.2.

@timbru31
Copy link
Author

timbru31 commented Mar 9, 2019

Nice, thanks a lot for the quick fix. I’ll test it later today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants