Skip to content

Commit d5edf2b

Browse files
committed
fix: make provider type parametric
1 parent f54edfd commit d5edf2b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src-commons-atom/ProviderRegistry.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import { Disposable, TextEditor } from "atom"
22

3-
export interface Provider {
3+
export interface ProviderCommon {
44
// Providers with higher priorities will be preferred over lower ones.
55
priority: number
66
// Omitting grammarScopes implies that the provider applies to all grammars.
7-
grammarScopes?: Array<string>
7+
grammarScopes?: Array<string>,
88
}
99

10-
export class ProviderRegistry {
10+
export class ProviderRegistry<Provider extends ProviderCommon> {
1111
private providers: Array<Provider>
1212

1313
constructor() {
1414
this.providers = []
1515
}
1616

1717
addProvider(provider: Provider): Disposable {
18-
const index = this.providers.findIndex((p: Provider) => provider.priority > p.priority)
18+
const index = this.providers.findIndex((p) => provider.priority > p.priority)
1919
if (index === -1) {
2020
this.providers.push(provider)
2121
} else {

0 commit comments

Comments
 (0)